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/DeleteStar.cs | 50 ++++++++++++++++++++++++++++++--------------------
1 files changed, 30 insertions(+), 20 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();
+ }
+
}
+
}
--
Gitblit v1.8.0