少年修仙传客户端基础资源
client_Wu Xijin
2019-03-14 2e25bdf7cccacb5da4fe42bad9edd1cdea5b70c3
3335 更新界面工具.
2个文件已修改
66 ■■■■ 已修改文件
Assets/Editor/Tool/DeleteStar.cs 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/Tool/FormatPrefabTool.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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();
        }
    }
}
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)
                            {