static void LoadSymbol() { #if EZ_SOURCE return; #endif QUtils.AddScriptingDefineSymbol(EZT.SYMBOL_EZ_DEFINE_SYMBOLS); }
static void LoadSymbol() { #if EZ_SOURCE return; #endif QUtils.AddScriptingDefineSymbol(EZT.SYMBOL_EZ_DATA_MANAGER); }
public static void StopSoundPreview(string soundName) { #if dUI_MasterAudio DTGUIHelper.StopPreview(soundName); #else QUtils.StopAllClips(); #endif }
/// <summary> /// Saves a new preset as an asset file in the DefineSymbolsPresets folder. The new preset's filename will be the preset name. /// </summary> void SavePreset(List <string> presetValues, string presetName) { presetValues = QUtils.CleanList(presetValues); DefineSymbols.DefineSymbolsPreset asset = Q.CreateAsset <DefineSymbols.DefineSymbolsPreset>(EZT.RELATIVE_PATH_DEFINE_SYMBOLS_PRESETS, presetName); asset.presetValues = new List <string>(presetValues); QUI.SetDirty(asset); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); RefreshPresetNames(); LoadPreset(presetName); }
void DrawDefineSymbolsBuildTargetGroup(float width) { QUI.BeginVertical(width); { QUI.GhostTitle("BUILD TARGET GROUP", QColors.Color.Blue, width); QUI.Space(SPACE_4); QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); if (QUI.GhostButton("Copy to Symbols Preset >>>", QColors.Color.Blue, width - SPACE_8, 24)) { presetSymbols.Clear(); presetSymbols.AddRange(symbols); } QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.Space(SPACE_4); QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); QUI.SetGUIBackgroundColor(EditorGUIUtility.isProSkin ? QColors.Blue.Color : QColors.BlueLight.Color); selectedBuildTargetGroup = (BuildTargetGroup)EditorGUILayout.EnumPopup(selectedBuildTargetGroup, GUILayout.Width(width - SPACE_8 - (106 * selectedBuildTargetGroupIsTheActivePlatform.faded))); QUI.ResetColors(); if (selectedBuildTargetGroupIsTheActivePlatform.faded > 0.05f) { QUI.Label("is the Active Platform", Style.Text.Small, 106 * selectedBuildTargetGroupIsTheActivePlatform.faded); } QUI.FlexibleSpace(); } QUI.EndHorizontal(); if (selectedBuildTargetGroup != previouslySelectedBuildTargetGroup) { symbols = QUtils.GetScriptingDefineSymbolsForGroup(selectedBuildTargetGroup); previouslySelectedBuildTargetGroup = selectedBuildTargetGroup; Repaint(); } QUI.Space(SPACE_8 + SPACE_16); QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); DrawActiveSymbolsList(width - 26); QUI.FlexibleSpace(); } QUI.EndHorizontal(); } QUI.EndVertical(); }
void InitPageGeneral() { buttonStylePlayMaker = GetSupportedAssetButtonStyle(DUI.PlayMakerEnabled ? DUIResources.buttonPlayMakerEnabled : DUIResources.buttonPlayMakerDisabled); buttonStyleMasterAudio = GetSupportedAssetButtonStyle(DUI.MasterAudioEnabled ? DUIResources.buttonMasterAudioEnabled : DUIResources.buttonMasterAudioDisabled); buttonStyleEnergyBarToolkit = GetSupportedAssetButtonStyle(DUI.EnergyBarToolkitEnabled ? DUIResources.buttonEnergyBarToolkitEnabled : DUIResources.buttonEnergyBarToolkitDisabled); buttonStyleTextMeshPro = GetSupportedAssetButtonStyle(DUI.TextMeshProEnabled ? DUIResources.buttonTextMeshProEnabled : DUIResources.buttonTextMeshProDisabled); buttonStyleUINavigation = GetSupportedAssetButtonStyle(DUI.UINavigationEnabled ? DUIResources.buttonUINavigationEnabled : DUIResources.buttonUINavigationDisabled); buttonStyleOrientationManager = GetSupportedAssetButtonStyle(DUI.OrientationManagerEnabled ? DUIResources.buttonOrientationManagerEnabled : DUIResources.buttonOrientationManagerDisabled); buttonStyleSceneLoader = GetSupportedAssetButtonStyle(DUI.SceneLoaderEnabled ? DUIResources.buttonSceneLoaderEnabled : DUIResources.buttonSceneLoaderDisabled); showAddNews = new AnimBool(false, Repaint); showDefineSymbols = new AnimBool(false, Repaint); symbols = QUtils.GetScriptingDefineSymbolsForGroup(QUtils.GetActiveBuildTargetGroup()); }
void DrawControlPanelDefineSymbols(float width) { QUI.DrawCollapsableStringList("View/Edit: '" + QUtils.GetActiveBuildTargetGroup() + "' Scripting Define Symbols", showDefineSymbols, QColors.Color.Gray, symbols, this, width, MiniBarHeight); QUI.BeginHorizontal(width); { QUI.Space((width - 120 - 2 - 160) * showDefineSymbols.faded); if (showDefineSymbols.faded > 0.8f) { if (QUI.GhostButton("Refresh Symbols List", QColors.Color.Gray, 120 * showDefineSymbols.faded)) { symbols = QUtils.GetScriptingDefineSymbolsForGroup(QUtils.GetActiveBuildTargetGroup()); } QUI.Space(SPACE_2); if (QUI.GhostButton("Save Changes to Symbols List", QColors.Color.Gray, 160 * showDefineSymbols.faded)) { QUtils.SetScriptingDefineSymbolsForGroup(QUtils.GetActiveBuildTargetGroup(), symbols); showDefineSymbols.target = false; } } } QUI.EndHorizontal(); }
public static bool PreviewSound(string soundName) { if (string.IsNullOrEmpty(soundName.Trim()) || soundName.Equals(DUI.DEFAULT_SOUND_NAME)) { return(false); } #if dUI_MasterAudio DTGUIHelper.PreviewSoundGroup(soundName); return(true); #else if (DUI.UISoundsDatabase == null) { DUI.RefreshUISoundsDatabase(); } if (!DUI.UISoundNameExists(soundName)) { return(false); } AudioClip audioClip = DUI.GetUISound(soundName).audioClip; if (audioClip != null) //there is an AudioClip reference -> play it { QUtils.PlayAudioClip(audioClip); return(true); } audioClip = Resources.Load(DUI.GetUISound(soundName).soundName) as AudioClip; if (audioClip != null) //a sound file with the soundName was found in Resources -> play it { QUtils.PlayAudioClip(audioClip); return(true); } return(false); #endif }
void DrawControlPanelSpportFor3RdPartyAssets(float width) { QUI.DrawTexture(DUIResources.pageControlPanelSeparatorSupport.texture, 242, 16); QUI.Space(2); #region Playmaker if (EditorApplication.isCompiling) { QUI.DrawTexture(DUIResources.pageControlPanelButtonMaskEditorIsCompiling.texture, 242, 40); } else if (EditorApplication.isPlayingOrWillChangePlaymode) { QUI.DrawTexture(DUIResources.pageControlPanelButtonMaskEditorInPlayMode.texture, 242, 40); } else { QUI.BeginHorizontal(width); { #if dUI_PlayMaker if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageControlPanelButtonPlaymakerEnabled), 200, 40)) { NotificationWindow.YesNo("Disable support for PlayMaker?", "This will remove '" + DUI.SYMBOL_PLAYMAKER + "' from Scripting Define Symbols in Player Settings.", () => { QUtils.RemoveScriptingDefineSymbol(DUI.SYMBOL_PLAYMAKER); }, null); } #else if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageControlPanelButtonPlaymakerDisabled), 200, 40)) { NotificationWindow.YesNo("Enable support for PlayMaker?", "Enable this only if you have PlayMaker already installed." + "\n\n" + "This will add '" + DUI.SYMBOL_PLAYMAKER + "' to Scripting Define Symbols in Player Settings.", () => { QUtils.AddScriptingDefineSymbol(DUI.SYMBOL_PLAYMAKER); }, null); } #endif QUI.Space(2); if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageControlPanelButtonExternalLink), 40, 40)) { Application.OpenURL("https://www.assetstore.unity3d.com/en/#!/content/368"); } } QUI.EndHorizontal(); #endregion } QUI.Space(2); #region Master Audio if (EditorApplication.isCompiling) { QUI.DrawTexture(DUIResources.pageControlPanelButtonMaskEditorIsCompiling.texture, 242, 40); } else if (EditorApplication.isPlayingOrWillChangePlaymode) { QUI.DrawTexture(DUIResources.pageControlPanelButtonMaskEditorInPlayMode.texture, 242, 40); } else { QUI.BeginHorizontal(width); { #if dUI_MasterAudio if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageControlPanelButtonMasterAudioEnabled), 200, 40)) { NotificationWindow.YesNo("Disable support for Master Audio?", "This will remove '" + DUI.SYMBOL_MASTER_AUDIO + "' from Scripting Define Symbols in Player Settings.", () => { QUtils.RemoveScriptingDefineSymbol(DUI.SYMBOL_MASTER_AUDIO); }, null); } #else if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageControlPanelButtonMasterAudioDisabled), 200, 40)) { NotificationWindow.YesNo("Enable support for Master Audio?", "Enable this only if you have Master Audio already installed." + "\n\n" + "This will add '" + DUI.SYMBOL_MASTER_AUDIO + "' to Scripting Define Symbols in Player Settings.", () => { QUtils.AddScriptingDefineSymbol(DUI.SYMBOL_MASTER_AUDIO); }, null); } #endif QUI.Space(2); if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageControlPanelButtonExternalLink), 40, 40)) { Application.OpenURL("https://www.assetstore.unity3d.com/en/#!/content/5607"); } } QUI.EndHorizontal(); } #endregion QUI.Space(2); #region Energy Bar Toolkit if (EditorApplication.isCompiling) { QUI.DrawTexture(DUIResources.pageControlPanelButtonMaskEditorIsCompiling.texture, 242, 40); } else if (EditorApplication.isPlayingOrWillChangePlaymode) { QUI.DrawTexture(DUIResources.pageControlPanelButtonMaskEditorInPlayMode.texture, 242, 40); } else { QUI.BeginHorizontal(width); { #if dUI_EnergyBarToolkit if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageControlPanelButtonEnergyBarToolkitEnabled), 200, 40)) { NotificationWindow.YesNo("Disable support for Energy Bar Toolkit?", "This will remove '" + DUI.SYMBOL_ENERGY_BAR_TOOLKIT + "' from Scripting Define Symbols in Player Settings.", () => { QUtils.RemoveScriptingDefineSymbol(DUI.SYMBOL_ENERGY_BAR_TOOLKIT); }, null); } #else if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageControlPanelButtonEnergyBarToolkitDisabled), 200, 40)) { NotificationWindow.YesNo("Enable support for Energy Bar Toolkit?", "Enable this only if you have Energy Bar Toolkit already installed." + "\n\n" + "This will add '" + DUI.SYMBOL_ENERGY_BAR_TOOLKIT + "' to Scripting Define Symbols in Player Settings.", () => { QUtils.AddScriptingDefineSymbol(DUI.SYMBOL_ENERGY_BAR_TOOLKIT); }, null); } #endif QUI.Space(2); if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageControlPanelButtonExternalLink), 40, 40)) { Application.OpenURL("https://www.assetstore.unity3d.com/en/#!/content/7515"); } } QUI.EndHorizontal(); } #endregion }
void DrawControlPanelDoozyModules(float width) { QUI.DrawTexture(DUIResources.pageControlPanelSeparatorDoozyModules.texture, 242, 16); QUI.Space(2); #region Orientation Manager if (EditorApplication.isCompiling) { QUI.DrawTexture(DUIResources.pageControlPanelButtonMaskEditorIsCompiling.texture, 242, 40); } else if (EditorApplication.isPlayingOrWillChangePlaymode) { QUI.DrawTexture(DUIResources.pageControlPanelButtonMaskEditorInPlayMode.texture, 242, 40); } else { QUI.BeginHorizontal(width); { #if dUI_UseOrientationManager if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageControlPanelButtonOrientationManagerEnabled), 242, 40)) { NotificationWindow.YesNo("Disable the Orientation Manager?", "This will remove '" + DUI.SYMBOL_ORIENTATION_MANAGER + "' from Scripting Define Symbols in Player Settings.", () => { QUtils.RemoveScriptingDefineSymbol(DUI.SYMBOL_ORIENTATION_MANAGER); }, null); } #else if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageControlPanelButtonOrientationManagerDisabled), 242, 40)) { NotificationWindow.YesNo("Enable the Orientation Manager?", "Enable this only if you want to create different UI's for each orientation." + "\n\n" + "This will add '" + DUI.SYMBOL_ORIENTATION_MANAGER + "' to Scripting Define Symbols in Player Settings.", () => { QUtils.AddScriptingDefineSymbol(DUI.SYMBOL_ORIENTATION_MANAGER); }, null); } #endif } QUI.EndHorizontal(); } #endregion QUI.Space(2); #region Navigation System if (EditorApplication.isCompiling) { QUI.DrawTexture(DUIResources.pageControlPanelButtonMaskEditorIsCompiling.texture, 242, 40); } else if (EditorApplication.isPlayingOrWillChangePlaymode) { QUI.DrawTexture(DUIResources.pageControlPanelButtonMaskEditorInPlayMode.texture, 242, 40); } else { QUI.BeginHorizontal(width); { #if dUI_NavigationDisabled if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageControlPanelButtonNavigationSystemDisabled), 242, 40)) { NotificationWindow.YesNo("Enable the Navigation Manager?", "This will remove '" + DUI.SYMBOL_NAVIGATION_SYSTEM + "' from Scripting Define Symbols in Player Settings.", () => { QUtils.RemoveScriptingDefineSymbol(DUI.SYMBOL_NAVIGATION_SYSTEM); }, null); } #else if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageControlPanelButtonNavigationSystemEnabled), 242, 40)) { NotificationWindow.YesNo("Disable the Navigation Manager?", "Do this if you intend to handle the navigation yourself (maybe by using Playmaker?)." + "\n\n" + "This will add '" + DUI.SYMBOL_NAVIGATION_SYSTEM + "' to Scripting Define Symbols in Player Settings.", () => { QUtils.AddScriptingDefineSymbol(DUI.SYMBOL_NAVIGATION_SYSTEM); }, null); } #endif } QUI.EndHorizontal(); } #endregion }
/// <summary> /// Draws a special button used to enable/disable asset/module options by using scripting define symbols and custom made button styles. /// </summary> /// <param name="buttonTarget">Supported asset name (like 'PlayMaker') or the module name (like 'UINavigation').</param> /// <param name="buttonStyle">Custom button style that will be used to draw the button.</param> /// <param name="isEnabled">Bool that determines if the supplied symbol (the define symbol string) has been added to Player Settings or not.</param> /// <param name="symbol">The symbol that gets added/remoded to/from Scripting Define Symbols.</param> /// <param name="width">The width of the button.</param> /// <param name="inverseSymbol">This is a special bool that is used by the 'UINavigation', for example, as it needs to add a scripting define symbol to remove module options. /// It is used mostly by DoozyUI modules that are enabled by default and they can be disabled by adding a symbol to Player Settings and vice vresa.</param> void DrawControlPanelGeneralButton(string buttonTarget, GUIStyle buttonStyle, bool isEnabled, string symbol, float width, bool inverseSymbol = false) { QUI.BeginVertical(width); { if (EditorApplication.isCompiling) { QUI.DrawTexture(DUIResources.buttonEditorIsCompiling.texture, width, 48); } else if (EditorApplication.isPlayingOrWillChangePlaymode) { QUI.DrawTexture(DUIResources.buttonEditorInPlayMode.texture, width, 48); } else { if (QUI.Button(buttonStyle, width, 48)) { string title, message; if (isEnabled) { title = "Disable " + buttonTarget + " options?"; message = "This will " + (inverseSymbol ? "add" : "remove") + " '" + symbol + "' " + (inverseSymbol ? "to" : "from") + " " + "Scripting Define Symbols in Player Settings."; } else { title = "Enable " + buttonTarget + " options ?"; message = "This will " + (inverseSymbol ? "remove" : "add") + " '" + symbol + "' " + (inverseSymbol ? "from" : "to") + " " + "Scripting Define Symbols in Player Settings."; message += inverseSymbol ? "" : "\n\nEnable this only if you have " + buttonTarget + " already installed."; } NotificationWindow.YesNo(title, message, () => { if (isEnabled) { if (inverseSymbol) { QUtils.AddScriptingDefineSymbol(symbol); } else { QUtils.RemoveScriptingDefineSymbol(symbol); } } else { if (inverseSymbol) { QUtils.RemoveScriptingDefineSymbol(symbol); } else { QUtils.AddScriptingDefineSymbol(symbol); } } }, null); } } } QUI.EndVertical(); }
static void LoadSymbol() { QUtils.AddScriptingDefineSymbol(UIDrawer.SYMBOL); }
static void LoadSymbol() { QUtils.AddScriptingDefineSymbol(DUI.SYMBOL_DOOZYUI); }
void DrawDefineSymbols() { DrawPageHeader("DEFINE SYMBOLS", QColors.Green, "Preprocessor Directives Manager", QUI.IsProSkin ? QColors.UnityLight : QColors.UnityMild, EZResources.IconDefineSymbols); QUI.Space(SPACE_16); if (EditorApplication.isCompiling) { QUI.GhostTitle("Editor is compiling...", QColors.Color.Gray); return; } selectedBuildTargetGroupIsTheActivePlatform.target = selectedBuildTargetGroup == QUtils.GetActiveBuildTargetGroup(); QUI.BeginHorizontal(WindowSettings.CurrentPageContentWidth); { DrawDefineSymbolsBuildTargetGroup(WindowSettings.CurrentPageContentWidth / 2); DrawDefineSymbolsSymbolsPreset(WindowSettings.CurrentPageContentWidth / 2); } QUI.EndHorizontal(); }
void InitDefineSymbols() { defineSymbolsNewPreset = new AnimBool(false, Repaint); selectedBuildTargetGroup = QUtils.GetActiveBuildTargetGroup(); previouslySelectedBuildTargetGroup = selectedBuildTargetGroup; selectedBuildTargetGroupIsTheActivePlatform = new AnimBool(selectedBuildTargetGroup == QUtils.GetActiveBuildTargetGroup(), Repaint); if (symbols == null) { symbols = new List <string>(); } else { symbols.Clear(); } symbols = QUtils.GetScriptingDefineSymbolsForGroup(selectedBuildTargetGroup); if (presetSymbols == null) { presetSymbols = new List <string>(); } else { presetSymbols.Clear(); } presetSymbols.AddRange(symbols); presetSymbolsReordableList = new ReorderableList(presetSymbols, typeof(string), true, false, false, false) { showDefaultBackground = false, drawElementBackgroundCallback = (rect, index, active, focused) => { } }; presetSymbolsReordableList.drawElementCallback = (rect, index, active, focused) => { if (index == presetSymbolsReordableList.list.Count) { return; } float width = WindowSettings.CurrentPageContentWidth / 2; int dragBumbWidth = 0; int buttonWidth = 16; int textFieldWidth = (int)width - 20 - buttonWidth - 2 - buttonWidth; rect.x += dragBumbWidth; QUI.SetGUIBackgroundColor(EditorGUIUtility.isProSkin ? QColors.Green.Color : QColors.GreenLight.Color); presetSymbolsReordableList.list[index] = EditorGUI.TextField(new Rect(rect.x, rect.y, textFieldWidth, EditorGUIUtility.singleLineHeight), (string)presetSymbolsReordableList.list[index]); QUI.ResetColors(); rect.x += textFieldWidth; rect.x += 2; rect.y -= 1; if (QUI.ButtonMinus(rect)) { if (index == 0 && presetSymbolsReordableList.list.Count == 1) //is this the last list entry? { presetSymbolsReordableList.list[index] = ""; //yes --> add an empty entry } else { presetSymbolsReordableList.list.Remove(presetSymbolsReordableList.list[index]); //no --> remove the entry } } rect.x += buttonWidth; rect.x += 2; if (QUI.ButtonPlus(rect)) { presetSymbolsReordableList.list.Insert(index, ""); //add a new empty entry } }; selectedPresetName = DEFAULT_PRESET_NAME; loadedPresetName = selectedPresetName; RefreshPresetNames(); }
void DrawDefineSymbolsSymbolsPreset(float width) { QUI.BeginVertical(width); { QUI.GhostTitle("SYMBOLS PRESET", QColors.Color.Green, width); QUI.Space(SPACE_4); QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); if (QUI.GhostButton("<<< Copy to Build Target Group", QColors.Color.Green, width - SPACE_8, 24)) { List <string> tempList = presetSymbols; tempList = QUtils.CleanList(tempList); presetSymbols.Clear(); presetSymbols.AddRange(tempList); symbols.Clear(); symbols.AddRange(presetSymbols); QUtils.SetScriptingDefineSymbolsForGroup(selectedBuildTargetGroup, symbols); if (presetSymbols.Count == 0) { presetSymbols.Add(""); } } QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.Space(SPACE_4); if (defineSymbolsNewPreset.value) //NEW PRESET { QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); QUI.Label("Enter a new preset name...", Style.Text.Small, width - SPACE_8); } QUI.EndHorizontal(); QUI.Space(-SPACE_4); QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); GUI.SetNextControlName("newPresetName"); newPresetName = QUI.TextField(newPresetName, EditorGUIUtility.isProSkin ? QColors.Green.Color : QColors.GreenLight.Color, (width - SPACE_8 - 16 - 2 - 16) * defineSymbolsNewPreset.faded); //if the user hits Enter while either the key or value fields were being edited bool keyboardReturnPressed = Event.current.isKey && Event.current.keyCode == KeyCode.Return && Event.current.type == EventType.KeyUp && (GUI.GetNameOfFocusedControl() == "newPresetName"); QUI.Space(-2); if (QUI.ButtonOk() || keyboardReturnPressed) { newPresetName = newPresetName.Trim(); if (newPresetName.Equals(DEFAULT_PRESET_NAME)) { QUI.DisplayDialog("Enter a new preset name", "You are trying to save a preset with the defaut preset name '" + DEFAULT_PRESET_NAME + "'. Please enter another preset name.", "Ok"); } else if (string.IsNullOrEmpty(newPresetName)) { QUI.DisplayDialog("Enter a new preset name", "You are trying to save a preset with no name. Please enter a name.", "Ok"); } else if (Q.GetResource <DefineSymbols.DefineSymbolsPreset>(EZT.RESOURCES_PATH_DEFINE_SYMBOLS_PRESETS, newPresetName) != null) { if (QUI.DisplayDialog("Overwrite preset?", "There is a preset with the same name '" + newPresetName + "' in the presets list. Are you sure you want to overwrite it?", "Overwrite", "Cancel")) { AssetDatabase.MoveAssetToTrash(EZT.RELATIVE_PATH_DEFINE_SYMBOLS_PRESETS + newPresetName + ".asset"); SavePreset(presetSymbols, newPresetName); selectedPresetName = newPresetName; RefreshPresetNames(); defineSymbolsNewPreset.target = false; newPresetName = ""; } } else { SavePreset(presetSymbols, newPresetName); selectedPresetName = newPresetName; RefreshPresetNames(); defineSymbolsNewPreset.target = false; newPresetName = ""; } } QUI.Space(2); //if the user hits Escape while either the key or value fields were being edited bool keyboardEscapePressed = Event.current.isKey && Event.current.keyCode == KeyCode.Escape && Event.current.type == EventType.KeyUp && (GUI.GetNameOfFocusedControl() == "newPresetName"); if (QUI.ButtonCancel() || keyboardEscapePressed) { defineSymbolsNewPreset.target = false; newPresetName = ""; } QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.Space(5); } else //NORMAL VIEW { QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); QUI.BeginChangeCheck(); QUI.SetGUIBackgroundColor(EditorGUIUtility.isProSkin ? QColors.Green.Color : QColors.GreenLight.Color); selectedPresetIndex = EditorGUILayout.Popup(selectedPresetIndex, presets, GUILayout.Width(width - SPACE_8)); QUI.ResetColors(); if (QUI.EndChangeCheck()) { Undo.RecordObject(this, "Select Preset"); selectedPresetName = presets[selectedPresetIndex]; } QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.Space(SPACE_2); if (loadedPresetName.Equals(selectedPresetName) || selectedPresetName.Equals(DEFAULT_PRESET_NAME)) { QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); if (selectedPresetName.Equals(DEFAULT_PRESET_NAME)) { if (QUI.GhostButton("Create a New Preset with current symbols", QColors.Color.Green, width - SPACE_8)) { defineSymbolsNewPreset.target = true; newPresetName = ""; } } else { if (QUI.GhostButton("NEW", QColors.Color.Green, ((width - SPACE_8) / 4) - SPACE_2)) { defineSymbolsNewPreset.target = true; newPresetName = ""; } QUI.Space(SPACE_2); if (QUI.GhostButton("RELOAD", QColors.Color.Green, ((width - SPACE_8) / 4) - SPACE_2)) { LoadPreset(selectedPresetName); } QUI.Space(SPACE_2); if (QUI.GhostButton("SAVE", QColors.Color.Green, ((width - SPACE_8) / 4) - SPACE_2)) { SavePreset(presetSymbols, selectedPresetName); } QUI.Space(SPACE_2); if (QUI.GhostButton("DELETE", QColors.Color.Red, ((width - SPACE_8) / 4) - SPACE_2)) { if (QUI.DisplayDialog("Delete preset?", "Are you sure you want to delete the '" + selectedPresetName + "' preset?", "Yes", "No")) { DeletePreset(selectedPresetName); } } } QUI.FlexibleSpace(); } QUI.EndHorizontal(); } else { QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); if (QUI.GhostButton("Load Preset", QColors.Color.Green, width - SPACE_8)) { LoadPreset(selectedPresetName); } QUI.FlexibleSpace(); } QUI.EndHorizontal(); } } QUI.Space(-SPACE_8 - SPACE_4); DrawSelectedPresetsList(width); } QUI.EndVertical(); }