private void Load_Generation() { try { string rootPath = Util.GetRootPath(this); if (!string.IsNullOrEmpty(rootPath)) { string path; switch (CurrentEditorMode) { case EditorMode.MapGenerator: path = Util.CombinePaths(rootPath, "Data", "Current Map Generation Preset.json"); if (Util.FileExists(path)) { MGConfig.LoadFromJson(Util.Read(path)); MGConfig.FixGenerationValues(); } break; case EditorMode.CharacterGenerator: path = Util.CombinePaths(rootPath, "Data", "Current Character Generation Preset.json"); if (Util.FileExists(path)) { CGConfig.LoadFromJson(Util.Read(path)); CGConfig.FixGenerationValues(); ReloadCharacterAttachmentThumbnailMap(true); } break; } } } catch { }; ShowAllAttachment.Load(); }
private void ImportPreset_Dialog() { try { string path = EditorUtility.OpenFilePanel("Import Generation Preset", "Assets", "json"); if (!string.IsNullOrEmpty(path)) { var json = Util.Read(path); if (!string.IsNullOrEmpty(json)) { switch (CurrentEditorMode) { case EditorMode.MapGenerator: MGConfig.LoadFromJson(json); break; case EditorMode.CharacterGenerator: CGConfig.LoadFromJson(json); ReloadCharacterAttachmentThumbnailMap(true); SetDataDirty(); break; } Save_Generation(); Focus(); } } } catch (System.Exception ex) { Debug.LogError(ex.Message); } }