void DrawUpdateSortingLayerButton(float width) { if (QUI.GhostButton("Update Sorting", QColors.Color.Gray, width, BUTTON_HEIGHT)) { if (!uiCanvas.Canvas.isRootCanvas) { EditorUtility.DisplayDialog("UICanvas Issue", "The UICanvas, on the " + uiCanvas.name + " gameObject, is not attached to a root canvas. This component should be attached to a top canvas in the Hierarchy.", "Ok"); return; } if (EditorUtility.DisplayDialog("Update Sorting", "You are about to change the Sorting Layer Name of all the Canvases and Renderers, under this gameObject, to '" + uiCanvas.Canvas.sortingLayerName + "'." + "\n" + "\n" + "'" + uiCanvas.Canvas.sortingLayerName + "' is the Sorting Layer set to the Canvas component attached to this gameObject. (root canvas)" + "\n" + "\n" + "Are you sure you want to do that?" + "\n" + "(operation cannot be undone)", "Ok", "Cancel")) { UIManager.UpdateCanvasSortingLayerName(uiCanvas.gameObject, uiCanvas.Canvas.sortingLayerName); UIManager.UpdateRendererSortingLayerName(uiCanvas.gameObject, uiCanvas.Canvas.sortingLayerName); } } QUI.Space(SPACE_4); }
void DrawOrientation(float width) { QStyles.GetStyle(QStyles.GetStyleName(Style.GhostButton.Purple)).alignment = TextAnchor.MiddleRight; if (QUI.GhostButton("update orientation", QColors.Color.Purple, width, 32, 10)) { UpdateOrientationInEditMode(); } QStyles.GetStyle(QStyles.GetStyleName(Style.GhostButton.Purple)).alignment = TextAnchor.MiddleCenter; QUI.Space(-32); switch (orientationManager.CurrentOrientation) { case OrientationManager.Orientation.Landscape: QUI.DrawTexture(DUIResources.miniIconOrientationLandscape.texture, 160, 32); break; case OrientationManager.Orientation.Portrait: QUI.DrawTexture(DUIResources.miniIconOrientationPortrait.texture, 160, 32); break; case OrientationManager.Orientation.Unknown: QUI.DrawTexture(DUIResources.miniIconOrientationUnknown.texture, 160, 32); break; } QUI.Space(SPACE_2); QUI.SetGUIBackgroundColor(QUI.AccentColorPurple); QUI.PropertyField(onOrientationChange, true, new GUIContent("OnOrientationChange"), width); QUI.ResetColors(); }
void DrawRenameGameObjectButton(float width) { QUI.BeginHorizontal(width); { if (QUI.GhostButton("Rename GameObject", QColors.Color.Gray, width, 18)) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Rename"); for (int i = 0; i < targets.Length; i++) { UIEffect iTarget = (UIEffect)targets[i]; iTarget.gameObject.name = iTarget.targetUIElement != null ? (DUI.DUISettings.UIEffect_Inspector_RenameGameObjectPrefix + iTarget.targetUIElement.elementName + DUI.DUISettings.UIEffect_Inspector_RenameGameObjectSuffix) : "UIEffect DISABLED"; } } else { RenameGameObject(); } } } QUI.EndHorizontal(); }
private void OnGUI() { UpdateWindowSize(); float width = position.width; QLabel.text = "Pre-release Check"; QLabel.style = Style.Text.Normal; QUI.Label(QLabel); QUI.Space(SPACE_2); DrawDeleteFile(DUI.RELATIVE_PATH_CONTROL_PANEL_WINDOW_SETTINGS, "ControlPanelWindowSettings", width, ".asset"); QUI.Space(SPACE_4); DrawConvertDUIDataToSourceFiles(DUI.RELATIVE_PATH_DUIDATA, "DUIData", ".asset", width); QUI.Space(SPACE_4); DrawDeleteFile(DUI.RELATIVE_PATH_SETTINGS, "DUISettings", width, ".asset"); QUI.Space(SPACE_4); DrawPerformDatabaseUpgrade(width); QUI.Space(SPACE_16); if (QUI.GhostButton("Export UIDrawer", QColors.Color.Blue, 200, 20, false)) { PackageExporter.PackageExporter.ExportAsset_UIDrawer(); } }
void DrawPlayModeSettings(float width) { showPlayModeSettings.target = EditorApplication.isPlayingOrWillChangePlaymode; if (QUI.BeginFadeGroup(showPlayModeSettings.faded)) { QUI.BeginVertical(width); { QUI.Space(SPACE_4 * showPlayModeSettings.faded); QUI.BeginHorizontal(width); { if (QUI.GhostButton("OPEN", QColors.Color.Blue, (width - SPACE_2) / 2, BarHeight)) { Drawer.Open(); } if (QUI.GhostButton("CLOSE", QColors.Color.Blue, (width - SPACE_2) / 2, BarHeight)) { Drawer.Close(); } } QUI.EndHorizontal(); QUI.Space(SPACE_16 * showPlayModeSettings.faded); } QUI.EndVertical(); } QUI.EndFadeGroup(); }
void DrawDatabaseButtons(float width) { if (QUI.GhostButton("UIButtons Database", QColors.Color.Gray, width, 18)) { ControlPanelWindow.OpenWindow(ControlPanelWindow.Page.UIButtons); } }
void DrawRemoveComponentButton(float width) { if (QUI.GhostButton("Remove Component", QColors.Color.Red, width, BUTTON_HEIGHT)) { DestroyImmediate(uiCanvas); QUI.ExitGUI(); } }
bool DrawAnimatorPresetsTabButton(AnimatorPreset preset) { if (QUI.GhostButton(preset.ToString(), WindowSettings.selectedAnimatorPresetTab == preset ? QColors.Color.Blue : QColors.Color.Gray, ANIMATOR_PRESETS_TAB_BUTTON_WIDTH, ANIMATOR_PRESETS_TAB_BUTTON_HEIGHT, WindowSettings.selectedAnimatorPresetTab == preset)) { WindowSettings.selectedAnimatorPresetTab = preset; QUI.SetDirty(DUIData.Instance); AssetDatabase.SaveAssets(); return(true); } return(false); }
void DrawDatabaseButtons(float width) { QUI.BeginHorizontal(width); { if (QUI.GhostButton("UICanvases Database", QColors.Color.Gray, width, 18)) { ControlPanelWindow.OpenWindow(ControlPanelWindow.Page.UICanvases); } } QUI.EndHorizontal(); }
void DrawOrientationManagerButton(float width) { if (!UIManager.useOrientationManager) { return; } if (QUI.GhostButton("Add Orientation Manager to Scene", QColors.Color.Gray, width, 18)) { OrientationManager.AddOrientationManagerToScene(); } }
bool DrawUISoundsFilterButton(string buttonText, SoundType soundType) { if (QUI.GhostButton(buttonText, WindowSettings.selectedUISoundsFilter == soundType ? QColors.Color.Blue : QColors.Color.Gray, 120, 20, 10, WindowSettings.selectedUISoundsFilter == soundType)) { WindowSettings.selectedUISoundsFilter = soundType; QUI.SetDirty(WindowSettings); AssetDatabase.SaveAssets(); return(true); } return(false); }
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 DrawFixFolderButton(string folderName, string relativePath, float width) { QUI.BeginHorizontal(width); { QLabel.text = "Find"; QLabel.style = Style.Text.Button; if (QUI.GhostButton(QLabel.text, QColors.Color.Gray, QLabel.x + 16, 18)) { // Load object UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(relativePath.Substring(0, relativePath.Length - 1), typeof(UnityEngine.Object)); // Select the object in the project folder Selection.activeObject = obj; // Also flash the folder yellow to highlight it EditorGUIUtility.PingObject(obj); } QUI.Space(SPACE_2); QLabel.text = "Fix Folder: " + folderName; QLabel.style = Style.Text.Button; if (QUI.GhostButton(QLabel.text, QColors.Color.Gray, QLabel.x + 24, 18)) { DeleteAllFilesUnderTargetPath(relativePath); } if (CheckThatFolderExists(relativePath)) { } else if (CheckThatFolderIsEmpty(relativePath)) { } else { QUI.Space(SPACE_4); QUI.BeginVertical(16, 16); { QUI.Space(2); QUI.DrawTexture(QResources.iconOk.texture, 14, 14); } QUI.EndVertical(); } QUI.FlexibleSpace(); } QUI.EndHorizontal(); }
void DrawDeleteFile(string relativePath, string fileName, float width, string fileExtension = ".cs") { QUI.BeginHorizontal(width); { QLabel.text = "Find"; QLabel.style = Style.Text.Button; if (QUI.GhostButton(QLabel.text, QColors.Color.Gray, QLabel.x + 16, 18)) { // Load object UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(relativePath + fileName + fileExtension, typeof(UnityEngine.Object)); // Select the object in the project folder Selection.activeObject = obj; // Also flash the folder yellow to highlight it EditorGUIUtility.PingObject(obj); } QUI.Space(SPACE_2); QLabel.text = "Delete: " + fileName; QLabel.style = Style.Text.Button; if (QUI.GhostButton(QLabel.text, QColors.Color.Gray, QLabel.x + 24, 18)) { AssetDatabase.DeleteAsset(relativePath + fileName + fileExtension); } if (CheckThatFileExists(relativePath, fileName, fileExtension)) { } else { QUI.Space(SPACE_4); QUI.BeginVertical(16, 16); { QUI.Space(2); QUI.DrawTexture(QResources.iconOk.texture, 14, 14); } QUI.EndVertical(); } QUI.FlexibleSpace(); } QUI.EndHorizontal(); }
void DrawExpandCollapseButtons(float width, TargetDatabase targetDatabase) { QUI.BeginHorizontal(width); { if (QUI.GhostButton("Expand", QColors.Color.Gray, 80) || DetectKeyCombo_Alt_E()) // Alt + E: expand all categories) { ExpandOrCollapseAllDatabaseCategories(targetDatabase, true); } QUI.FlexibleSpace(); if (QUI.GhostButton("Collapse", QColors.Color.Gray, 80) || DetectKeyCombo_Alt_C()) // Alt + C: collapse all categories) { ExpandOrCollapseAllDatabaseCategories(targetDatabase, false); } } QUI.EndHorizontal(); }
void DrawTopButtons(float width) { QUI.BeginHorizontal(width); { if (QUI.GhostButton("Control Panel", QColors.Color.Gray, (width - SPACE_4) / 3, 18)) { ControlPanelWindow.OpenWindow(ControlPanelWindow.Page.General); } if (QUI.GhostButton("Editor Settings", QColors.Color.Gray, (width - SPACE_4) / 3, 18)) { ControlPanelWindow.OpenWindow(ControlPanelWindow.Page.EditorSettings); } if (QUI.GhostButton("Help", QColors.Color.Gray, (width - SPACE_4) / 3, 18)) { ControlPanelWindow.OpenWindow(ControlPanelWindow.Page.Help); } } QUI.EndHorizontal(); }
void DrawAddParticleSystemButton(float width) { if (uiEffect.targetParticleSystem != null) { return; } QUI.BeginHorizontal(width); { if (QUI.GhostButton("Add a ParticleSystem to this gameObject", QColors.Color.Gray, width, 18)) { targetParticleSystem.objectReferenceValue = uiEffect.GetComponent <ParticleSystem>() == null?uiEffect.gameObject.AddComponent <ParticleSystem>() : uiEffect.GetComponent <ParticleSystem>(); serializedObject.ApplyModifiedProperties(); uiEffect.targetParticleSystem.GetComponent <ParticleSystemRenderer>().material = AssetDatabase.GetBuiltinExtraResource <Material>("Default-Particle.mat"); } } QUI.EndHorizontal(); }
void DrawContainer(float width) { QUI.QObjectPropertyField("Container", container, width, 20, true); QUI.BeginHorizontal(width); { QLabel.text = "When Closed"; QLabel.style = Style.Text.Small; QUI.LabelWithBackground(QLabel); QUI.Space(SPACE_4); QUI.QToggle("Fade Out", fadeOutContainerWhenClosed); QUI.Space(SPACE_4); QUI.QToggle("Disable", disableContainerWhenClosed); QUI.Space(SPACE_4); QUI.QToggle("Dont Disable Canvas", dontDisableContainerCanvasWhenClosed); QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.BeginHorizontal(width); { QUI.QObjectPropertyField("Container Size", containerSize, width - 160 - 2, 20, false); QUI.Space(SPACE_2); if (QUI.GhostButton("Update Container", QColors.Color.Gray, 160, 20, false)) { UpdateContainer(); } } QUI.EndHorizontal(); QUI.BeginHorizontal(width); { if ((UIDrawer.ContainerSize)containerSize.enumValueIndex == UIDrawer.ContainerSize.PercentageOfScreen) { QUI.QObjectPropertyField("Percentage (0 - 1)", containerPercentageOfScreenSize, (width - 4) * 0.2f, 20, false); QUI.Space(SPACE_2); QUI.QObjectPropertyField("Min Size", containerMinimumSize, (width - 2) * 0.6f, 20, false); } else if ((UIDrawer.ContainerSize)containerSize.enumValueIndex == UIDrawer.ContainerSize.FixedSize) { QUI.QObjectPropertyField("Fixed Size", containerFixedSize, width, 20, false); } } QUI.EndHorizontal(); }
void DrawPerformDatabaseUpgrade(float width) { QUI.BeginHorizontal(width); { QLabel.text = "Find"; QLabel.style = Style.Text.Button; if (QUI.GhostButton(QLabel.text, QColors.Color.Gray, QLabel.x + 16, 18)) { // Load object UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(DUI.RELATIVE_PATH_VERSION + "DUIVersion" + ".asset", typeof(UnityEngine.Object)); // Select the object in the project folder Selection.activeObject = obj; // Also flash the folder yellow to highlight it EditorGUIUtility.PingObject(obj); } QUI.Space(SPACE_2); QLabel.text = "DoozyUI " + Internal.DUIVersion.Instance.version; QLabel.style = Style.Text.Button; QUI.Label(QLabel); QUI.Space(SPACE_2); QLabel.text = "Perform Database Upgrade"; QLabel.style = Style.Text.Button; QUI.BeginChangeCheck(); Internal.DUIVersion.Instance.performDatabaseUpgrade = QUI.QToggle("Perform Database Upgrade", Internal.DUIVersion.Instance.performDatabaseUpgrade); if (QUI.EndChangeCheck()) { QUI.SetDirty(Internal.DUIVersion.Instance); AssetDatabase.SaveAssets(); } QUI.FlexibleSpace(); } QUI.EndHorizontal(); }
protected void AddToggleButton(string biaoTi, string actionStr1, string actionStr2, [NotNull] Action action1, [NotNull] Action action2) { MyCreate.Heng(() => { MyCreate.AddSpace(); if (QUI.GhostButton(biaoTi, QColors.Color.Orange, 80, 20, editStats.target)) { editStats.target = !editStats.target; } if (editStats.faded > 0.05f) { if (QUI.GhostButton(actionStr1, QColors.Color.Green, PS.databaseClearStatisticsButtonWidth * editStats.faded, 20)) { action1(); } if (QUI.GhostButton(actionStr2, QColors.Color.Blue, PS.databaseDeleteButtonWidth * editStats.faded, 20)) { action2(); } } }); }
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(); }
void DrawRenameGameObjectButton(float width) { QUI.BeginHorizontal(width); { if (QUI.GhostButton("Rename GameObject to Drawer Name", QColors.Color.Gray, width, 18)) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Renamed Multiple Objects"); for (int i = 0; i < targets.Length; i++) { UIDrawer uid = (UIDrawer)targets[i]; uid.gameObject.name = "UID - " + uid.GetDrawerName(); } } else { Undo.RecordObject(Drawer.gameObject, "Renamed GameObject"); Drawer.gameObject.name = "UID - " + Drawer.GetDrawerName(); } } } QUI.EndHorizontal(); }
void DrawPageAbout() { DrawPageHeader("About", QColors.Blue, "", QUI.IsProSkin ? QColors.UnityLight : QColors.UnityMild, DUIResources.pageIconAbout); QUI.Space(SPACE_16); QUI.DrawTexture(DUIResources.aboutVersion.texture, 400, 200); if (WindowSettings.CurrentPageContentWidth > WindowSettings.pageWidth - 230) { return; } QUI.Space(-56); QUI.BeginHorizontal(WindowSettings.CurrentPageContentWidth); { QUI.FlexibleSpace(); QLabel.text = DUIVersion.Instance.version; QLabel.style = Style.Text.Subtitle; QUI.SetGUIContentColor(QUI.AccentColorBlue); if (editVersion.target) { newVersion = QUI.TextField(newVersion, 104); } else { QUI.Label(QLabel); } QUI.ResetColors(); QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.Space(38); #if dUI_SOURCE QUI.BeginHorizontal(WindowSettings.CurrentPageContentWidth); { QUI.FlexibleSpace(); if (QUI.GhostButton(editVersion.target ? "Update Version" : "Edit Version", editVersion.target ? QColors.Color.Green : QColors.Color.Gray, 100)) { editVersion.target = !editVersion.target; if (editVersion.target) { newVersion = DUIVersion.Instance.version; } else { DUIVersion.Instance.version = newVersion; QUI.SetDirty(DUIVersion.Instance); AssetDatabase.SaveAssets(); } } if (editVersion.faded > 0.2f) { if (QUI.GhostButton("Cancel", QColors.Color.Red, 100)) { editVersion.target = false; newVersion = ""; } } QUI.FlexibleSpace(); } QUI.EndHorizontal(); #endif QUI.Space(SPACE_8); DrawNewsArticle("About DoozyUI", "DoozyUI is a complete UI management system for Unity. " + "It manipulates native Unity components and takes full advantage of their intended usage. " + "This assures maximum compatibility with uGUI, best performance and makes the entire system have a predictable behaviour. " + "Also, by working only with native components, the system will be compaible with any ohter asset that uses uGUI correctly. " + "\n\n" + "Easy to use and understand, given the user has some basic knowledge of how Unity's native UI solution (uGUI) works, DoozyUI has flexible components that can be configured in a lot of ways. " + "Functionality and design go hand in hand in order to offer a pleasant user experience (UX) while using the system." + "\n\n" + "Starting with version 2.8, DoozyUI is officialy VR READY, being capable of handling with ease multiple Canvases set to World Space render mode. " + "The system has been redesigned, from the core up, in order to accomodate a higher degree of flexibility that was needed in order for it to handle a lot of different use case scenarios." + "\n\n" + "The asset 'DoozyUI' has been released on the Unity Asset Store under the 'Doozy Entertainment' brand, owned by the Marlink Trading SRL company.", WindowSettings.CurrentPageContentWidth); }
void DrawNewUISoundAndSearch(float width) { QUI.BeginHorizontal(width); { #region New UISound if (SearchPatternAnimBool.faded < 0.2f) { if (QUI.GhostButton("New UISound", QColors.Color.Green, 100 * (1 - SearchPatternAnimBool.faded), 20, NewUISoundAnimBool.value) || DetectKeyCombo_Alt_N()) { NewUISoundAnimBool.target = !NewUISoundAnimBool.target; if (NewUISoundAnimBool.target) { NewUISoundName = ""; SearchPatternAnimBool.target = false; } } } if (NewUISoundAnimBool.target) { SearchPatternAnimBool.target = false; QUI.SetGUIBackgroundColor(QColors.GreenLight.Color); QUI.SetNextControlName("NewUISoundName"); NewUISoundName = EditorGUILayout.TextField(NewUISoundName, GUILayout.Width((width - 149) * NewUISoundAnimBool.faded)); QUI.ResetColors(); if (!NewUISoundAnimBool.value && Event.current.type == EventType.Layout) //if NewUISoundAnimBool.target is true and NewUISoundAnimBool.value is false -> in transition -> select the text in the control { QUI.FocusControl("NewUISoundName"); QUI.FocusTextInControl("NewUISoundName"); } if (QUI.ButtonOk() || (DetectKey_Return() && QUI.GetNameOfFocusedControl().Equals("NewUISoundName"))) { if (NewUISoundName.IsNullOrEmpty()) { EditorUtility.DisplayDialog("Info", "Cannot create an unnamed UISound. Try again.", "Ok"); } else { if (DUIData.Instance.DatabaseUISounds.Contains(NewUISoundName)) { EditorUtility.DisplayDialog("Info", "A UISound named '" + NewUISoundName + "' already exists in the database. Try again.", "Ok"); } else { DUIData.Instance.DatabaseUISounds.CreateUISound(NewUISoundName, selectedUISoundsDatabaseFilter, null); NewUISoundAnimBool.target = false; } } } QUI.Space(1); if (QUI.ButtonCancel() || QUI.DetectKeyDown(Event.current, KeyCode.Escape)) { NewUISoundName = string.Empty; NewUISoundAnimBool.target = false; } } #endregion QUI.FlexibleSpace(); #region Search if (SearchPatternAnimBool.value) { NewUISoundAnimBool.target = false; QUI.SetGUIBackgroundColor(QColors.OrangeLight.Color); QUI.SetNextControlName("SearchPattern"); SearchPattern = EditorGUILayout.TextField(SearchPattern, GUILayout.Width((width - 104) * SearchPatternAnimBool.faded)); QUI.ResetColors(); if (SearchPatternAnimBool.target && Event.current.type == EventType.Layout) //if SearchPatternAnimBool.target is true and SearchPatternAnimBool.value is false -> in transition -> select the text in the control { QUI.FocusControl("SearchPattern"); QUI.FocusTextInControl("SearchPattern"); } } if (NewUISoundAnimBool.faded < 0.2f) { if (QUI.GhostButton(SearchPatternAnimBool.value ? "Clear Search" : "Search", QColors.Color.Orange, 100 * (1 - NewUISoundAnimBool.faded), 20, SearchPatternAnimBool.value) || DetectKeyCombo_Alt_S() || //Toggle Search (DetectKey_Escape() && SearchPatternAnimBool.target)) //Clear Search { SearchPatternAnimBool.target = !SearchPatternAnimBool.target; if (SearchPatternAnimBool.target) { SearchPattern = string.Empty; NewUISoundAnimBool.target = false; } } } #endregion } QUI.EndHorizontal(); }
public void DrawDatabase(TargetDatabase databaseType, DUIData.Database database, float width) { DrawNewCategoryAndSearch(width, databaseType); QUI.Space(SPACE_16); if (database.categories.Count == 0) { DrawInfoMessage(InfoMessageName.AddCategoryToStart.ToString(), width); return; } DrawExpandCollapseButtons(width, databaseType); QUI.Space(SPACE_8); foreach (string categoryName in database.categoryNames) { if (categoryName.Equals(DUI.CUSTOM_NAME)) { continue; } QUI.BeginHorizontal(width); { #region Button Bar if (RenameCategoryAnimBool.target && RenameCategoryTargetCategoryName.Equals(categoryName)) { QLabel.text = "Rename category to"; QLabel.style = Style.Text.Normal; QUI.Label(QLabel); QUI.Space(SPACE_2); QUI.SetNextControlName("RenameCategoryName"); RenameCategoryName = QUI.TextField(RenameCategoryName, width - QLabel.x - 46); QUI.Space(1); if (QUI.ButtonOk() || (DetectKey_Return() && QUI.GetNameOfFocusedControl().Equals("RenameCategoryName"))) { RenameCategoryName = RenameCategoryName.Trim(); if (string.IsNullOrEmpty(RenameCategoryName)) { QUI.DisplayDialog("Action Required", "Please enter a new category name in order to cotinue.", "Ok"); } else if (database.categoryNames.Contains(RenameCategoryName)) { QUI.DisplayDialog("Action Required", "There is another category with the name '" + RenameCategoryName + "' already in the database." + "\n\n" + "Enter another category name.", "Ok"); } else { database.RenameCategory(categoryName, RenameCategoryName); RenameCategoryName = ""; RenameCategoryAnimBool.target = false; RenameCategoryTargetCategoryName = ""; break; } } QUI.Space(1); if (QUI.ButtonCancel() || QUI.DetectKeyDown(Event.current, KeyCode.Escape)) { RenameCategoryName = ""; RenameCategoryAnimBool.target = false; RenameCategoryTargetCategoryName = ""; } } else { if (QUI.GhostBar(categoryName, SearchPatternAnimBool.target ? QColors.Color.Orange : QColors.Color.Blue, database.GetCategory(categoryName).isExpanded, width - 70 * database.GetCategory(categoryName).isExpanded.faded *(1 - SearchPatternAnimBool.faded), BarHeight)) { database.GetCategory(categoryName).isExpanded.target = !database.GetCategory(categoryName).isExpanded.target; } if (database.GetCategory(categoryName).isExpanded.faded > 0.7f && SearchPatternAnimBool.faded < 0.3f) { QUI.Space(1); if (QUI.GhostButton("rename", QColors.Color.Gray, 52, BarHeight, database.GetCategory(categoryName).isExpanded.value)) { if (QUI.DisplayDialog("Information", "Note that after you rename this category, all the UI settings (and code references) that use the current category name, will not get automatically changed." + "\n\n" + "You are responsible to update your code and the UI settings.", "Continue", "Cancel")) { RenameCategoryAnimBool.target = true; RenameCategoryName = categoryName; RenameCategoryTargetCategoryName = categoryName; QUI.FocusControl("RenameCategoryName"); QUI.FocusTextInControl("RenameCategoryName"); } } QUI.Space(3); if (QUI.ButtonCancel()) { if (categoryName.Equals(DUI.UNCATEGORIZED_CATEGORY_NAME)) { QUI.DisplayDialog("Info", "You cannot and should not try to delete the '" + categoryName + "' category.", "Ok"); } else if (QUI.DisplayDialog("Delete category?", "Are you sure you want to delete the '" + categoryName + "'?", "Yes", "Cancel")) { Undo.RecordObject(DUIData.Instance, "DeleteCategory"); database.RemoveCategory(categoryName, true); QUI.EndHorizontal(); break; } } } } #endregion } QUI.EndHorizontal(); if (QUI.BeginFadeGroup(database.GetCategory(categoryName).isExpanded.faded)) { DrawStringList(database.GetCategory(categoryName).itemNames, width, database.GetCategory(categoryName).isExpanded); QUI.Space(SPACE_8 * database.GetCategory(categoryName).isExpanded.faded); } QUI.EndFadeGroup(); QUI.Space(SPACE_2); } }
void DrawHelpModule(string moduleName, Page targetModule, QTexture moduleIcon, List <LinkButtonData> list, float width) { QUI.DrawIconBar(moduleName, moduleIcon, QColors.Color.Gray, IconPosition.Right, width + 16, 24); QUI.Space(SPACE_4); QUI.DrawLinkButtonsList(list, SPACE_8, width); #if EZ_SOURCE QUI.Space(SPACE_2); QUI.Space(6 * (selectedHelpModuleToEdit == targetModule ? editHelpAnimBool.faded : 0)); QUI.BeginHorizontal(width + 16); { QUI.FlexibleSpace(); if (QUI.GhostButton("Edit Links", QColors.Color.Gray, 100, 16, selectedHelpModuleToEdit == targetModule) || QUI.DetectKeyUp(Event.current, KeyCode.Escape)) { if (selectedHelpModuleToEdit == targetModule) { selectedHelpModuleToEdit = Page.None; editHelpAnimBool.target = false; } else { selectedHelpModuleToEdit = targetModule; editHelpAnimBool.target = true; } } if (selectedHelpModuleToEdit == targetModule && editHelpAnimBool.faded > 0.4f) { QUI.Space(SPACE_4 * editHelpAnimBool.faded); if (QUI.GhostButton("Save Changes", QColors.Color.Green, 100 * editHelpAnimBool.faded, 16)) { QUI.SetDirty(EzSourceData.Instance); AssetDatabase.SaveAssets(); selectedHelpModuleToEdit = Page.None; editHelpAnimBool.value = false; } } } QUI.EndHorizontal(); if (selectedHelpModuleToEdit == targetModule) { if (QUI.BeginFadeGroup(editHelpAnimBool.faded)) { QUI.BeginVertical(width); { DrawEditableLinkButtons(list, width + 16); QUI.Space(SPACE_16 * (selectedHelpModuleToEdit == targetModule ? editHelpAnimBool.faded : 0)); } QUI.EndVertical(); } QUI.EndFadeGroup(); } QUI.Space(SPACE_8); #endif QUI.Space(SPACE_8); }
void DrawConvertDUIDataToSourceFiles(string relativePath, string fileName, string fileExtension, float width) { QUI.BeginHorizontal(width); { QLabel.text = "Find"; QLabel.style = Style.Text.Button; if (QUI.GhostButton(QLabel.text, QColors.Color.Gray, QLabel.x + 16, 18)) { // Load object UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(relativePath + fileName + fileExtension, typeof(UnityEngine.Object)); // Select the object in the project folder Selection.activeObject = obj; // Also flash the folder yellow to highlight it EditorGUIUtility.PingObject(obj); } QUI.Space(SPACE_2); QLabel.text = "Create Database Files from: " + fileName; QLabel.style = Style.Text.Button; if (QUI.GhostButton(QLabel.text, QColors.Color.Gray, QLabel.x + 24, 18)) { DUIData D = DUIData.Instance; //UIElements Database Files if (D.DatabaseUIElements != null && D.DatabaseUIElements.categories != null && D.DatabaseUIElements.categories.Count > 0) { for (int i = 0; i < D.DatabaseUIElements.categories.Count; i++) { if (D.DatabaseUIElements.categories[i].categoryName.Equals(DUI.UNCATEGORIZED_CATEGORY_NAME)) { continue; } D.CreateUIElementsDatabaseAssetFile(D.DatabaseUIElements.categories[i].categoryName, D.DatabaseUIElements.categories[i].itemNames); } } //UIButtons Database Files if (D.DatabaseUIButtons != null && D.DatabaseUIButtons.categories != null && D.DatabaseUIButtons.categories.Count > 0) { for (int i = 0; i < D.DatabaseUIButtons.categories.Count; i++) { if (D.DatabaseUIButtons.categories[i].categoryName.Equals(DUI.UNCATEGORIZED_CATEGORY_NAME)) { continue; } D.CreateUIButtonsDatabaseAssetFile(D.DatabaseUIButtons.categories[i].categoryName, D.DatabaseUIButtons.categories[i].itemNames); } } AssetDatabase.DeleteAsset(relativePath + fileName + fileExtension); //delete DUIData AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } if (CheckThatFileExists(relativePath, fileName, fileExtension)) { } else { QUI.Space(SPACE_4); QUI.BeginVertical(16, 16); { QUI.Space(2); QUI.DrawTexture(QResources.iconOk.texture, 14, 14); } QUI.EndVertical(); } QUI.FlexibleSpace(); } QUI.EndHorizontal(); }
void DrawModuleVersion(string moduleName, Page targetModule, EzModuleVersion emv, AnimBool show, float width) { if (QUI.GhostBar(moduleName + (emv == null ? " has not been installed!" : (" version " + emv.versionNumber)), emv == null ? QColors.Color.Gray : QColors.Color.Green, show, width, 24)) { if (emv == null) { show.target = false; WindowSettings.currentPage = targetModule; } else { show.target = !show.target; if (selectedModuleToEdit == targetModule) { selectedModuleToEdit = Page.None; editModuleAnimBool.target = false; } } } if (emv == null) { return; } if (QUI.BeginFadeGroup(show.faded)) { QUI.BeginVertical(width); { QUI.Space(-9); QUI.BeginHorizontal(width); { EditorGUILayout.LabelField(emv.releaseNotes, QStyles.GetInfoMessageMessageStyle(Style.InfoMessage.Help)); } QUI.EndHorizontal(); #if EZ_SOURCE #pragma warning disable CS0162 // Unreachable code detected QUI.Space(13); QUI.Space(8 * (selectedModuleToEdit == targetModule ? editModuleAnimBool.faded : 0)); QUI.BeginHorizontal(width); { QUI.FlexibleSpace(); if (QUI.GhostButton("Edit Version", QColors.Color.Gray, 100, 16, selectedModuleToEdit == targetModule) || QUI.DetectKeyUp(Event.current, KeyCode.Escape)) { if (selectedModuleToEdit == targetModule) { selectedModuleToEdit = Page.None; editModuleAnimBool.target = false; } else { selectedModuleToEdit = targetModule; editModuleAnimBool.target = true; } } if (selectedModuleToEdit == targetModule && editModuleAnimBool.faded > 0.4f) { QUI.Space(SPACE_4 * editModuleAnimBool.faded); if (QUI.GhostButton("Save Changes", QColors.Color.Green, 100 * editModuleAnimBool.faded, 16)) { QUI.SetDirty(emv); AssetDatabase.SaveAssets(); selectedModuleToEdit = Page.None; editModuleAnimBool.value = false; } } } QUI.EndHorizontal(); if (selectedModuleToEdit == targetModule) { if (QUI.BeginFadeGroup(editModuleAnimBool.faded)) { QUI.BeginVertical(width); { QUI.BeginHorizontal(width); { EditorGUILayout.LabelField("version", QStyles.GetStyle(QStyles.GetStyleName(Style.Text.Small)), GUILayout.Width(80)); QUI.Space(SPACE_2); EditorGUILayout.LabelField("release notes", QStyles.GetStyle(QStyles.GetStyleName(Style.Text.Small))); } QUI.EndHorizontal(); QUI.Space(-SPACE_4); QUI.BeginHorizontal(width); { emv.versionNumber = EditorGUILayout.TextField(emv.versionNumber, GUILayout.Width(80)); QUI.Space(SPACE_2); emv.releaseNotes = EditorGUILayout.TextArea(emv.releaseNotes); } QUI.EndHorizontal(); QUI.Space(SPACE_16); } QUI.EndVertical(); } QUI.EndFadeGroup(); } #endif QUI.Space(9 + 16); } QUI.EndVertical(); } QUI.EndFadeGroup(); #pragma warning restore CS0162 // Unreachable code detected }
void DrawSortingOrder(float width) { QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, useCustomOrderInLayer.boolValue ? QColors.Color.Blue : QColors.Color.Gray), width - 178, 20); QUI.Space(-20); QUI.BeginHorizontal(width); { QLabel.text = "Order in Layer"; QLabel.style = Style.Text.Normal; tempFloat = QLabel.x; //save label width QUI.Space(SPACE_4); QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight); { QUI.Space(1); QUI.Label(QLabel); } QUI.EndVertical(); if (!useCustomOrderInLayer.boolValue) { targetOrderInLayer = TargetCanvas.overrideSorting ? TargetCanvas.sortingOrder : TargetCanvas.rootCanvas.sortingOrder; targetOrderInLayer = uiEffect.effectPosition == UIEffect.EffectPosition.InFrontOfTarget ? targetOrderInLayer + uiEffect.sortingOrderStep : targetOrderInLayer - uiEffect.sortingOrderStep; QLabel.text = targetOrderInLayer.ToString(); QLabel.style = Style.Text.Help; QUI.BeginVertical(width - tempFloat - 188, QUI.SingleLineHeight); { QUI.Space(2); QUI.Label(QLabel); } QUI.EndVertical(); customOrderInLayer.intValue = targetOrderInLayer; } else { QUI.PropertyField(customOrderInLayer, width - tempFloat - 198); QUI.Space(2); } QUI.QToggle("use a custom order in layer", useCustomOrderInLayer, 20); } QUI.EndHorizontal(); QUI.Space(SPACE_2); useCustomOrderInLayerAnimBool.target = !useCustomOrderInLayer.boolValue; QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Gray), width, 24 + 20 * useCustomOrderInLayerAnimBool.faded); QUI.Space(-21 - 20 * useCustomOrderInLayerAnimBool.faded); if (QUI.BeginFadeGroup(useCustomOrderInLayerAnimBool.faded)) { QUI.BeginHorizontal(width); { QUI.Space(SPACE_4); QLabel.text = "Set the effect"; QLabel.style = Style.Text.Normal; QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight); { QUI.Space(1); QUI.Label(QLabel); } QUI.EndVertical(); QUI.PropertyField(effectPosition, width - QLabel.x - 132); QLabel.text = "by"; QLabel.style = Style.Text.Normal; QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight); { QUI.Space(1); QUI.Label(QLabel); } QUI.EndVertical(); QUI.PropertyField(sortingOrderStep, 40); QLabel.text = "step"; QLabel.style = Style.Text.Normal; QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight); { QUI.Space(1); QUI.Label(QLabel); } QUI.EndVertical(); QUI.FlexibleSpace(); } QUI.EndHorizontal(); } QUI.EndFadeGroup(); QUI.Space(SPACE_2 * useCustomOrderInLayerAnimBool.faded); QUI.BeginHorizontal(width); { QUI.Space(SPACE_4); if (QUI.GhostButton("Update Sorting", QColors.Color.Gray, width - 8, 18)) { uiEffect.UpdateSorting(); } QUI.Space(SPACE_4); } QUI.EndHorizontal(); }
void DrawNews(float width) { if (News == null) { return; } QLabel.text = !showAddNews.target ? "" : "New Article"; QLabel.style = Style.Text.Title; QUI.BeginHorizontal(width, 16); { if (showAddNews.target) { QUI.SetGUIColor(QUI.AccentColorBlue); } QUI.Label(QLabel); QUI.ResetColors(); #if dUI_SOURCE QUI.Space(width - QLabel.x - 104 - 100 * showAddNews.faded); if (QUI.GhostButton(showAddNews.target ? "Save" : "Add News", showAddNews.target ? QColors.Color.Green : QColors.Color.Gray, 100, showAddNews.target)) { showAddNews.target = !showAddNews.target; if (!showAddNews.target) { News.articles.Add(new NewsArticleData(newNewsArticle)); QUI.SetDirty(News); AssetDatabase.SaveAssets(); } newNewsArticle.Reset(); } if (showAddNews.faded > 0.2f) { if (QUI.GhostButton("Cancel", QColors.Color.Red, 100 * showAddNews.faded, showAddNews.target)) { showAddNews.target = false; newNewsArticle.Reset(); } } #else QUI.FlexibleSpace(); #endif } QUI.EndHorizontal(); QUI.Space(SPACE_2); if (QUI.BeginFadeGroup(showAddNews.faded)) { QUI.BeginVertical(width); { QUI.Space(SPACE_4 * showAddNews.faded); QUI.DrawLine(QColors.Color.Blue, width); QUI.Space(SPACE_4 * showAddNews.faded); QUI.SetGUIBackgroundColor(QUI.AccentColorBlue); QUI.BeginHorizontal(width); { QLabel.text = "Title"; QLabel.style = Style.Text.Normal; QUI.Label(QLabel); newNewsArticle.title = QUI.TextField(newNewsArticle.title, width - QLabel.x - 8); } QUI.EndHorizontal(); QUI.Space(SPACE_2 * showAddNews.faded); QUI.BeginHorizontal(width); { QLabel.text = "Content"; QLabel.style = Style.Text.Normal; QUI.Label(QLabel); newNewsArticle.content = EditorGUILayout.TextArea(newNewsArticle.content, GUILayout.Width(width - QLabel.x - 8)); } QUI.EndHorizontal(); QUI.ResetColors(); QUI.Space(SPACE_4 * showAddNews.faded); QUI.DrawLine(QColors.Color.Blue, width); QUI.Space(SPACE_16 * showAddNews.faded); } QUI.EndVertical(); } QUI.EndFadeGroup(); if (News.articles.Count == 0) { //QLabel.text = "There are no news..."; //QLabel.style = Style.Text.Help; //QUI.Label(QLabel); return; } QUI.Space(SPACE_2); for (int i = 0; i < News.articles.Count; i++) { #if dUI_SOURCE DrawNewsArticle(News.articles, i, News, true, width); #else DrawNewsArticle(News.articles, i, News, false, width); #endif QUI.Space(9 + 4); } }