三国卡牌客户端基础资源仓库
hch
2025-10-22 89542dfe1fac0ab7c7e865da0e5805ba2db0e760
0312 查看哪些界面勾选了mainui
2个文件已添加
71 ■■■■■ 已修改文件
Assets/Editor/Tool/CheckMainUI.cs 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/Tool/CheckMainUI.cs.meta 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/Tool/CheckMainUI.cs
New file
@@ -0,0 +1,60 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
using UnityEngine.UI;
public class CheckMainUI : EditorWindow {
    [MenuItem("程序/找出所有MainUI")]
    public static void Open()
    {
        FindMainUI();
    }
    public static void FindMainUI()
    {
        string topFilePath = Application.dataPath + "/ResourcesOut/UI";
        string[] filepaths1 = Directory.GetFiles(topFilePath, "*.prefab", SearchOption.AllDirectories);
        topFilePath = Application.dataPath + "/ResourcesOut/BuiltIn";
        string[] filepaths2 = Directory.GetFiles(topFilePath, "*.prefab", SearchOption.AllDirectories);
        string[] filepaths = new string[filepaths1.Length + filepaths2.Length];
        filepaths1.CopyTo(filepaths, 0);
        filepaths2.CopyTo(filepaths, filepaths1.Length);
        Debug.LogFormat("总数:{0}", filepaths.Length);
        int startIndex = 0; //文件执行个数
        EditorApplication.update = delegate ()
        {
            string file = filepaths[startIndex];
            file = file.Substring(file.IndexOf("Assets"));
            bool isCancel = EditorUtility.DisplayCancelableProgressBar("MainUI-" + filepaths.Length, file, (float)startIndex / (float)filepaths.Length);
            GameObject _prefab = AssetDatabase.LoadAssetAtPath<GameObject>(file);
            UIBase uibase = _prefab.GetComponent<UIBase>();
            if (uibase != null && uibase.isMainUI)
            {
                Debug.LogFormat("{0} 是MainUI", file);
            }
            startIndex++;
            if (isCancel || startIndex >= filepaths.Length)
            {
                EditorUtility.ClearProgressBar();
                EditorApplication.update = null;
                startIndex = 0;
            }
        };
    }
}
Assets/Editor/Tool/CheckMainUI.cs.meta
New file
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2d9971bed7ebb234e834eb660ae60fc4
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant: