예제 #1
0
    // 根据类型获得检查器
    public static BaseChecker GetChecker(CheckerType type)
    {
        BaseChecker checker;

        if (!checkerDic.TryGetValue(type, out checker))
        {
            // UI相关
            if (CheckerType.UIAtlas == type)
            {
                checker = new UIAtlasChecker();
            }
            if (CheckerType.UITexture == type)
            {
                checker = new UITextureChecker();
            }
        }

        return(checker);
    }
예제 #2
0
    void OnGUI()
    {
        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();
        {
            EditorGUILayout.LabelField("Prefab路径", GUILayout.Width(100));

            prefabPath = EditorGUILayout.TextField(prefabPath, GUILayout.Width(500));

            if (GUILayout.Button(iconTexture, GUILayout.Width(60), GUILayout.Height(20)))
            {
                prefabPath = EditorUtility.OpenFolderPanel("选择UIPrefab目录", "Assets/App/Pro/GameRes", "UIPrefabs");
                Repaint();
            }
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();
        {
            EditorGUILayout.LabelField("UI Module路径", GUILayout.Width(100));

            UIModulePath = EditorGUILayout.TextField(UIModulePath, GUILayout.Width(500));

            if (GUILayout.Button(iconTexture, GUILayout.Width(60), GUILayout.Height(20)))
            {
                UIModulePath = EditorUtility.OpenFolderPanel("选择UIImage目录", "Assets/App/Pro/GameRes/UI", "Module");
                Repaint();
            }
        }
        EditorGUILayout.EndHorizontal();



        EditorGUILayout.Space();

        if (GUILayout.Button("查看common纹理使用", GUILayout.Width(200), GUILayout.Height(50)))
        {
            if (string.IsNullOrEmpty(UIModulePath) || string.IsNullOrEmpty(prefabPath))
            {
                EditorUtility.DisplayDialog("Error", "路径为空", "确定");
                return;
            }

            UITextureChecker.CheckCommonFiles();
        }

        EditorGUILayout.Space();

        if (GUILayout.Button("查找未使用纹理", GUILayout.Width(200), GUILayout.Height(50)))
        {
            if (string.IsNullOrEmpty(UIModulePath) || string.IsNullOrEmpty(prefabPath))
            {
                EditorUtility.DisplayDialog("Error", "路径为空", "确定");
                return;
            }
            UITextureChecker.CheckUnusedTexture(UIModulePath, prefabPath);
        }

        EditorGUILayout.Space();

        if (GUILayout.Button("查找重复使用纹理", GUILayout.Width(200), GUILayout.Height(50)))
        {
            if (string.IsNullOrEmpty(UIModulePath) || string.IsNullOrEmpty(prefabPath))
            {
                EditorUtility.DisplayDialog("Error", "路径为空", "确定");
                return;
            }
            UITextureChecker.CheckRepeatUsedTexture(UIModulePath, prefabPath);
        }
    }