三国卡牌客户端基础资源仓库
yyl
2025-10-22 f92b7b00ca5e97b222bce8c22f6c526c1aeb9a3f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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;
            }
        };
    }
 
    
  
}