Esempio n. 1
0
    public static void SetWhiteList()
    {
        string path = EditorUtility.OpenFolderPanel("选择文件夹", Application.dataPath, "");

        if (path == "")
        {
            Debug.LogWarning("请选择文件夹");
            return;
        }
        string[]      ignoreExtensions = { ".meta", ".spriteatlas" };
        List <string> files            = new List <string>();
        List <string> prefabs          = new List <string>();
        List <string> dependencies     = new List <string>();

        GetAllFiles(path, ref files, ignoreExtensions);
        Debug.Log("文件夹检查完毕,文件数量为:" + files.Count);
        CheckDirectory(Application.dataPath, ref prefabs, ref dependencies);
        Debug.Log("prefab依赖项:" + dependencies.Count);
        Debug.Log("正在筛选废弃资源...");
        PickUpAbandonedAssets(ref files, ref dependencies);
        Debug.Log("筛选完毕,废弃资源数量为:" + files.Count);
        WhiteListWindow w = (WhiteListWindow)EditorWindow.GetWindow(typeof(WhiteListWindow), false, "白名单设置窗口");

        w.SetWhiteList(files);
        w.autoRepaintOnSceneChange = true;
        w.Show();
    }
Esempio n. 2
0
    public static void OpenWhiteList()
    {
        string path = EditorUtility.OpenFilePanel("打开白名单", Application.dataPath, "txt");

        if (path == "")
        {
            Debug.LogWarning("请选择白名单文件");
            return;
        }

        List <string> whiteList = new List <string>();

        using (StreamReader sr = new StreamReader(path))
        {
            string line;
            while ((line = sr.ReadLine()) != null)
            {
                whiteList.Add(line);
            }
        }

        int             width  = 500;
        int             height = 650;
        Rect            rect   = new Rect(0, 0, width, height);
        WhiteListWindow w      = (WhiteListWindow)EditorWindow.GetWindowWithRect(typeof(WhiteListWindow), rect, false, "白名单");

        w.maxSize = w.minSize = new Vector2(width, height);
        w.SetWhiteList(whiteList);
        w.Show();
    }