private static GUIStyle GetButtonStyle(NotificationWindow styleName, QTexture qTexture) { return(new GUIStyle() { name = styleName.ToString(), normal = { background = qTexture.normal2D }, onNormal = { background = qTexture.normal2D }, hover = { background = qTexture.hover2D }, onHover = { background = qTexture.hover2D }, active = { background = qTexture.active2D }, onActive = { background = qTexture.active2D } }); }
private static GUIStyle GetBlackTextStyle(NotificationWindow styleName, TextAnchor alignment, FontStyle fontStyle, int fontSize, Font font = null) { GUIStyle style = new GUIStyle(GUI.skin.label); style.name = styleName.ToString(); style.normal.textColor = QuickEngine.Extensions.ColorExtensions.ColorFrom256(29, 24, 25); style.alignment = alignment; style.fontStyle = fontStyle; style.fontSize = fontSize; style.font = font; style.wordWrap = true; style.richText = true; return(style); }
void DrawButtons() { QUI.BeginHorizontal(position.width); { QUI.FlexibleSpace(); QUI.BeginVertical(240); { if (QUI.Button(DUIStyles.GetStyle(DUIStyles.UpgradeManager.ButtonUpgradeScene), 240, 40)) { NotificationWindow.YesNo("Upgrade Current Scene", "Are you sure you want to upgrade the current scene?" + "\n\n" + "This process will override all the values of DoozyUI components by getting the old version values and converting them to the new version values.", UpgradeScene, null); } QUI.Space(SPACE_8); if (QUI.Button(DUIStyles.GetStyle(DUIStyles.UpgradeManager.ButtonCleanFiles), 240, 40)) { NotificationWindow.OkCancel("Clean Files", "This process will delete all the files that are no longer needed by the system. These files were used by the old core and are no longer needed by the new one.", CleanFiles, null); } QUI.Space(SPACE_8); if (QUI.Button(DUIStyles.GetStyle(DUIStyles.UpgradeManager.ButtonDeleteExamples), 240, 40)) { NotificationWindow.OkCancel("Delete Old Examples", "Are you sure you want to delete the old examples folder?" + "\n\n" + "If you are referencing anything from it, in your current project, it is recommended that you keep it." + "\n\n" + "The old examples folder is Assets/DoozyUI/_EXAMPLES", DeleteExamples, null); } } QUI.EndVertical(); QUI.FlexibleSpace(); } QUI.EndHorizontal(); }
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 }
public static GUIStyle GetStyle(NotificationWindow styleName) { return(Skin.GetStyle(styleName.ToString())); }
static void Init() { Instance = GetWindow <NotificationWindow>(_utility, _title, _focus); }
/// <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(); }