From 2e25bdf7cccacb5da4fe42bad9edd1cdea5b70c3 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期四, 14 三月 2019 20:26:27 +0800
Subject: [PATCH] 3335 更新界面工具.

---
 Assets/Editor/Tool/FormatPrefabTool.cs |   16 --------
 Assets/Editor/Tool/DeleteStar.cs       |   50 +++++++++++++++----------
 2 files changed, 30 insertions(+), 36 deletions(-)

diff --git a/Assets/Editor/Tool/DeleteStar.cs b/Assets/Editor/Tool/DeleteStar.cs
index d320973..eecce8d 100644
--- a/Assets/Editor/Tool/DeleteStar.cs
+++ b/Assets/Editor/Tool/DeleteStar.cs
@@ -3,34 +3,44 @@
 using Snxxz.UI;
 using UnityEngine;
 using UnityEditor;
+using System;
 
-public class DeleteStar : MonoBehaviour {
+public class DeleteStar : MonoBehaviour
+{
 
-    [MenuItem("Prefab/DeleteStar")]
     private static void DeleteStarInPrefab()
     {
-        string[] ids = AssetDatabase.FindAssets("t:Prefab",new string[] { "Assets/ResourcesOut/UI/PriorityWindow" });
-        //string[] path = new string[ids.Length];
-        for(int i=0;i<ids.Length;i++)
+        try
         {
-            string path= AssetDatabase.GUIDToAssetPath(ids[i]);
-            GameObject getObj = AssetDatabase.LoadAssetAtPath<GameObject>(path);
-            ItemCell[] itemCellList = getObj.transform.GetComponentsInChildren<ItemCell>(true);//杩斿洖杩欎釜鐗╀綋涓嬬殑item瀵瑰舰璞$殑item鑴氭湰鏁扮粍
-            if (itemCellList == null)
+            var ids = new List<string>();
+            ids.AddRange(AssetDatabase.FindAssets("t:Prefab", new string[] { "Assets/ResourcesOut/UI/Window" }));
+            ids.AddRange(AssetDatabase.FindAssets("t:Prefab", new string[] { "Assets/ResourcesOut/UI/PriorityWindow" }));
+            ids.AddRange(AssetDatabase.FindAssets("t:Prefab", new string[] { "Assets/ResourcesOut/UI/Prefab" }));
+
+            var totalCount = ids.Count;
+            for (int i = 0; i < ids.Count; i++)
             {
-                continue;
-            }
-            foreach (var itemCell in itemCellList)
-            {
-                if (itemCell.starlist != null)
+                var path = AssetDatabase.GUIDToAssetPath(ids[i]);
+                EditorUtility.DisplayProgressBar("鏁寸悊ItemCell", string.Format("鏁寸悊锛歿0}", path), i / (float)totalCount);
+                var getObj = AssetDatabase.LoadAssetAtPath<GameObject>(path);
+                var itemCellList = getObj.transform.GetComponentsInChildren<ItemCell>(true);//杩斿洖杩欎釜鐗╀綋涓嬬殑item瀵瑰舰璞$殑item鑴氭湰鏁扮粍
+                if (itemCellList == null)
                 {
-                    DestroyImmediate(itemCell.starlist, true);
-                    EditorUtility.SetDirty(getObj);
+                    continue;
                 }
-            }  
+            }
         }
-        AssetDatabase.SaveAssets();
-        AssetDatabase.Refresh();
-        //GameObject getObj = AssetDatabase.LoadAssetAtPath<GameObject>("Assets/ResourcesOut/UI/Window/test/StarTestObj.prefab");
+        catch (Exception ex)
+        {
+            Debug.Log(ex);
+        }
+        finally
+        {
+            AssetDatabase.SaveAssets();
+            AssetDatabase.Refresh();
+            EditorUtility.ClearProgressBar();
+        }
+
     }
+
 }
diff --git a/Assets/Editor/Tool/FormatPrefabTool.cs b/Assets/Editor/Tool/FormatPrefabTool.cs
index 6ce52b8..588ff63 100644
--- a/Assets/Editor/Tool/FormatPrefabTool.cs
+++ b/Assets/Editor/Tool/FormatPrefabTool.cs
@@ -279,22 +279,6 @@
                                 PasteImage(_item.stateIcon, _source.image);
                             }
                             break;
-                        case ItemCellComType.Star:
-                            if (_item.starlist != null)
-                            {
-                                PasteRectTransform(_item.starlist.transform as RectTransform, _source.transform);
-                                int _index = 0;
-                                foreach (RectTransform _rect in _item.starlist.transform)
-                                {
-                                    if (_index >= _source.stars.Count)
-                                    {
-                                        break;
-                                    }
-                                    PasteImage(_rect.GetComponent<Image>(), _source.stars[_index]);
-                                    _index++;
-                                }
-                            }
-                            break;
                         case ItemCellComType.Lock:
                             if (_item.auctionIcon != null)
                             {

--
Gitblit v1.8.0