private void SavedDataGUI() { List <string> keys = PlayerPrefs.GetString("StatSystemSavedKeys").Split(';').ToList(); keys.RemoveAll(x => string.IsNullOrEmpty(x)); if (EditorTools.Foldout("StatSystemSavedData", new GUIContent("Saved Data " + keys.Count))) { EditorTools.BeginIndent(1, true); if (keys.Count == 0) { GUILayout.Label("No data saved on this device!"); } for (int i = 0; i < keys.Count; i++) { string key = keys[i]; GenericMenu keyMenu = new GenericMenu(); keyMenu.AddItem(new GUIContent("Delete Key"), false, () => { List <string> allKeys = new List <string>(keys); allKeys.Remove(key); PlayerPrefs.SetString("StatSystemSavedKeys", string.Join(";", allKeys)); PlayerPrefs.DeleteKey(key + ".Stats"); }); if (EditorTools.Foldout(key, new GUIContent(key), keyMenu)) { EditorTools.BeginIndent(1, true); string data = PlayerPrefs.GetString(key + ".Stats"); GUILayout.Label(data, EditorStyles.wordWrappedLabel); EditorTools.EndIndent(); } } EditorTools.EndIndent(); } }
public override void OnInspectorGUI() { EditorGUI.BeginDisabledGroup(true); EditorGUILayout.PropertyField(this.m_Script); EditorGUI.EndDisabledGroup(); serializedObject.Update(); EditorGUILayout.PropertyField(this.m_AutoSave); this.m_ShowSave.target = this.m_AutoSave.boolValue; if (EditorGUILayout.BeginFadeGroup(this.m_ShowSave.faded)) { EditorGUI.indentLevel = EditorGUI.indentLevel + 1; EditorGUILayout.PropertyField(this.m_SavingKey); EditorGUILayout.PropertyField(this.m_Provider); EditorGUI.indentLevel = EditorGUI.indentLevel - 1; } EditorGUILayout.EndFadeGroup(); GUILayout.Space(2f); EditorTools.Seperator(); List <string> keys = PlayerPrefs.GetString("QuestSystemSavedKeys").Split(';').ToList(); keys.RemoveAll(x => string.IsNullOrEmpty(x)); if (EditorTools.Foldout("QuestSavedData", new GUIContent("Saved Data " + keys.Count))) { EditorTools.BeginIndent(1, true); if (keys.Count == 0) { GUILayout.Label("No data saved on this device!"); } for (int i = 0; i < keys.Count; i++) { string key = keys[i]; GenericMenu keyMenu = new GenericMenu(); keyMenu.AddItem(new GUIContent("Delete Key"), false, () => { List <string> allKeys = new List <string>(keys); allKeys.Remove(key); PlayerPrefs.SetString("QuestSystemSavedKeys", string.Join(";", allKeys)); PlayerPrefs.DeleteKey(key + ".ActiveQuests"); PlayerPrefs.DeleteKey(key + ".CompletedQuests"); PlayerPrefs.DeleteKey(key + ".FailedQuests"); }); if (EditorTools.Foldout(key, new GUIContent(key), keyMenu)) { EditorTools.BeginIndent(1, true); string activeQuests = PlayerPrefs.GetString(key + ".ActiveQuests"); string completedQuests = PlayerPrefs.GetString(key + ".CompletedQuests"); string failedQuests = PlayerPrefs.GetString(key + ".FailedQuests"); if (!string.IsNullOrEmpty(activeQuests)) { GenericMenu uiMenu = new GenericMenu(); uiMenu.AddItem(new GUIContent("Delete Active Quests"), false, () => { PlayerPrefs.DeleteKey(key + ".ActiveQuests"); }); if (EditorTools.Foldout(key + ".ActiveQuests", new GUIContent("Active Quests"), uiMenu)) { EditorTools.BeginIndent(1, true); GUILayout.Label(activeQuests, EditorStyles.wordWrappedLabel); EditorTools.EndIndent(); } } if (!string.IsNullOrEmpty(completedQuests)) { GenericMenu uiMenu = new GenericMenu(); uiMenu.AddItem(new GUIContent("Delete Completed Quests"), false, () => { PlayerPrefs.DeleteKey(key + ".CompletedQuests"); }); if (EditorTools.Foldout(key + ".CompletedQuests", new GUIContent("Completed Quests"), uiMenu)) { EditorTools.BeginIndent(1, true); GUILayout.Label(completedQuests, EditorStyles.wordWrappedLabel); EditorTools.EndIndent(); } } if (!string.IsNullOrEmpty(failedQuests)) { GenericMenu uiMenu = new GenericMenu(); uiMenu.AddItem(new GUIContent("Delete Failed Quests"), false, () => { PlayerPrefs.DeleteKey(key + ".FailedQuests"); }); if (EditorTools.Foldout(key + ".FailedQuests", new GUIContent("Failed Quests"), uiMenu)) { EditorTools.BeginIndent(1, true); GUILayout.Label(failedQuests, EditorStyles.wordWrappedLabel); EditorTools.EndIndent(); } } EditorTools.EndIndent(); } } EditorTools.EndIndent(); } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { EditorGUI.BeginDisabledGroup(true); EditorGUILayout.PropertyField(this.m_Script); EditorGUI.EndDisabledGroup(); serializedObject.Update(); EditorGUILayout.PropertyField(this.m_AutoSave); this.m_ShowSave.target = this.m_AutoSave.boolValue; if (EditorGUILayout.BeginFadeGroup(this.m_ShowSave.faded)) { EditorGUI.indentLevel = EditorGUI.indentLevel + 1; EditorGUILayout.PropertyField(this.m_SavingKey); EditorGUILayout.PropertyField(this.m_SavingRate); EditorGUILayout.PropertyField(m_Provider); this.m_ShowMySQL.target = m_Provider.enumValueIndex == 1; if (EditorGUILayout.BeginFadeGroup(this.m_ShowMySQL.faded)) { EditorGUILayout.PropertyField(this.m_ServerAdress); EditorGUILayout.PropertyField(this.m_SaveScript); EditorGUILayout.PropertyField(this.m_LoadScript); } EditorGUILayout.EndFadeGroup(); EditorGUI.indentLevel = EditorGUI.indentLevel - 1; } EditorGUILayout.EndFadeGroup(); GUILayout.Space(2f); EditorTools.Seperator(); List <string> keys = PlayerPrefs.GetString("InventorySystemSavedKeys").Split(';').ToList(); keys.RemoveAll(x => string.IsNullOrEmpty(x)); if (EditorTools.Foldout("InventorySavedData", new GUIContent("Saved Data " + keys.Count))) { EditorTools.BeginIndent(1, true); if (keys.Count == 0) { GUILayout.Label("No data saved on this device!"); } for (int i = 0; i < keys.Count; i++) { string key = keys[i]; List <string> scenes = PlayerPrefs.GetString(key + ".Scenes").Split(';').ToList(); scenes.RemoveAll(x => string.IsNullOrEmpty(x)); string uiData = PlayerPrefs.GetString(key + ".UI"); if (scenes.Count == 0 && string.IsNullOrEmpty(uiData)) { List <string> allKeys = new List <string>(keys); allKeys.Remove(key); PlayerPrefs.SetString("InventorySystemSavedKeys", string.Join(";", allKeys)); } GenericMenu keyMenu = new GenericMenu(); keyMenu.AddItem(new GUIContent("Delete Key"), false, () => { List <string> allKeys = new List <string>(keys); allKeys.Remove(key); PlayerPrefs.SetString("InventorySystemSavedKeys", string.Join(";", allKeys)); PlayerPrefs.DeleteKey(key + ".UI"); PlayerPrefs.DeleteKey(key + ".Scenes"); for (int j = 0; j < scenes.Count; j++) { PlayerPrefs.DeleteKey(key + "." + scenes[j]); } }); if (EditorTools.Foldout(key, new GUIContent(key), keyMenu)) { EditorTools.BeginIndent(1, true); if (!string.IsNullOrEmpty(uiData)) { GenericMenu uiMenu = new GenericMenu(); uiMenu.AddItem(new GUIContent("Delete UI"), false, () => { PlayerPrefs.DeleteKey(key + ".UI"); }); if (EditorTools.Foldout(key + ".UI", new GUIContent("UI"), uiMenu)) { EditorTools.BeginIndent(1, true); GUILayout.Label(uiData, EditorStyles.wordWrappedLabel); EditorTools.EndIndent(); } } for (int j = 0; j < scenes.Count; j++) { string scene = scenes[j]; GenericMenu sceneMenu = new GenericMenu(); sceneMenu.AddItem(new GUIContent("Delete " + scene), false, () => { PlayerPrefs.DeleteKey(key + "." + scene); List <string> allScenes = new List <string>(scenes); allScenes.Remove(scene); scenes.RemoveAll(x => string.IsNullOrEmpty(x)); PlayerPrefs.SetString(key + ".Scenes", string.Join(";", allScenes)); }); if (EditorTools.Foldout(key + "." + scene, new GUIContent(scene), sceneMenu)) { EditorTools.BeginIndent(1, true); GUILayout.Label(PlayerPrefs.GetString(key + "." + scene), EditorStyles.wordWrappedLabel); EditorTools.EndIndent(); } } EditorTools.EndIndent(); } } EditorTools.EndIndent(); } serializedObject.ApplyModifiedProperties(); }