Ejemplo n.º 1
0
        private void Save_Generation()
        {
            try {
                string rootPath = Util.GetRootPath(this);
                if (!string.IsNullOrEmpty(rootPath))
                {
                    string json    = "";
                    string keyWord = "";
                    switch (CurrentEditorMode)
                    {
                    case EditorMode.MapGenerator:
                        json    = MGConfig.ToJson();
                        keyWord = "Map";
                        break;

                    case EditorMode.CharacterGenerator:
                        json    = CGConfig.ToJson();
                        keyWord = "Character";
                        break;
                    }
                    if (!string.IsNullOrEmpty(json))
                    {
                        Util.Write(json, Util.CombinePaths(rootPath, "Data", "Current " + keyWord + " Generation Preset.json"));
                    }
                }
            } catch { };
            ShowAllAttachment.TrySave();
        }
Ejemplo n.º 2
0
        private void ExportPreset_Dialog()
        {
            try {
                var json = "";
                switch (CurrentEditorMode)
                {
                case EditorMode.MapGenerator:
                    json = MGConfig.ToJson();
                    break;

                case EditorMode.CharacterGenerator:
                    json = CGConfig.ToJson();
                    break;
                }
                if (!string.IsNullOrEmpty(json))
                {
                    string path = EditorUtility.SaveFilePanelInProject("Export Generation Preset", "Generation Preset", "json", "");
                    if (!string.IsNullOrEmpty(path))
                    {
                        Util.Write(json, path);
                        AssetDatabase.SaveAssets();
                        AssetDatabase.Refresh();
                    }
                }
            } catch (System.Exception ex) {
                Debug.LogError(ex.Message);
            }
        }