| New file |
| | |
| | | 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; |
| | | } |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | } |