Browse Source

Fix design tool bug

LiuQilin 8 năm trước cách đây
mục cha
commit
a2c04090aa

BIN
.vs/MyLovelyGarden/v14/.suo


BIN
Assets/Resource/DebugMode.prefab


+ 8 - 0
Assets/Resource/DebugMode.prefab.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b22fd2d9abc702d43ac62a412537d4e9
+timeCreated: 1495591388
+licenseType: Pro
+NativeFormatImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/Resource/Logo.unity


+ 2 - 2
Assets/Resource/XML/PlayerConfig.xml

@@ -1,5 +1,5 @@
 <PlayerConfig>
-  <Version value="233" />
+  <Version value="241" />
 
   <ID value="Default" />
 ////  <TutorialA value="0" />
@@ -34,7 +34,7 @@
     <Skill ID="Skill4" SkillType="Skill" ItemStatus="Lock" Level="0" CdTimer="0" EffectTimer="0" />
     <Skill ID="Skill5" SkillType="Skill" ItemStatus="Lock" Level="0" CdTimer="0" EffectTimer="0" />
     <Skill ID="Skill6" SkillType="Skill" ItemStatus="Lock" Level="0" CdTimer="0" EffectTimer="0" />
-////    <Skill ID="Skill1" SkillType="BigSkill" ItemStatus="Upgrade" BarStatus="Buy" Level="1" CdTimer="0" EffectTimer="0" />
+    <Skill ID="Skill1" SkillType="BigSkill" ItemStatus="Upgrade" BarStatus="Buy" Level="1" CdTimer="0" EffectTimer="0" />
     <Skill ID="Skill2" SkillType="BigSkill" ItemStatus="Lock" BarStatus="UnLock" Level="0" CdTimer="0" EffectTimer="0" />
     <Skill ID="Skill3" SkillType="BigSkill" ItemStatus="Lock" BarStatus="UnLock" Level="0" CdTimer="0" EffectTimer="0" />
     <Skill ID="Skill7" SkillType="BigSkill" ItemStatus="Lock" BarStatus="UnLock" Level="0" CdTimer="0" EffectTimer="0" />

+ 54 - 13
Assets/Script/Editor/EditorBundle.cs

@@ -20,60 +20,101 @@ public class EditorBundle : Editor
         Bundle.Instance = Script;
     }
 
+    public override void OnInspectorGUI()
+    {
+        base.OnInspectorGUI();
+
+        if (GUILayout.Button("ClearTexture"))
+        {
+            for (int i = 0; i < Script.UiList.Count; i++)
+            {
+                Sprite sprite = Script.UiList[i] as  Sprite;
+
+                if (sprite == null)
+                {
+                    Texture2D texture = Script.UiList[i] as Texture2D;
+
+                    if (texture != null)
+                    {
+                        Script.UiList.RemoveAt(i--);
+                    }
+                }
+            }
+
+            for (int i = 0; i < Script.SceneList.Count; i++)
+            {
+                Sprite sprite = Script.SceneList[i] as Sprite;
+
+                if (sprite == null)
+                {
+                    Texture2D texture = Script.SceneList[i] as Texture2D;
+
+                    if (texture != null)
+                    {
+                        Script.SceneList.RemoveAt(i--);
+                    }
+                }
+            }
+        }
+    }
+
+
     public static void Tag()
     {
         string path;
-
+        Bundle bundle;
         AssetImporter assetImporter;
 
-        for (int i = 0; i < Script.UiList.Count; i++)
+        bundle = AssetDatabase.LoadAssetAtPath<Bundle>("Assets/Resource/DebugMode.prefab");
+
+        for (int i = 0; i < bundle.UiList.Count; i++)
         {
-            path = AssetDatabase.GetAssetPath(Script.UiList[i]);
+            path = AssetDatabase.GetAssetPath(bundle.UiList[i]);
 
             assetImporter = AssetImporter.GetAtPath(path);
 
             assetImporter.assetBundleName = "ui";
         }
 
-        for (int i = 0; i < Script.AtlasList.Count; i++)
+        for (int i = 0; i < bundle.AtlasList.Count; i++)
         {
-            path = AssetDatabase.GetAssetPath(Script.AtlasList[i]);
+            path = AssetDatabase.GetAssetPath(bundle.AtlasList[i]);
 
             assetImporter = AssetImporter.GetAtPath(path);
 
             assetImporter.assetBundleName = "atlas";
         }
 
-        for (int i = 0; i < Script.EffectList.Count; i++)
+        for (int i = 0; i < bundle.EffectList.Count; i++)
         {
-            path = AssetDatabase.GetAssetPath(Script.EffectList[i]);
+            path = AssetDatabase.GetAssetPath(bundle.EffectList[i]);
 
             assetImporter = AssetImporter.GetAtPath(path);
 
             assetImporter.assetBundleName = "effect";
         }
 
-        for (int i = 0; i < Script.AudioList.Count; i++)
+        for (int i = 0; i < bundle.AudioList.Count; i++)
         {
-            path = AssetDatabase.GetAssetPath(Script.AudioList[i]);
+            path = AssetDatabase.GetAssetPath(bundle.AudioList[i]);
 
             assetImporter = AssetImporter.GetAtPath(path);
 
             assetImporter.assetBundleName = "audio";
         }
 
-        for (int i = 0; i < Script.SceneList.Count; i++)
+        for (int i = 0; i < bundle.SceneList.Count; i++)
         {
-            path = AssetDatabase.GetAssetPath(Script.SceneList[i]);
+            path = AssetDatabase.GetAssetPath(bundle.SceneList[i]);
 
             assetImporter = AssetImporter.GetAtPath(path);
 
             assetImporter.assetBundleName = "scene";
         }
 
-        for (int i = 0; i < Script.ConfigList.Count; i++)
+        for (int i = 0; i < bundle.ConfigList.Count; i++)
         {
-            path = AssetDatabase.GetAssetPath(Script.ConfigList[i]);
+            path = AssetDatabase.GetAssetPath(bundle.ConfigList[i]);
 
             assetImporter = AssetImporter.GetAtPath(path);
 

+ 13 - 0
Assets/Script/Manage/Initializer.cs

@@ -12,6 +12,9 @@ public class Initializer : MonoBehaviour
 {
     #region 变量
 
+    public bool DebugMode;
+    public GameObject DebugModeGo;
+
     public static bool LoadComplete;
     public static Initializer Instance;
     public static Transform Transform;
@@ -19,6 +22,7 @@ public class Initializer : MonoBehaviour
 
     #endregion
 
+
     private void Awake()
     {
         DontDestroyOnLoad(gameObject);
@@ -28,6 +32,15 @@ public class Initializer : MonoBehaviour
         Instance = this;
         Transform = transform;
 
+        if (DebugMode)
+        {
+            Instantiate(DebugModeGo, transform);
+        }
+        else
+        {
+            gameObject.AddComponent<Bundle>();
+        }
+
         gameObject.AddComponent<ManaIAP>();
 
         gameObject.AddScript<Auxiliary>();

+ 4 - 6
Assets/Script/Tool/Bundle.cs

@@ -25,8 +25,6 @@ public class Bundle : MonoBehaviour
     private static AssetBundle Scene;
     private static AssetBundle Config;
 
-    public bool DebugMode;
-
     public List<Object> UiList;
     public List<Object> AtlasList;
     public List<Object> EffectList;
@@ -49,7 +47,7 @@ public class Bundle : MonoBehaviour
 
     public static T Load<T>(string goName, Folder folder) where T : Object
     {
-        if (Instance.DebugMode)
+        if (Initializer.Instance.DebugMode)
         {
             #region MyRegion
 
@@ -219,7 +217,7 @@ public class Bundle : MonoBehaviour
 
         yield return LoadUI();
 
-        if (!Logo.LogoComplete && !Instance.DebugMode)
+        if (!Logo.LogoComplete && !Initializer.Instance.DebugMode)
         {
             ManaReso.AddAsyncLoad("Canvas",1,Folder.UI,ObjType.Canvas);
 
@@ -239,7 +237,7 @@ public class Bundle : MonoBehaviour
 
         yield return LoadScene();
 
-        if (!Logo.LogoComplete && !Instance.DebugMode)
+        if (!Logo.LogoComplete && !Initializer.Instance.DebugMode)
         {
             //if (Data.GetPlayerBool("TutorialA") && Data.GetPlayerInt("TutorialIndexA") == 1)
             //{
@@ -260,7 +258,7 @@ public class Bundle : MonoBehaviour
 
         yield return LoadAudio();
 
-        if (!Logo.LogoComplete && !Instance.DebugMode)
+        if (!Logo.LogoComplete && !Initializer.Instance.DebugMode)
         {
             ManaReso.AddAsyncLoad("Music", 1, Folder.Audio, ObjType.Music);