示例#1
0
        private void DrawSettings()
        {
            Cache.FolderTree.TreeName = EditorGUILayout.TextField(new GUIContent("Tree Name"), Cache.FolderTree.TreeName);
            GUILayout.Space(6);

            if (GUILayout.Button(new GUIContent("Create Folder Tree", "Create a Folder Tree")))
            {
                Cache.LoadFolderTree("");

                _initialized = false;
            }

            if (GUILayout.Button(new GUIContent("Load Folder Tree", "Loads the Folder Tree from a Save File in the Assets Folder")))
            {
                string path = EditorUtility.OpenFilePanel("Load Folder Tree", FolderManager.SavesFolderPath(), "asset");
                if (!path.Contains(DirectoryUtility.GetAppDataPath()))
                {
                    if (!string.IsNullOrEmpty(path))
                    {
                        ShowNotification(new GUIContent("You should select an asset inside your project folder!"));
                    }
                }
                else
                {
                    Cache.LoadFolderTree(path);
                    _initialized = false;
                }
            }

            if (GUILayout.Button(new GUIContent("Save Folder Tree", "Saves the Folder Tree in the Assets Folder")))
            {
                string path = EditorUtility.SaveFilePanelInProject("Save Folder Tree", Cache.FolderTree.TreeName, "asset", "", FolderManager.SavesFolderPath());
                if (!string.IsNullOrEmpty(path))
                {
                    Cache.SaveFolderTree(path);
                }
                _initialized = false;
            }

            if (GUILayout.Button(new GUIContent("Generate Folder Tree", "Generates the Folder Tree")))
            {
                if (!FolderManager.Generate(Cache.FolderTree))
                {
                    ShowNotification(new GUIContent("To generate a tree, you must first add folders to it!"));
                }
                else
                {
                    ShowNotification(new GUIContent("Successfully generated a folder tree! Go check it out in the project folder!"));
                }
            }
        }