/// <summary> Resets the database to the default values </summary> public bool ResetDatabase() { #if UNITY_EDITOR if (!DoozyUtils.DisplayDialog(UILabels.ResetDatabase, UILabels.AreYouSureYouWantToResetDatabase + "\n\n" + UILabels.OperationCannotBeUndone, UILabels.Yes, UILabels.No)) { return(false); } for (int i = Categories.Count - 1; i >= 0; i--) { ListOfNames category = Categories[i]; Categories.Remove(category); DoozyUtils.MoveAssetToTrash(AssetDatabase.GetAssetPath(category)); } UpdateListOfCategoryNames(); AddDefaultCategories(true); DDebug.Log(UILabels.DatabaseHasBeenReset); #endif return(true); }
/// <summary> Reset the database to the default values </summary> public bool ResetDatabase() { #if UNITY_EDITOR if (!DoozyUtils.DisplayDialog(UILabels.ResetDatabase, UILabels.AreYouSureYouWantToResetDatabase + "\n\n" + UILabels.OperationCannotBeUndone, UILabels.Yes, UILabels.No)) { return(false); } for (int i = Themes.Count - 1; i >= 0; i--) { ThemeData themeData = Themes[i]; Themes.Remove(themeData); DataUtils.PlayerPrefsDeleteKey(themeData.Id.ToString()); DoozyUtils.MoveAssetToTrash(AssetDatabase.GetAssetPath(themeData)); } Initialize(); DDebug.Log(UILabels.DatabaseHasBeenReset); #endif return(true); }
private bool DrawGeneralPluginBox(string pluginName, bool hasPlugin, bool usePlugin, string pluginDefineSymbol, GUIStyle pluginIcon) { bool value = usePlugin; GUILayout.BeginVertical(DGUI.Background.Style(CornerType.Round), GUILayout.Height(PLUGIN_BOX_HEIGHT)); { GUILayout.Space(PLUGIN_BOX_PADDING); GUI.enabled = !EditorApplication.isCompiling; { GUILayout.BeginHorizontal(); { GUILayout.Space(PLUGIN_BOX_PADDING); DGUI.Icon.Draw(pluginIcon, PLUGIN_BOX_ICON_SIZE, Color.white); GUILayout.Space(PLUGIN_BOX_PADDING); GUILayout.BeginVertical(); { DGUI.Label.Draw(pluginName, Size.XL, DGUI.Colors.DisabledTextColorName); GUILayout.Space(2); GUI.enabled = !EditorApplication.isCompiling && hasPlugin; DGUI.Label.Draw(EditorApplication.isCompiling ? UILabels.Compiling + "..." : hasPlugin ? UILabels.Installed : UILabels.NotInstalled, Size.M, DGUI.Colors.DisabledTextColorName); } GUILayout.EndVertical(); GUILayout.FlexibleSpace(); if (DGUI.Button.Draw(usePlugin ? UILabels.Enabled : UILabels.Disabled, Size.M, usePlugin ? ColorName.Green : DGUI.Colors.DarkOrLightColorName, usePlugin ? ColorName.Green : DGUI.Colors.LightOrDarkColorName, usePlugin, PLUGIN_BOX_ICON_SIZE, 80)) { if (DoozyUtils.DisplayDialog((usePlugin ? UILabels.Disable : UILabels.Enable) + " " + pluginName, UILabels.ScriptingDefineSymbol + ": " + pluginDefineSymbol + "\n\n" + (usePlugin ? UILabels.RemoveSymbolFromAllBuildTargetGroups : UILabels.AddSymbolToAllBuildTargetGroups), UILabels.Yes, UILabels.No)) { DoozySettings.Instance.UndoRecord(usePlugin ? UILabels.DisablePlugin : UILabels.EnablePlugin); DoozySettings.Instance.SetDirty(false); m_needsSave = true; s_needsToUpdateScriptingDefineSymbols = true; value = !value; } } GUILayout.Space(PLUGIN_BOX_PADDING); } GUILayout.EndHorizontal(); } GUI.enabled = true; } GUILayout.EndVertical(); return(value); }
private void DrawViewThemesTopMenu() { BeginDrawViewTopMenuArea(); { GUILayout.Space((m_viewTopMenuHeight - BarHeight) / 2 - m_viewTopMenuHeight * (1 - CurrentViewExpanded.faded)); GUILayout.BeginHorizontal(); { DrawDefaultViewHorizontalSpacing(); { GUILayout.Space((m_viewTopMenuHeight - BarHeight) / 3); //New Database GUI.enabled = !NewDatabase.target && !EditMode.target; { if (ButtonNew(NewDatabase.target, UILabels.NewTheme)) { NewDatabase.target = !NewDatabase.target; if (NewDatabase.target) { DoozyUtils.SaveAssets(); m_newDatabaseName = string.Empty; } } } GUI.enabled = true; DrawDefaultViewHorizontalSpacing(); if (NewDatabase.target) { GUILayout.Space(DGUI.Properties.Space()); GUILayout.BeginVertical(); { GUILayout.Space(DGUI.Properties.Space(2)); GUILayout.BeginHorizontal(GUILayout.Height(DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(2))); { GUI.color = DGUI.Colors.GetDColor(ColorName.Green).Normal.WithAlpha(GUI.color.a); DGUI.Properties.SetNextControlName("m_newDatabaseName"); m_newDatabaseName = EditorGUILayout.TextField(GUIContent.none, m_newDatabaseName, GUILayout.Width(NewCategoryNameTextFieldWidth)); DGUI.Properties.FocusTextInControl("m_newDatabaseName"); GUI.color = InitialGUIColor; if (DGUI.KeyMapper.DetectKeyUp(Event.current, KeyCode.Return) || DGUI.KeyMapper.DetectKeyUp(Event.current, KeyCode.KeypadEnter) || DGUI.Button.IconButton.Ok()) //OK - New Database { DGUI.Properties.ResetKeyboardFocus(); NewDatabase.target = false; if (ThemesDatabase.CreateTheme(m_newDatabaseName, true, true)) { CurrentThemeId = ThemesDatabase.GetThemeData(m_newDatabaseName).Id; ThemesDatabase.Sort(false); ThemesDatabase.UpdateThemesNames(true); } } if (DGUI.Button.IconButton.Cancel()) //CANCEL - New Database { DGUI.Properties.ResetKeyboardFocus(); NewDatabase.target = false; } GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); } else { bool enabled = GUI.enabled; GUI.enabled = !EditMode.target; { if (ButtonSortDatabase()) { ThemesDatabase.Sort(true, true); //Sort Database } DrawDefaultViewHorizontalSpacing(); if (ButtonRefreshDatabase()) { ThemesDatabase.RefreshDatabase(false, true); //Refresh Database } DrawDefaultViewHorizontalSpacing(); if (ButtonSaveDatabase()) { ThemesDatabase.SetDirty(true); //Save Database } DrawDefaultViewHorizontalSpacing(); if (ButtonSearchFor(UILabels.SearchForThemes)) { ThemesDatabase.SearchForUnregisteredThemes(true); //Search for themes } GUILayout.FlexibleSpace(); DrawDefaultViewHorizontalSpacing(); if (ButtonAutoSave(ThemesSettings.Instance.AutoSave)) { if (DoozyUtils.DisplayDialog(UILabels.AutoSave, (!ThemesSettings.Instance.AutoSave ? UILabels.ThemesEnableAutoSave : UILabels.ThemesDisableAutoSave), UILabels.Ok, UILabels.Cancel)) { ThemesSettings.Instance.UndoRecord(UILabels.SetValue); ThemesSettings.Instance.AutoSave = !ThemesSettings.Instance.AutoSave; ThemesSettings.Instance.SetDirty(true); DoozyUtils.DisplayDialog(ThemesSettings.Instance.AutoSave ? UILabels.AutoSaveEnabled : UILabels.AutoSaveDisabled, ThemesSettings.Instance.AutoSave ? UILabels.ThemesAutoSaveEnabled : UILabels.ThemesAutoSaveDisabled, UILabels.Ok); } } DrawDefaultViewHorizontalSpacing(); if (ButtonResetDatabase()) { ThemesDatabase.ResetDatabase(); //Reset Database } } GUI.enabled = enabled; DrawDefaultViewHorizontalSpacing(); if (ButtonEditMode(EditMode.target)) { EditMode.target = !EditMode.target; //Edit Mode } } } GUILayout.Space((m_viewTopMenuHeight - BarHeight) / 3); } GUILayout.EndHorizontal(); } EndDrawViewTopMenuArea(); }