private void OnEnable()
            {
                unityPluginConfig       = DirectoryUtil.CreateScriptableObject <UnityPluginConfig>("preset/plugins-script", false);
                unityPluginConfigEditor = Editor.CreateEditor(unityPluginConfig) as UnityPluginConfigEditor;

                projectScriptExportConfig       = DirectoryUtil.CreateScriptableObject <ProjectExportConfig>("preset/project-script", false);
                projectScriptExportConfigEditor = Editor.CreateEditor(projectScriptExportConfig) as ProjectExportConfigEditor;

                // scenes
                hierarchyExportConfig       = DirectoryUtil.CreateScriptableObject <HierarchyExportConfig>("quickexport/hierarchy", false);
                hierarchyExportConfigEditor = Editor.CreateEditor(hierarchyExportConfig) as HierarchyExportConfigEditor;
                sceneExportConfig           = DirectoryUtil.CreateScriptableObject <ExportSceneList>("quickexport/scenes", false);
                sceneExportEditor           = Editor.CreateEditor(sceneExportConfig) as ExportSceneListEditor;

                directoryExportConfig = DirectoryUtil.CreateScriptableObject <ExportDirectoryList>("quickexport/directories", false);
                directoryExportEditor = Editor.CreateEditor(directoryExportConfig) as ExportDirectoryListEditor;

                globalConfig       = DirectoryUtil.CreateScriptableObject <GlobalConfig>("bridge/entry/GlobalConfig", false);
                globalConfigEditor = Editor.CreateEditor(globalConfig) as GlobalConfigEditor;

                rawResourceExportConfig       = DirectoryUtil.CreateScriptableObject <RawResourceExportConfig>("quickexport/rawres", false);
                rawResourceExportConfigEditor = Editor.CreateEditor(rawResourceExportConfig) as RawResourceExportConfigEditor;

                BeefBall.DoInstallationCheck();

                ConfigManager.Init();
            }
Ejemplo n.º 2
0
        public void SearchAndSaveAllResourcesDirectories()
        {
            var rootPath = Application.dataPath;

            string[] blackList =
            {
                "unity-export",
                "Editor",
                "editor",
                "WeChat"
            };

            var dirs = Directory.EnumerateDirectories(rootPath, "*esources", SearchOption.AllDirectories)
                       .Where(d =>
            {
                foreach (var b in blackList)
                {
                    if (d.IndexOf(b) >= 0)
                    {
                        return(false);
                    }
                }
                return(true);
            })
                       .Where(d => d.IndexOf("Resources") >= 0 || d.IndexOf("resources") >= 0)
                       .Select(d =>
            {
                return(d.PathToAssets());
            });

            ExportDirectoryList exportDirectoryList = target as ExportDirectoryList;

            if (exportDirectoryList.exportDirectories == null)
            {
                exportDirectoryList.exportDirectories = new List <ExportDirectoryList.ExportDirectoryItem>();
            }
            else
            {
                exportDirectoryList.exportDirectories.Clear();
            }
            foreach (string path in dirs)
            {
                exportDirectoryList.exportDirectories.Add(new ExportDirectoryList.ExportDirectoryItem(path));
            }
            //Debug.Log(serializedObject.FindProperty("exportDirectories") as List<ExportDirectoryItem>);
            //List<string> list = ;

            // create new ResourcesDirectory ScriptableObject

            //var i = ConfigManager.configEntry.resourcesDirectoryConfig.exportDirectories.Count + 1;
            //foreach (var dir in dirs.Except(existed))
            //{
            //    var so = ScriptableObject.CreateInstance(typeof(ExportDirectoryItem)) as ExportDirectoryItem;
            //    so.directory = AssetDatabase.LoadAssetAtPath(dir, typeof(UnityEngine.Object));

            //    var dstPath = Path.Combine(ConfigManager.resourcesPath.PathToAssets(), "WX_RES_DIRECTORY_" + i + ".asset");
            //    AssetDatabase.CreateAsset(so, dstPath);
            //    i++;
            //}
            //AssetDatabase.SaveAssets();
            //AssetDatabase.Refresh();
        }