void LoadAuxillaryDatabases() { // CONDITION database _conditionDatabase = AssetDatabase.LoadAssetAtPath <AuraDatabase>(conditionPath); if (_conditionDatabase.Auras == null) { _conditionDatabase.ReloadDatabase(); } // PERK database _perkDatabase = AssetDatabase.LoadAssetAtPath <PerkDatabase>(perkAssetPath); _perkDatabase.ReloadDatabase(); }
void LoadDatabase() { itemdb = ScriptableObject.CreateInstance <ItemDatabase>(); conddb = ScriptableObject.CreateInstance <AuraDatabase>(); perkdb = ScriptableObject.CreateInstance <PerkDatabase>(); skilldb = ScriptableObject.CreateInstance <SkillDatabase>(); npcdb = ScriptableObject.CreateInstance <NPCDatabase>(); factiondb = ScriptableObject.CreateInstance <FactionDatabase>(); itemdb.ReloadDatabase(); conddb.ReloadDatabase(); perkdb.ReloadDatabase(); skilldb.ReloadDatabase(); npcdb.ReloadDatabase(); factiondb.ReloadDatabase(); }
void OnGUI() { /* * Editor toolbar */ EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Create New Aura", GUILayout.Width(300))) { editorState = EditorState.Create; return; } if (GUILayout.Button("Reload Database", GUILayout.Width(300))) { auraDatabase.ReloadDatabase(); return; } if (GUILayout.Button("Save to JSON", GUILayout.Width(300))) { // Delete this item from the database. auraDatabase.SaveDatabase(); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } EditorGUILayout.EndHorizontal(); if (auraDatabase == null || auraDatabase.Auras == null) { EditorGUILayout.LabelField("The database may need reloading."); return; } EditorGUILayout.BeginHorizontal(); // List all of the items on the left hand side. listScrollPos = EditorGUILayout.BeginScrollView(listScrollPos, false, false, GUILayout.Width(450), GUILayout.MinHeight(550)); foreach (Aura i in auraDatabase.Auras) { // Horizontal group per condition. EditorGUILayout.BeginHorizontal(GUILayout.Width(400.0f)); if (GUILayout.Button("X", GUILayout.Width(50.0f))) { // Delete this item from the database. auraDatabase.RemoveAura(i); EditorUtility.SetDirty(auraDatabase); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = auraDatabase; return; } if (GUILayout.Button("C", GUILayout.Width(50.0f))) { // Duplicate this item. auraDatabase.DuplicateAura(i); EditorUtility.SetDirty(auraDatabase); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = auraDatabase; return; } if (GUILayout.Button(i.AuraName.ToString(), GUILayout.Width(300))) { if (editorState == EditorState.Edit) { SaveExistingAura(); } else if (editorState == EditorState.Create) { SaveNewAura(); } //Get the new item and its associated data. selectedAura = i; GetAuraData(); EditorUtility.FocusProjectWindow(); Selection.activeObject = auraDatabase; editorState = EditorState.Edit; return; } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); if (editorState == EditorState.Create || editorState == EditorState.Edit) { ShowCreateWindow(); } EditorGUILayout.EndHorizontal(); }
void LoadAuxillaryDatabases() { // CONDITION database _auraDatabase = AssetDatabase.LoadAssetAtPath <AuraDatabase>(auraPath); _auraDatabase.ReloadDatabase(); }
void LoadAuxillaryDatabases() { // CONDITION database _conditionDatabase = AssetDatabase.LoadAssetAtPath <AuraDatabase>(conditionPath); _conditionDatabase.ReloadDatabase(); }
void OnGUI() { /* * Editor toolbar. */ // Button row. EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Create New Item", GUILayout.Width(300.0f))) { // Create a new item... editorState = EditorState.Create; return; } if (GUILayout.Button("Reload Database", GUILayout.Width(300.0f))) { itemDatabase.ReloadDatabase(); _conditionDatabase.ReloadDatabase(); _perkDatabase.ReloadDatabase(); return; } if (GUILayout.Button("Save to JSON", GUILayout.Width(300))) { // Delete this item from the database. itemDatabase.SaveDatabase(); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } EditorGUILayout.EndHorizontal(); // Filter row. EditorGUILayout.BeginHorizontal(); filterType = (ItemType)EditorGUILayout.EnumPopup("Show Type: ", filterType); filterTypeToggle = EditorGUILayout.Toggle(filterTypeToggle); EditorGUILayout.EndHorizontal(); // Kill the script before a null pointer exception is thrown (ugh why). if (itemDatabase == null || itemDatabase.Items == null) { EditorGUILayout.LabelField("The database may need reloading."); return; } EditorGUILayout.BeginHorizontal(); // List all of the items on the left hand side. listScrollPos = EditorGUILayout.BeginScrollView(listScrollPos, false, false, GUILayout.Width(450), GUILayout.MinHeight(550)); foreach (GameItem i in itemDatabase.Items) { // Filter if necessary. if (filterTypeToggle) { if (i.ItemType != filterType) { continue; } } // Horizontal group per item. EditorGUILayout.BeginHorizontal(GUILayout.Width(400)); if (GUILayout.Button("X", GUILayout.Width(50.0f))) { // Delete this item from the database. itemDatabase.RemoveItem(i); EditorUtility.SetDirty(itemDatabase); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = itemDatabase; return; } if (GUILayout.Button("C", GUILayout.Width(50.0f))) { // Duplicate this item. itemDatabase.DuplicateItem(i); EditorUtility.SetDirty(itemDatabase); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = itemDatabase; return; } if (GUILayout.Button(i.ItemName.ToString(), GUILayout.Width(300))) { if (editorState == EditorState.Edit) { SaveExistingItem(selectedItem.ItemType); } else if (editorState == EditorState.Create) { SaveNewItem(itemType); } //Get the new item and its associated data. selectedItem = i; GetItemData(); EditorUtility.FocusProjectWindow(); Selection.activeObject = itemDatabase; editorState = EditorState.Edit; return; } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); if (editorState == EditorState.Create || editorState == EditorState.Edit) { ShowCreateWindow(); } EditorGUILayout.EndHorizontal(); }