示例#1
0
 public static void DrawUnityEvents(bool enabled, AnimBool showEvents, SerializedProperty unityEvent, string unityEventTitle, float width, float miniBarHeight)
 {
     if (QUI.GhostBar("Unity Events", enabled ? QColors.Color.Blue : QColors.Color.Gray, showEvents, width, miniBarHeight))
     {
         showEvents.target = !showEvents.target;
     }
     QUI.BeginHorizontal(width);
     {
         QUI.Space(8 * showEvents.faded);
         if (QUI.BeginFadeGroup(showEvents.faded))
         {
             QUI.SetGUIBackgroundColor(enabled ? AccentColorBlue : AccentColorGray);
             QUI.BeginVertical(width - 16);
             {
                 QUI.Space(2 * showEvents.faded);
                 QUI.PropertyField(unityEvent, new GUIContent()
                 {
                     text = unityEventTitle
                 }, width - 8);
                 QUI.Space(2 * showEvents.faded);
             }
             QUI.EndVertical();
             QUI.ResetColors();
         }
         QUI.EndFadeGroup();
     }
     QUI.EndHorizontal();
 }
        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 DrawButtonNameOptions(float width)
        {
            if (!triggerOnButtonClick.boolValue &&
                !triggerOnButtonDoubleClick.boolValue &&
                !triggerOnButtonLongClick.boolValue)
            {
                return;
            }

            gameEvent.stringValue = string.Empty;

            DrawDatabaseButtons(width);

            QUI.Space(SPACE_4);

            QUI.BeginHorizontal(width);
            {
                QUI.QToggle("dispatch all", dispatchAll);
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();

            QUI.Space(SPACE_2);

            if (dispatchAll.boolValue)
            {
                gameEvent.stringValue = string.Empty;
            }

            QUI.Space(-SPACE_8 * dispatchAllAnimBool.faded);

            if (QUI.BeginFadeGroup((1 - dispatchAllAnimBool.faded)))
            {
                QUI.BeginVertical(width);
                {
                    DrawButtonCategoryAndButtonName(width);
                }
                QUI.EndVertical();
            }
            QUI.EndFadeGroup();

            QUI.Space(SPACE_2);

            infoMessage["SetButtonName"].show.target = (string.IsNullOrEmpty(buttonName.stringValue) || buttonName.stringValue.Equals(DUI.DEFAULT_BUTTON_NAME)) && !dispatchAll.boolValue;
            DrawInfoMessage("SetButtonName", GlobalWidth);

            infoMessage["DispatchAllButtonClicks"].show.target = triggerOnButtonClick.boolValue && dispatchAll.boolValue;
            DrawInfoMessage("DispatchAllButtonClicks", GlobalWidth);

            infoMessage["DispatchAllDoubleButtonClicks"].show.target = triggerOnButtonDoubleClick.boolValue && dispatchAll.boolValue;
            DrawInfoMessage("DispatchAllDoubleButtonClicks", GlobalWidth);

            infoMessage["DispatchAllLongButtonClicks"].show.target = triggerOnButtonLongClick.boolValue && dispatchAll.boolValue;
            DrawInfoMessage("DispatchAllLongButtonClicks", GlobalWidth);
        }
        public override void OnInspectorGUI()
        {
            DrawHeader(DUIResources.headerGestureDetector.texture, WIDTH_420, HEIGHT_42);

            serializedObject.Update();

            QUI.QToggle("debug", debug);
            QUI.Space(SPACE_2);
            QUI.QToggle("is Global Gesture Detector", isGlobalGestureDetector);
            QUI.Space(SPACE_2);
            showTarget.target = !isGlobalGestureDetector.boolValue;
            if (QUI.BeginFadeGroup(showTarget.faded))
            {
                QUI.BeginHorizontal(GlobalWidth);
                {
                    GUI.enabled = overrideTarget.boolValue;
                    QUI.QObjectPropertyField("Target GameObject", targetGameObject, GlobalWidth - 100);
                    GUI.enabled = true;
                    QUI.Space(SPACE_2);
                    QUI.QToggle("override", overrideTarget, 20);
                }
                QUI.EndHorizontal();
            }
            QUI.EndFadeGroup();
            QUI.Space(SPACE_2);
            showSwipeDirection.target = (GestureType)gestureType.enumValueIndex == GestureType.Swipe;
            QUI.BeginHorizontal(GlobalWidth);
            {
                QUI.QObjectPropertyField("Gesture Type", gestureType, ((GlobalWidth - SPACE_2) / 2), 20, false);
                QUI.Space(SPACE_2);
                if (showSwipeDirection.faded > 0.2f)
                {
                    QUI.QObjectPropertyField("Swipe Direction", swipeDirection, ((GlobalWidth - SPACE_2) / 2) * showSwipeDirection.faded, 20, false);
                }
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();
            QUI.Space(SPACE_2);
            switch ((GestureType)gestureType.enumValueIndex)
            {
            case GestureType.Tap: DUIUtils.DrawUnityEvents(gestureDetector.OnTap.GetPersistentEventCount() > 0, showOnTap, OnTap, "OnTap", GlobalWidth, MiniBarHeight); break;

            case GestureType.LongTap: DUIUtils.DrawUnityEvents(gestureDetector.OnLongTap.GetPersistentEventCount() > 0, showOnLongTap, OnLongTap, "OnLongTap", GlobalWidth, MiniBarHeight); break;

            case GestureType.Swipe: DUIUtils.DrawUnityEvents(gestureDetector.OnSwipe.GetPersistentEventCount() > 0, showOnSwipe, OnSwipe, "OnSwipe", GlobalWidth, MiniBarHeight); break;
            }
            QUI.Space(SPACE_2);
            QUI.DrawCollapsableList("Game Events", showGameEventsAnimBool, gameEvents.arraySize > 0 ? QColors.Color.Blue : QColors.Color.Gray, gameEvents, GlobalWidth, 18, "Not sending any Game Events on gesture... Click [+] to start...");
            QUI.Space(SPACE_2);
            DUIUtils.DrawNavigation(target, gestureDetector.navigationPointerData, editorNavigationData, showNavigation, UpdateAllNavigationData, true, false, GlobalWidth, MiniBarHeight);

            serializedObject.ApplyModifiedProperties();
            QUI.Space(SPACE_4);
        }
 void DrawEvents()
 {
     if (!triggerOnGameEvent.boolValue && !triggerOnButtonClick.boolValue && !triggerOnButtonDoubleClick.boolValue && !triggerOnButtonLongClick.boolValue)
     {
         return;
     }
     if (triggerOnGameEvent.boolValue && (!dispatchAll.boolValue && string.IsNullOrEmpty(gameEvent.stringValue)))
     {
         return;
     }
     if ((triggerOnButtonClick.boolValue || triggerOnButtonDoubleClick.boolValue || triggerOnButtonLongClick.boolValue) && (!dispatchAll.boolValue && string.IsNullOrEmpty(buttonName.stringValue)))
     {
         return;
     }
     SaveColors();
     QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color);
     QUI.PropertyField(onTriggerEvent, new GUIContent("On Trigger Event"), WIDTH_420);
     RestoreColors();
     QUI.ResetColors();
     if (QUI.Button(DUIStyles.GetStyle(showGameEvents.target ? DUIStyles.ButtonStyle.GameEvents : DUIStyles.ButtonStyle.GameEventsCollapsed), WIDTH_420, 18))
     {
         showGameEvents.target = !showGameEvents.target;
     }
     if (QUI.BeginFadeGroup(showGameEvents.faded))
     {
         SaveColors();
         QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color);
         QUI.BeginVertical(WIDTH_420);
         {
             QUI.Space(SPACE_2);
             QUI.DrawList(gameEvents, WIDTH_420, "Not sending any Game Event on trigger... Click [+] to start...");
             QUI.Space(SPACE_2);
         }
         QUI.EndVertical();
         RestoreColors();
     }
     QUI.EndFadeGroup();
 }
        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 DrawEnergyBars(float width)
        {
#if dUI_EnergyBarToolkit
            QUI.Space(SPACE_2);

            tempFloat = (20 + 2 + 18 * (sceneLoader.energyBars.Count + 1) + 2) * showEnergyBars.faded; //background height
            if (showEnergyBars.faded > 0.1f)
            {
                QUI.BeginHorizontal(width);
                {
                    QUI.Space(4 * showEnergyBars.faded);
                    QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, sceneLoader.energyBars.Count > 0 ? QColors.Color.Purple : QColors.Color.Gray), width - 4, tempFloat);
                }
                QUI.EndHorizontal();
                QUI.Space(-tempFloat);
            }

            if (QUI.SlicedBar("Energy Bars", sceneLoader.energyBars.Count > 0 ? QColors.Color.Purple : QColors.Color.Gray, showEnergyBars, width, BarHeight))
            {
                showEnergyBars.target = !showEnergyBars.target;
            }

            QUI.BeginHorizontal(width);
            {
                QUI.Space(8 * showEnergyBars.faded);
                if (QUI.BeginFadeGroup(showEnergyBars.faded))
                {
                    QUI.BeginVertical(width - 8);
                    {
                        QUI.Space(2);

                        if (sceneLoader.energyBars.Count == 0)
                        {
                            QUI.BeginHorizontal(width - 8);
                            {
                                QLabel.text  = "No Energy Bars referenced... Click [+] to start...";
                                QLabel.style = Style.Text.Help;
                                QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight);
                                {
                                    QUI.Label(QLabel);
                                    QUI.Space(2);
                                }
                                QUI.EndVertical();

                                QUI.FlexibleSpace();

                                QUI.BeginVertical(16, QUI.SingleLineHeight);
                                {
                                    if (QUI.ButtonPlus())
                                    {
                                        Undo.RecordObject(sceneLoader, "Added Energy Bar");
                                        sceneLoader.energyBars = new List <EnergyBar> {
                                            null
                                        };
                                    }
                                    QUI.Space(1);
                                }
                                QUI.EndVertical();

                                QUI.Space(4);
                            }
                            QUI.EndHorizontal();
                        }
                        else
                        {
                            QUI.BeginVertical(width - 8);
                            {
                                QLabel.style = Style.Text.Help;
                                for (int i = 0; i < sceneLoader.energyBars.Count; i++)
                                {
                                    QUI.BeginHorizontal(width - 8, QUI.SingleLineHeight);
                                    {
                                        QLabel.text = i.ToString();
                                        QUI.Label(QLabel);

                                        QUI.Space(2);

                                        sceneLoader.energyBars[i] = (EnergyBar)QUI.ObjectField(sceneLoader.energyBars[i], typeof(EnergyBar), true, width - QLabel.x - 2 - 16 - 12 - 8);

                                        if (QUI.ButtonMinus())
                                        {
                                            Undo.RecordObject(sceneLoader, "Removed Energy Bar");
                                            sceneLoader.energyBars.RemoveAt(i);
                                        }

                                        QUI.Space(8);
                                    }
                                    QUI.EndHorizontal();
                                }

                                QUI.BeginHorizontal(width - 8);
                                {
                                    QUI.FlexibleSpace();

                                    QUI.BeginVertical(16, QUI.SingleLineHeight);
                                    {
                                        if (QUI.ButtonPlus())
                                        {
                                            Undo.RecordObject(sceneLoader, "Added Energy Bar");
                                            sceneLoader.energyBars.Add(null);
                                        }
                                        QUI.Space(1);
                                    }
                                    QUI.EndVertical();

                                    QUI.Space(4);
                                }
                                QUI.EndHorizontal();
                            }
                            QUI.EndVertical();

                            QUI.Space(2);

                            QUI.Space(4 * showEnergyBars.faded);
                        }
                    }
                    QUI.EndVertical();
                }
                QUI.EndFadeGroup();
            }
            QUI.EndHorizontal();

            QUI.Space(SPACE_8);
#endif
        }
        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);
        }
示例#9
0
        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);
            }
        }
        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);
            }
        }
        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 (QUI.GhostBar(categoryName, SearchPatternAnimBool.target ? QColors.Color.Orange : QColors.Color.Blue, database.GetCategory(categoryName).isExpanded, width - 15 * 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.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 DrawNotificationItems(float width)
        {
            tempFloat = (20 + 2 + 18 * (uiNotificationManager.NotificationItems.Count + 1) + 2) * showUINotifications.faded; //background height
            if (showUINotifications.faded > 0.1f)
            {
                QUI.BeginHorizontal(width);
                {
                    QUI.Space(4 * showUINotifications.faded);
                    QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, uiNotificationManager.NotificationItems.Count > 0 ? QColors.Color.Purple : QColors.Color.Gray), width - 4, tempFloat);
                }
                QUI.EndHorizontal();
                QUI.Space(-tempFloat);
            }

            if (QUI.SlicedBar("UINotifications", uiNotificationManager.NotificationItems.Count > 0 ? QColors.Color.Purple : QColors.Color.Gray, showUINotifications, width, BarHeight))
            {
                showUINotifications.target = !showUINotifications.target;
            }

            QUI.BeginHorizontal(width);
            {
                QUI.Space(8 * showUINotifications.faded);
                if (QUI.BeginFadeGroup(showUINotifications.faded))
                {
                    QUI.BeginVertical(width - 8);
                    {
                        QUI.Space(2);

                        if (uiNotificationManager.NotificationItems.Count == 0)
                        {
                            QUI.BeginHorizontal(width - 8);
                            {
                                QLabel.text  = "No UINotifications referenced... Click [+] to start...";
                                QLabel.style = Style.Text.Help;
                                QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight);
                                {
                                    QUI.Label(QLabel);
                                    QUI.Space(2);
                                }
                                QUI.EndVertical();

                                QUI.FlexibleSpace();

                                QUI.BeginVertical(16, QUI.SingleLineHeight);
                                {
                                    if (QUI.ButtonPlus())
                                    {
                                        NotificationItems.InsertArrayElementAtIndex(NotificationItems.arraySize);
                                    }
                                    QUI.Space(1);
                                }
                                QUI.EndVertical();

                                QUI.Space(4);
                            }
                            QUI.EndHorizontal();
                        }
                        else
                        {
                            QUI.BeginVertical(width - 8);
                            {
                                for (int i = 0; i < uiNotificationManager.NotificationItems.Count; i++)
                                {
                                    QUI.BeginHorizontal(width - 8, QUI.SingleLineHeight);
                                    {
                                        if (NotificationItems.GetArrayElementAtIndex(i).FindPropertyRelative("notificationPrefab").objectReferenceValue != null)
                                        {
                                            NotificationItems.GetArrayElementAtIndex(i).FindPropertyRelative("notificationName").stringValue = NotificationItems.GetArrayElementAtIndex(i).FindPropertyRelative("notificationPrefab").objectReferenceValue.name;
                                        }
                                        else
                                        {
                                            NotificationItems.GetArrayElementAtIndex(i).FindPropertyRelative("notificationName").stringValue = "Missing Reference";
                                        }

                                        QLabel.text  = i + " - " + NotificationItems.GetArrayElementAtIndex(i).FindPropertyRelative("notificationName").stringValue;
                                        QLabel.style = Style.Text.Normal;

                                        QUI.Label(QLabel.text, Style.Text.Normal, 200);

                                        QUI.Space(2);

                                        QUI.PropertyField(NotificationItems.GetArrayElementAtIndex(i).FindPropertyRelative("notificationPrefab"), true, width - 200 - 2 - 16 - 12 - 8);

                                        if (QUI.ButtonMinus())
                                        {
                                            Undo.RecordObject(target, "ReferncedRemoved");
                                            uiNotificationManager.NotificationItems.RemoveAt(i);
                                            QUI.ExitGUI();
                                        }

                                        QUI.Space(8);
                                    }
                                    QUI.EndHorizontal();
                                }

                                QUI.BeginHorizontal(width - 8);
                                {
                                    QUI.FlexibleSpace();

                                    QUI.BeginVertical(16, QUI.SingleLineHeight);
                                    {
                                        if (QUI.ButtonPlus())
                                        {
                                            NotificationItems.InsertArrayElementAtIndex(NotificationItems.arraySize);
                                        }
                                        QUI.Space(1);
                                    }
                                    QUI.EndVertical();

                                    QUI.Space(4);
                                }
                                QUI.EndHorizontal();
                            }
                            QUI.EndVertical();

                            QUI.Space(2);

                            QUI.Space(4 * showUINotifications.faded);
                        }
                    }
                    QUI.EndVertical();
                }
                QUI.EndFadeGroup();
            }
            QUI.EndHorizontal();

            QUI.Space(SPACE_8);
        }
示例#13
0
        private void DrawLocations()
        {
            QUI.BeginHorizontal(WIDTH_420);
            {
                QUI.SetGUIBackgroundColor(AccentColorBlue);
                QUI.BeginChangeCheck();
                QUI.Toggle(useSpawnerAsSpawnLocation);
                if (QUI.EndChangeCheck())
                {
                    HandleUtility.Repaint();
                    SceneView.RepaintAll();
                    Repaint();
                }
                QUI.ResetColors();
                if (useSpawnerAsSpawnLocation.boolValue && poolySpawner.spawnPositions != null && poolySpawner.spawnPositions.Count > 0)
                {
                    spawnPositions.ClearArray();
                    spawnPositions.InsertArrayElementAtIndex(0);
                    spawnPositions.GetArrayElementAtIndex(0).FindPropertyRelative("spawnPosition").vector3Value = new Vector3(0, 1, 0);

                    serializedObject.ApplyModifiedProperties();
                    HandleUtility.Repaint();
                    SceneView.RepaintAll();
                    Repaint();
                }
                if (useSpawnerAsSpawnLocation.boolValue && poolySpawner.spawnPoints != null && poolySpawner.spawnPoints.Count > 0)
                {
                    spawnPoints.ClearArray();
                    spawnPoints.InsertArrayElementAtIndex(0);

                    serializedObject.ApplyModifiedProperties();
                    HandleUtility.Repaint();
                    SceneView.RepaintAll();
                    Repaint();
                }
                QUI.Label("使用预制体的坐标作为产生点", Style.Text.Normal, 200);
            }
            QUI.EndHorizontal();
            if (useSpawnerAsSpawnLocation.boolValue)
            {
                return;
            }
            else
            {
                QUI.Space(-SPACE_4);
            }
            animBoolShowSpawnLocationsOptions.target = !useSpawnerAsSpawnLocation.boolValue;
            if (QUI.BeginFadeGroup(animBoolShowSpawnLocationsOptions.faded))
            {
                QUI.Space(SPACE_8);
                QUI.BeginVertical();
                {
                    QUI.Space(SPACE_4);
                    QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Blue), WIDTH_420, 20);
                    QUI.Space(-20);
                    QUI.BeginHorizontal(WIDTH_420);
                    {
                        QUI.Space(SPACE_4);
                        QUI.Label("SPAWN AT", Style.Text.Normal, 60);
                        QUI.SetGUIBackgroundColor(AccentColorBlue);
                        QUI.BeginChangeCheck();
                        {
                            QUI.Popup(spawnAt, 70);
                        }
                        if (QUI.EndChangeCheck())
                        {
                            Undo.RecordObject(poolySpawner, "SpawnAt Change");

                            spawnPositions.ClearArray();
                            spawnPositions.InsertArrayElementAtIndex(0);
                            spawnPositions.GetArrayElementAtIndex(0).FindPropertyRelative("spawnPosition").vector3Value = new Vector3(0, 1, 0);

                            spawnPoints.ClearArray();
                            spawnPoints.InsertArrayElementAtIndex(0);
                            serializedObject.ApplyModifiedProperties();
                        }
                        QUI.ResetColors();
                        QUI.FlexibleSpace();
                        if ((poolySpawner.spawnPositions != null && poolySpawner.spawnPositions.Count > 1 && poolySpawner.spawnAt == PoolySpawner.SpawnAt.Position) ||
                            (poolySpawner.spawnPoints != null && poolySpawner.spawnPoints.Count > 1 && poolySpawner.spawnAt == PoolySpawner.SpawnAt.Transform))
                        {
                            QUI.Label("Spawn Type", Style.Text.Normal, 68);
                            QUI.SetGUIBackgroundColor(AccentColorBlue);
                            QUI.Popup(locationSpawnType, 80, SpawnTypes);
                            QUI.ResetColors();
                        }
                        QUI.Space(SPACE_8);
                    }
                    QUI.EndHorizontal();
                    QUI.Space(SPACE_4);
                    switch (poolySpawner.spawnAt)
                    {
                    case PoolySpawner.SpawnAt.Position:
                        if (poolySpawner.spawnPositions == null || poolySpawner.spawnPositions.Count == 0)
                        {
                            poolySpawner.spawnPositions = new List <PoolySpawner.SpawnPosition> {
                                new PoolySpawner.SpawnPosition(new Vector3(0, 1, 0))
                            };
                        }
                        if (poolySpawner.spawnPositions.Count == 1 && poolySpawner.locationSpawnType == PoolySpawner.SpawnType.Random)
                        {
                            poolySpawner.locationSpawnType = PoolySpawner.SpawnType.Sequential;
                        }
                        for (int i = 0; i < poolySpawner.spawnPositions.Count; i++)
                        {
                            QUI.BeginHorizontal(WIDTH_420);
                            {
                                tempContent     = new GUIContent(i.ToString());
                                tempContentSize = QStyles.CalcSize(tempContent, Style.Text.Small);
                                QUI.Label(tempContent.text, Style.Text.Small, tempContentSize.x);
                                QUI.BeginChangeCheck();
                                Vector3 spawnPosition = poolySpawner.spawnPositions[i].spawnPosition;
                                QUI.SetGUIBackgroundColor(AccentColorBlue);
                                spawnPosition = QUI.Vector3(spawnPosition, (WIDTH_420 - SPACE_2 - tempContentSize.x - SPACE_8 - SPACE_16 - SPACE_4) - 240 * animBoolRandomSpawnLocation.faded);
                                QUI.ResetColors();
                                if (QUI.EndChangeCheck())
                                {
                                    Undo.RecordObject(poolySpawner, "Changed Spawn Position " + i);
                                    poolySpawner.spawnPositions[i].spawnPosition = spawnPosition;
                                    QUI.SetDirty(poolySpawner);
                                }
                                if (QUI.ButtonMinus())
                                {
                                    if (poolySpawner.spawnPositions.Count > 1)
                                    {
                                        Undo.RecordObject(poolySpawner, "Removed Spawn Position " + i);
                                        poolySpawner.spawnPositions.RemoveAt(i);
                                    }
                                    else if (poolySpawner.spawnPositions == null || poolySpawner.spawnPositions[0].spawnPosition != new Vector3(poolySpawner.transform.position.x, poolySpawner.transform.position.y + 1, poolySpawner.transform.position.z))
                                    {
                                        Undo.RecordObject(poolySpawner, "Reset Spawn Position");
                                        poolySpawner.spawnPositions = new List <PoolySpawner.SpawnPosition> {
                                            new PoolySpawner.SpawnPosition(new Vector3(poolySpawner.transform.position.x, poolySpawner.transform.position.y + 1, poolySpawner.transform.position.z))
                                        };
                                    }
                                    QUI.SetDirty(poolySpawner);
                                    QUI.ExitGUI();
                                }
                                animBoolRandomSpawnLocation.target = locationSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random;
                                if (poolySpawner.spawnPositions != null && poolySpawner.spawnPositions.Count > 1 && locationSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random)
                                {
                                    QUI.Space(SPACE_2);
                                    QUI.Label("weight", Style.Text.Small, 40 * animBoolRandomSpawnLocation.faded);
                                    QUI.Space(-SPACE_8);
                                    QUI.BeginChangeCheck();
                                    int spawnPositionWeight = poolySpawner.spawnPositions[i].weight;
                                    QUI.SetGUIBackgroundColor(AccentColorBlue);
                                    spawnPositionWeight = EditorGUILayout.IntSlider(spawnPositionWeight, 0, 100);
                                    QUI.ResetColors();
                                    if (QUI.EndChangeCheck())
                                    {
                                        Undo.RecordObject(poolySpawner, "Changed Weight Of Spawn Position " + i);
                                        poolySpawner.spawnPositions[i].weight = spawnPositionWeight;
                                    }
                                }
                                QUI.FlexibleSpace();
                                QUI.Space(SPACE_8);
                            }
                            QUI.EndHorizontal();
                            QUI.Space(1);
                        }
                        QUI.Space(SPACE_2);
                        QUI.BeginHorizontal(WIDTH_420);
                        {
                            QUI.FlexibleSpace();
                            if (QUI.ButtonPlus())
                            {
                                Undo.RecordObject(poolySpawner, "Added Spawn Position");
                                poolySpawner.spawnPositions.Add(new PoolySpawner.SpawnPosition(new Vector3(poolySpawner.transform.position.x, poolySpawner.transform.position.y + 1, poolySpawner.transform.position.z)));
                                QUI.SetDirty(poolySpawner);
                                QUI.ExitGUI();
                            }
                            QUI.Space(3 + 240 * animBoolRandomSpawnLocation.faded);
                        }
                        QUI.EndHorizontal();
                        break;

                    case PoolySpawner.SpawnAt.Transform:
                        if (poolySpawner.spawnPoints == null || poolySpawner.spawnPoints.Count == 0)
                        {
                            poolySpawner.spawnPoints = new List <PoolySpawner.SpawnPoint> {
                                new PoolySpawner.SpawnPoint(null)
                            };
                        }
                        if (poolySpawner.spawnPoints.Count == 1 && poolySpawner.locationSpawnType == PoolySpawner.SpawnType.Random)
                        {
                            poolySpawner.locationSpawnType = PoolySpawner.SpawnType.Sequential;
                        }
                        infoMessage["NoSpawnPoint"].show.target = !poolySpawner.HasSpawnPoints();
                        // 画框框提示
                        DrawInfoMessage("NoSpawnPoint", WIDTH_420 - 20);
                        for (int i = 0; i < poolySpawner.spawnPoints.Count; i++)
                        {
                            QUI.BeginHorizontal(WIDTH_420);
                            {
                                tempContent     = new GUIContent(i.ToString());
                                tempContentSize = QStyles.CalcSize(tempContent, Style.Text.Small);
                                QUI.Label(tempContent.text, Style.Text.Small, tempContentSize.x);
                                QUI.BeginChangeCheck();
                                Transform spawnPoint = poolySpawner.spawnPoints[i].spawnPoint;
                                QUI.SetGUIBackgroundColor(AccentColorBlue);
                                spawnPoint = (Transform)QUI.ObjectField(spawnPoint, typeof(Transform), true, (WIDTH_420 - SPACE_2 - tempContentSize.x - SPACE_8 - SPACE_16 - SPACE_4) - 240 * animBoolRandomSpawnLocation.faded);
                                QUI.ResetColors();
                                if (QUI.IsPersistent(spawnPoint))
                                {
                                    spawnPoint = poolySpawner.spawnPoints[i].spawnPoint;
                                }
                                if (QUI.EndChangeCheck())
                                {
                                    Undo.RecordObject(poolySpawner, "Changed Reference For Spawn Point Slot " + i);
                                    poolySpawner.spawnPoints[i].spawnPoint = spawnPoint;
                                    QUI.SetDirty(poolySpawner);
                                }
                                QUI.BeginVertical(16);
                                {
                                    QUI.Space(SPACE_2);
                                    if (QUI.ButtonMinus())
                                    {
                                        if (poolySpawner.spawnPoints.Count > 1)
                                        {
                                            Undo.RecordObject(poolySpawner, "Removed Spawn Point Slot " + i);
                                            poolySpawner.spawnPoints.RemoveAt(i);
                                        }
                                        else if (poolySpawner.spawnPoints == null || poolySpawner.spawnPoints[0].spawnPoint != null)
                                        {
                                            Undo.RecordObject(poolySpawner, "Reset Spawn Point Slot");
                                            poolySpawner.spawnPoints = new List <PoolySpawner.SpawnPoint> {
                                                new PoolySpawner.SpawnPoint(null)
                                            };
                                        }
                                        QUI.SetDirty(poolySpawner);
                                        QUI.ExitGUI();
                                    }
                                }
                                QUI.EndVertical();
                                animBoolRandomSpawnLocation.target = locationSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random;
                                if (poolySpawner.spawnPoints != null && poolySpawner.spawnPoints.Count > 1 && locationSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random)
                                {
                                    QUI.Space(SPACE_2);
                                    QUI.Label("weight", Style.Text.Small, 40);
                                    QUI.Space(-SPACE_8);
                                    QUI.BeginChangeCheck();
                                    int spawnPointWeight = poolySpawner.spawnPoints[i].weight;
                                    QUI.SetGUIBackgroundColor(AccentColorBlue);
                                    spawnPointWeight = EditorGUILayout.IntSlider(spawnPointWeight, 0, 100);
                                    QUI.ResetColors();
                                    if (QUI.EndChangeCheck())
                                    {
                                        Undo.RecordObject(poolySpawner, "Changed Weight Of Spawn Point " + i);
                                        poolySpawner.spawnPoints[i].weight = spawnPointWeight;
                                    }
                                }
                                QUI.FlexibleSpace();
                                QUI.Space(SPACE_8);
                            }
                            QUI.EndHorizontal();
                            QUI.Space(1);
                        }
                        QUI.Space(SPACE_2);
                        QUI.BeginHorizontal(WIDTH_420);
                        {
                            QUI.FlexibleSpace();
                            if (QUI.ButtonPlus())
                            {
                                Undo.RecordObject(poolySpawner, "Added Spawn Point Slot");
                                poolySpawner.spawnPoints.Add(new PoolySpawner.SpawnPoint(null));
                                QUI.SetDirty(poolySpawner);
                                QUI.ExitGUI();
                            }
                            QUI.Space(3 + 240 * animBoolRandomSpawnLocation.faded);
                        }
                        QUI.EndHorizontal();
                        break;
                    }
                }
                QUI.EndVertical();
            }
            QUI.EndFadeGroup();
        }
        void DrawPageAnimatorPresetsPunchData(DUIData.PunchDatabase database, string relativePath, float width)
        {
            if (database == null || database.categories == null || database.categories.Count == 0)
            {
                //ToDo - draw info message telling the dev that the database is empty
                return;
            }

            for (int categoryIndex = 0; categoryIndex < database.categories.Count; categoryIndex++)
            {
                if (QUI.GhostBar(database.categories[categoryIndex].categoryName, QColors.Color.Blue, database.categories[categoryIndex].isExpanded, width, ANIMATOR_PRESETS_CATEGORY_BAR_HEIGHT))
                {
                    database.categories[categoryIndex].isExpanded.target = !database.categories[categoryIndex].isExpanded.target;
                    database.categories[categoryIndex].ExpandOrCollapseAllAnimData(false);
                }
                QUI.BeginHorizontal(width);
                {
                    QUI.Space(SPACE_8 * database.categories[categoryIndex].isExpanded.faded);
                    if (QUI.BeginFadeGroup(database.categories[categoryIndex].isExpanded.faded))
                    {
                        QUI.BeginVertical(width - SPACE_8);
                        {
                            QUI.Space(SPACE_2);
                            for (int presetIndex = 0; presetIndex < database.categories[categoryIndex].presets.Count; presetIndex++)
                            {
                                QUI.BeginHorizontal(width - SPACE_8);
                                {
                                    if (DUIUtils.PresetGhostBar(database.categories[categoryIndex].presets[presetIndex].presetName, QColors.Color.Blue, database.categories[categoryIndex].presets[presetIndex].isExpanded, width - SPACE_8 - SPACE_2 - SPACE_16, ANIMATOR_PRESETS_PRESET_BAR_HEIGHT))
                                    {
                                        database.categories[categoryIndex].presets[presetIndex].isExpanded.target = !database.categories[categoryIndex].presets[presetIndex].isExpanded.target;
                                    }
                                    QUI.Space(SPACE_2);
                                    if (QUI.ButtonCancel())
                                    {
                                        if (QUI.DisplayDialog("Delete the '" + database.categories[categoryIndex].presets[presetIndex].presetName + "' preset?",
                                                              "Are you sure you want to delete this preset?" +
                                                              "\n\n" +
                                                              "Operation cannot be undone!",
                                                              "Yes",
                                                              "No"))
                                        {
                                            database.categories[categoryIndex].DeletePunchData(database.categories[categoryIndex].presets[presetIndex].presetName, relativePath + database.categories[categoryIndex].categoryName + "/");
                                            if (database.categories[categoryIndex].presets.Count == 0) //category is empty -> remove it
                                            {
                                                database.RemoveCategory(database.categories[categoryIndex].categoryName, relativePath, true);
                                            }
                                            QUI.ExitGUI();
                                        }
                                    }
                                }
                                QUI.EndHorizontal();
                                QUI.BeginHorizontal(width - SPACE_8);
                                {
                                    QUI.Space(SPACE_8 * database.categories[categoryIndex].presets[presetIndex].isExpanded.faded);
                                    if (QUI.BeginFadeGroup(database.categories[categoryIndex].presets[presetIndex].isExpanded.faded))
                                    {
                                        QUI.BeginVertical(width - SPACE_16);
                                        {
                                            DUIUtils.DrawPunch(database.categories[categoryIndex].presets[presetIndex].data, database.categories[categoryIndex].presets[presetIndex], width - SPACE_16);
                                            QUI.Space(SPACE_8 * database.categories[categoryIndex].presets[presetIndex].isExpanded.faded); //space added if preset is opened
                                        }
                                        QUI.EndVertical();
                                    }
                                    QUI.EndFadeGroup();
                                }
                                QUI.EndHorizontal();
                                QUI.Space(SPACE_4);                                                   //space between presets
                            }
                            QUI.Space(SPACE_4 * database.categories[categoryIndex].isExpanded.faded); //space added if category is opened
                        }
                        QUI.EndVertical();
                    }
                    QUI.EndFadeGroup();
                }
                QUI.EndHorizontal();
                QUI.Space(SPACE_4); //space between categories
            }
        }
        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 DrawArrow(float width)
        {
            QUI.BeginHorizontal(width);
            {
                QUI.QToggle("Show Arrow", showArrow);
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();

            showArrowAnimBool.target = showArrow.boolValue;

            if (QUI.BeginFadeGroup(showArrowAnimBool.faded))
            {
                QUI.BeginVertical(width);
                {
                    QUI.Space(SPACE_2 * showArrowAnimBool.faded);
                    QUI.BeginHorizontal(width);
                    {
                        QUI.QObjectPropertyField("Arrow", arrow, width - 4 - 100, 20, true);
                        QUI.Space(SPACE_4 * showArrowAnimBool.faded);
                        QUI.QObjectPropertyField("Scale", arrowScale, 100, 20, false);
                        QUI.FlexibleSpace();
                    }
                    QUI.EndHorizontal();
                    QUI.BeginHorizontal(width);
                    {
                        QUI.QToggle("Override Arrow Color", overrideArrowColor);
                        QUI.Space(SPACE_2);
                        if (overrideArrowColor.boolValue)
                        {
                            tempFloat = (width - 152) / 2; //color fields width
                            QUI.QObjectPropertyField("Closed", arrowColorWhenClosed, tempFloat, 20, false);
                            QUI.Space(SPACE_2);
                            QUI.QObjectPropertyField("Opened", arrowColorWhenOpened, tempFloat, 20, false);
                        }
                        QUI.FlexibleSpace();
                    }
                    QUI.EndHorizontal();
                    QUI.Space(SPACE_2);
                    QUI.BeginHorizontal(width);
                    {
                        if (QUI.GhostButton("Reset Arrow Holder Pos", QColors.Color.Gray, (width - 4) / 3, 18))
                        {
                            Undo.RecordObject(Drawer.leftDrawerArrowHolder, "Update Arrow Holder");
                            switch (Drawer.drawerCloseDirection)
                            {
                            case Gestures.SimpleSwipe.Left: UIDrawer.ResetArrowHolder(Drawer.leftDrawerArrowHolder, Drawer.drawerCloseDirection); break;

                            case Gestures.SimpleSwipe.Right: UIDrawer.ResetArrowHolder(Drawer.rightDrawerArrowHolder, Drawer.drawerCloseDirection); break;

                            case Gestures.SimpleSwipe.Up: UIDrawer.ResetArrowHolder(Drawer.upDrawerArrowHolder, Drawer.drawerCloseDirection); break;

                            case Gestures.SimpleSwipe.Down: UIDrawer.ResetArrowHolder(Drawer.downDrawerArrowHolder, Drawer.drawerCloseDirection); break;
                            }
                        }
                        QUI.Space(SPACE_2);
                        if (QUI.GhostButton("Reset Closed Arrow Pos", QColors.Color.Gray, (width - 4) / 3, 18))
                        {
                            Undo.RecordObject(Drawer.leftDrawerArrowClosedPosition, "Update Closed Arrow");
                            switch (Drawer.drawerCloseDirection)
                            {
                            case Gestures.SimpleSwipe.Left: UIDrawer.ResetClosedArrow(Drawer.leftDrawerArrowClosedPosition, Drawer.drawerCloseDirection); break;

                            case Gestures.SimpleSwipe.Right: UIDrawer.ResetClosedArrow(Drawer.rightDrawerArrowClosedPosition, Drawer.drawerCloseDirection); break;

                            case Gestures.SimpleSwipe.Up: UIDrawer.ResetClosedArrow(Drawer.upDrawerArrowClosedPosition, Drawer.drawerCloseDirection); break;

                            case Gestures.SimpleSwipe.Down: UIDrawer.ResetClosedArrow(Drawer.downDrawerArrowClosedPosition, Drawer.drawerCloseDirection); break;
                            }
                        }
                        QUI.Space(SPACE_2);
                        if (QUI.GhostButton("Reset Opened Arrow Pos", QColors.Color.Gray, (width - 4) / 3, 18))
                        {
                            Undo.RecordObject(Drawer.leftDrawerArrowOpenedPosition, "Update Opened Arrow");
                            switch (Drawer.drawerCloseDirection)
                            {
                            case Gestures.SimpleSwipe.Left: UIDrawer.ResetOpenedArrow(Drawer.leftDrawerArrowOpenedPosition, Drawer.drawerCloseDirection); break;

                            case Gestures.SimpleSwipe.Right: UIDrawer.ResetOpenedArrow(Drawer.rightDrawerArrowOpenedPosition, Drawer.drawerCloseDirection); break;

                            case Gestures.SimpleSwipe.Up: UIDrawer.ResetOpenedArrow(Drawer.upDrawerArrowOpenedPosition, Drawer.drawerCloseDirection); break;

                            case Gestures.SimpleSwipe.Down: UIDrawer.ResetOpenedArrow(Drawer.downDrawerArrowOpenedPosition, Drawer.drawerCloseDirection); break;
                            }
                        }
                    }
                    QUI.EndHorizontal();
                    QUI.Space(SPACE_2);
                    QUI.BeginHorizontal(width);
                    {
                        if (QUI.GhostButton("Copy - Opened Arrow Position - to - Closed Arrow Position", QColors.Color.Gray, width, 18))
                        {
                            Undo.RecordObject(Drawer.leftDrawerArrowOpenedPosition, "Update Opened Arrow");
                            switch (Drawer.drawerCloseDirection)
                            {
                            case Gestures.SimpleSwipe.Left: UIDrawer.MatchRectTransform(Drawer.leftDrawerArrowClosedPosition, Drawer.leftDrawerArrowOpenedPosition); break;

                            case Gestures.SimpleSwipe.Right: UIDrawer.MatchRectTransform(Drawer.rightDrawerArrowClosedPosition, Drawer.rightDrawerArrowOpenedPosition); break;

                            case Gestures.SimpleSwipe.Up: UIDrawer.MatchRectTransform(Drawer.upDrawerArrowClosedPosition, Drawer.upDrawerArrowOpenedPosition); break;

                            case Gestures.SimpleSwipe.Down: UIDrawer.MatchRectTransform(Drawer.downDrawerArrowClosedPosition, Drawer.downDrawerArrowOpenedPosition); break;
                            }
                        }
                    }
                    QUI.EndHorizontal();
                    QUI.Space(SPACE_2);
                    QUI.BeginHorizontal(width);
                    {
                        if (QUI.GhostButton("Copy - Closed Arrow Position - to - Opened Arrow Position", QColors.Color.Gray, width, 18))
                        {
                            Undo.RecordObject(Drawer.leftDrawerArrowClosedPosition, "Update Closed Arrow");
                            switch (Drawer.drawerCloseDirection)
                            {
                            case Gestures.SimpleSwipe.Left: UIDrawer.MatchRectTransform(Drawer.leftDrawerArrowOpenedPosition, Drawer.leftDrawerArrowClosedPosition); break;

                            case Gestures.SimpleSwipe.Right: UIDrawer.MatchRectTransform(Drawer.rightDrawerArrowOpenedPosition, Drawer.rightDrawerArrowClosedPosition); break;

                            case Gestures.SimpleSwipe.Up: UIDrawer.MatchRectTransform(Drawer.upDrawerArrowOpenedPosition, Drawer.upDrawerArrowClosedPosition); break;

                            case Gestures.SimpleSwipe.Down: UIDrawer.MatchRectTransform(Drawer.downDrawerArrowOpenedPosition, Drawer.downDrawerArrowClosedPosition); break;
                            }
                        }
                    }
                    QUI.EndHorizontal();
                    QUI.Space(SPACE_2);
                    if (QUI.GhostBar("Show Arrow References", showArrowReferences.target ? QColors.Color.Blue : QColors.Color.Gray, showArrowReferences, width * showArrowAnimBool.faded, MiniBarHeight))
                    {
                        showArrowReferences.target = !showArrowReferences.target;
                    }
                    QUI.BeginHorizontal(width);
                    {
                        QUI.Space(SPACE_8 * showArrowReferences.faded);
                        if (QUI.BeginFadeGroup(showArrowReferences.faded))
                        {
                            QUI.BeginVertical(width - SPACE_8);
                            {
                                QUI.Space(SPACE_4 * showArrowReferences.faded);
                                QUI.QObjectPropertyField("Arrow Container", arrowContainer, width - SPACE_8, 20, true);
                                QUI.Space(SPACE_2 * showArrowReferences.faded);
                                DrawArrowHolder("Left", leftDrawerArrowHolder, leftDrawerArrowClosedPosition, leftDrawerArrowOpenedPosition, width);
                                QUI.Space(SPACE_2 * showArrowReferences.faded);
                                DrawArrowHolder("Right", rightDrawerArrowHolder, rightDrawerArrowClosedPosition, rightDrawerArrowOpenedPosition, width);
                                QUI.Space(SPACE_2 * showArrowReferences.faded);
                                DrawArrowHolder("Up", upDrawerArrowHolder, upDrawerArrowClosedPosition, upDrawerArrowOpenedPosition, width);
                                QUI.Space(SPACE_2 * showArrowReferences.faded);
                                DrawArrowHolder("Down", downDrawerArrowHolder, downDrawerArrowClosedPosition, downDrawerArrowOpenedPosition, width);
                                QUI.Space(SPACE_2 * showArrowReferences.faded);
                            }
                            QUI.EndVertical();
                        }
                        QUI.EndFadeGroup();
                    }
                    QUI.EndHorizontal();
                    QUI.Space(SPACE_2 * showArrowAnimBool.faded);
                }
                QUI.EndVertical();
            }
            QUI.EndFadeGroup();
        }
 void DrawEvents(float width)
 {
     if (QUI.GhostBar("Unity Events", IsAnyEventUsed ? QColors.Color.Blue : QColors.Color.Gray, showEvents, width, MiniBarHeight))
     {
         showEvents.target = !showEvents.target;
     }
     QUI.BeginHorizontal(width);
     {
         QUI.Space(SPACE_8 * showEvents.faded);
         if (QUI.BeginFadeGroup(showEvents.faded))
         {
             QUI.BeginVertical(width - SPACE_16);
             {
                 QUI.Space(SPACE_2 * showEvents.faded);
                 QUI.SetGUIBackgroundColor(IsUsingOnDrawerOpened ? QUI.AccentColorBlue : QUI.AccentColorGray);
                 QUI.PropertyField(OnDrawerOpened, new GUIContent()
                 {
                     text = "OnDrawerOpened"
                 }, width - 8);
                 QUI.ResetColors();
                 QUI.Space(SPACE_2 * showEvents.faded);
                 QUI.SetGUIBackgroundColor(IsUsingOnDrawerClosed ? QUI.AccentColorBlue : QUI.AccentColorGray);
                 QUI.PropertyField(OnDrawerClosed, new GUIContent()
                 {
                     text = "OnDrawerClosed"
                 }, width - 8);
                 QUI.ResetColors();
                 QUI.Space(SPACE_4 * showEvents.faded);
                 QUI.SetGUIBackgroundColor(IsUsingOnDrawerIsOpening ? QUI.AccentColorBlue : QUI.AccentColorGray);
                 QUI.PropertyField(OnDrawerIsOpening, new GUIContent()
                 {
                     text = "OnDrawerIsOpening"
                 }, width - 8);
                 QUI.ResetColors();
                 QUI.Space(SPACE_2 * showEvents.faded);
                 QUI.SetGUIBackgroundColor(IsUsingOnDrawerIsClosing ? QUI.AccentColorBlue : QUI.AccentColorGray);
                 QUI.PropertyField(OnDrawerIsClosing, new GUIContent()
                 {
                     text = "OnDrawerIsClosing"
                 }, width - 8);
                 QUI.ResetColors();
                 QUI.Space(SPACE_4 * showEvents.faded);
                 QUI.SetGUIBackgroundColor(IsUsingOnDrawerBeginDrag ? QUI.AccentColorBlue : QUI.AccentColorGray);
                 QUI.PropertyField(OnDrawerBeginDrag, new GUIContent()
                 {
                     text = "OnDrawerBeginDrag"
                 }, width - 8);
                 QUI.ResetColors();
                 QUI.Space(SPACE_2 * showEvents.faded);
                 QUI.SetGUIBackgroundColor(IsUsingOnDrawerEndDrag ? QUI.AccentColorBlue : QUI.AccentColorGray);
                 QUI.PropertyField(OnDrawerEndDrag, new GUIContent()
                 {
                     text = "OnDrawerEndDrag"
                 }, width - 8);
                 QUI.ResetColors();
                 QUI.Space(SPACE_8 * showEvents.faded);
             }
             QUI.EndVertical();
             QUI.ResetColors();
         }
         QUI.EndFadeGroup();
     }
     QUI.EndHorizontal();
 }
示例#18
0
        private void DrawOnSpawnEvents()
        {
            QUI.Space(SPACE_8);
            QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Purple), WIDTH_420, 40);
            QUI.Space(-40);
            QUI.BeginHorizontal(WIDTH_420);
            {
                QUI.Space(SPACE_4);
                QUI.Label("回调事件", Style.Text.Title, 240, HEIGHT_16);
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();
            QUI.BeginHorizontal(WIDTH_420);
            {
                QUI.Space(SPACE_8 + 3);
                QUI.Toggle(showOnSpawnStarted);
                QUI.Space(-SPACE_2);
                tempContent.text = "Started";
                QUI.Label(tempContent.text, Style.Text.Small, QStyles.CalcSize(tempContent, Style.Text.Small).x);


                QUI.Space(SPACE_8);

                QUI.Toggle(showOnSpawnStopped);
                QUI.Space(-SPACE_2);
                tempContent.text = "Stopped";
                QUI.Label(tempContent.text, Style.Text.Small, QStyles.CalcSize(tempContent, Style.Text.Small).x);

                QUI.Space(SPACE_8);

                QUI.Toggle(showOnSpawnPaused);
                QUI.Space(-SPACE_2);
                tempContent.text = "Paused";
                QUI.Label(tempContent.text, Style.Text.Small, QStyles.CalcSize(tempContent, Style.Text.Small).x);

                QUI.Space(SPACE_8);

                QUI.Toggle(showOnSpawnResumed);
                QUI.Space(-SPACE_2);
                tempContent.text = "Resumed";
                QUI.Label(tempContent.text, Style.Text.Small, QStyles.CalcSize(tempContent, Style.Text.Small).x);

                QUI.Space(SPACE_8);

                QUI.Toggle(showOnSpawnFinished);
                QUI.Space(-SPACE_2);
                tempContent.text = "Finished";
                QUI.Label(tempContent.text, Style.Text.Small, QStyles.CalcSize(tempContent, Style.Text.Small).x);

                QUI.Space(SPACE_8);

                QUI.ResetColors();
            }
            QUI.EndHorizontal();
            if (showOnSpawnStarted.boolValue || showOnSpawnPaused.boolValue || showOnSpawnFinished.boolValue)
            {
                QUI.Space(SPACE_4);
            }
            QUI.SetGUIBackgroundColor(AccentColorPurple);
            animBoolShowOnSpawnStarted.target = showOnSpawnStarted.boolValue;
            if (QUI.BeginFadeGroup(animBoolShowOnSpawnStarted.faded))
            {
                QUI.PropertyField(OnSpawnStarted, new GUIContent("OnSpawnStarted"), WIDTH_420 - 5);
            }
            QUI.EndFadeGroup();
            animBoolShowOnSpawnStopped.target = showOnSpawnStopped.boolValue;
            if (QUI.BeginFadeGroup(animBoolShowOnSpawnStopped.faded))
            {
                QUI.PropertyField(OnSpawnStopped, new GUIContent("OnSpawnStopped"), WIDTH_420 - 5);
            }
            QUI.EndFadeGroup();
            animBoolShowOnSpawnPaused.target = showOnSpawnPaused.boolValue;
            if (QUI.BeginFadeGroup(animBoolShowOnSpawnPaused.faded))
            {
                QUI.PropertyField(OnSpawnPaused, new GUIContent("OnSpawnPaused"), WIDTH_420 - 5);
            }
            QUI.EndFadeGroup();
            animBoolShowOnSpawnResumed.target = showOnSpawnResumed.boolValue;
            if (QUI.BeginFadeGroup(animBoolShowOnSpawnResumed.faded))
            {
                QUI.PropertyField(OnSpawnResumed, new GUIContent("OnSpawnResumed"), WIDTH_420 - 5);
            }
            QUI.EndFadeGroup();
            animBoolShowOnSpawnFinished.target = showOnSpawnFinished.boolValue;
            if (QUI.BeginFadeGroup(animBoolShowOnSpawnFinished.faded))
            {
                QUI.PropertyField(OnSpawnFinished, new GUIContent("OnSpawnfinished"), WIDTH_420 - 5);
            }
            QUI.EndFadeGroup();
            QUI.ResetColors();
        }
        void DrawUIElementsDatabase()
        {
            QUI.DrawTexture(DUIResources.headerUIElementsDatabase.texture, 552, 64);
            float sectionWidth = PAGE_WIDTH - SIDE_BAR_SHADOW_WIDTH * 2;

            QUI.BeginHorizontal(sectionWidth);
            {
                #region New Category
                if (!NewCategoryAnimBool.value)
                {
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonNewCategory), 100 * (1 - SearchPatternAnimBool.faded), 20))
                    {
                        NewCategoryName              = "";
                        NewCategoryAnimBool.target   = true;
                        SearchPatternAnimBool.target = false;
                        foreach (string category in UIElementsDatabaseAnimBool.Keys)
                        {
                            UIElementsDatabaseAnimBool[category].target = false;
                        }
                    }
                }
                else
                {
                    SearchPatternAnimBool.target = false;
                    QUI.DrawTexture(DUIResources.pageButtonNewCategory.active, 100, 20);
                    QUI.Space(80);
                    SaveColors();
                    QUI.SetGUIBackgroundColor(DUIColors.GreenLight.Color);
                    NewCategoryName = EditorGUILayout.TextField(NewCategoryName, GUILayout.Width((sectionWidth - 149) * NewCategoryAnimBool.faded));
                    RestoreColors();
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonOk), 20, 20))
                    {
                        if (string.IsNullOrEmpty(NewCategoryName))
                        {
                            EditorUtility.DisplayDialog("Info", "Cannot create an unnamed category. Try again.", "Ok");
                        }
                        else if (DUI.UIElementCategoryExists(NewCategoryName))
                        {
                            EditorUtility.DisplayDialog("Info", "A category named '" + NewCategoryName + "' already exists in the database. Try again.", "Ok");
                        }
                        else
                        {
                            DUI.CreateUIElementsCategory(NewCategoryName);
                            NewCategoryAnimBool.target = false;
                            RefreshUIElementsDatabase(true);
                        }
                    }
                    QUI.Space(1);
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonCancel), 20, 20))
                    {
                        NewCategoryName            = "";
                        NewCategoryAnimBool.target = false;
                    }
                }
                #endregion
                QUI.Space(342 * (1 - NewCategoryAnimBool.faded) * (1 - SearchPatternAnimBool.faded));
                #region Search
                if (!SearchPatternAnimBool.value)
                {
                    QUI.FlexibleSpace();
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonSearch), 100 * (1 - NewCategoryAnimBool.faded), 20))
                    {
                        SearchPattern = string.Empty;
                        SearchPatternAnimBool.target = true;
                        NewCategoryAnimBool.target   = false;
                        foreach (string category in UIElementsDatabaseAnimBool.Keys)
                        {
                            UIElementsDatabaseAnimBool[category].target = true;
                        }
                    }
                }
                else
                {
                    NewCategoryAnimBool.target = false;
                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonClearSearch), 100 * SearchPatternAnimBool.faded, 20))
                    {
                        SearchPattern = string.Empty;
                        SearchPatternAnimBool.target = false;
                        foreach (string category in UIElementsDatabaseAnimBool.Keys)
                        {
                            UIElementsDatabaseAnimBool[category].target = false;
                        }
                    }
                    GUILayout.Space(1);
                    SaveColors();
                    QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color);
                    SearchPattern = EditorGUILayout.TextField(SearchPattern, GUILayout.Width((sectionWidth - 210) * SearchPatternAnimBool.faded));
                    RestoreColors();
                    QUI.DrawTexture(DUIResources.pageButtonSearch.active, 100, 20);
                }
                #endregion
            }
            QUI.EndHorizontal();
            QUI.Space(16);
            if (UIElementsDatabaseAnimBool.Keys.Count == 0)
            {
                QUI.DrawTexture(DUIResources.pageImageEmptyDatabase.texture, 552, 256);
                QUI.BeginHorizontal(sectionWidth);
                {
                    QUI.FlexibleSpace();
                    QUI.Label("Add a new category to get started...", DUIStyles.GetStyle(DUIStyles.BlackTextStyle.BlackLabelNormalItalic));
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
                return;
            }

            foreach (string category in DUI.UIElementsDatabase.Keys)
            {
                QUI.BeginHorizontal(sectionWidth);
                {
                    #region Button Bar
                    if (ButtonBar(category + (SearchPatternAnimBool.target ? "*" : ""), UIElementsDatabaseAnimBool[category], (sectionWidth - 203 * UIElementsDatabaseAnimBool[category].faded * (1 - SearchPatternAnimBool.faded))))
                    {
                        UIElementsDatabaseAnimBool[category].target = !UIElementsDatabaseAnimBool[category].target;
                    }

                    QUI.Space(-7);

                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonSortAtoZ), 100 * UIElementsDatabaseAnimBool[category].faded * (1 - SearchPatternAnimBool.faded), 20))
                    {
                        DUI.UIElementsDatabase[category].RemoveEmpty();
                        DUI.UIElementsDatabase[category].Sort();
                    }

                    QUI.Space(1);

                    if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonDelete), 100 * UIElementsDatabaseAnimBool[category].faded * (1 - SearchPatternAnimBool.faded), 20))
                    {
                        if (EditorUtility.DisplayDialog("Delete the '" + category + "' category?", "Are you sure you want to proceed?\nOperation cannot be undone!", "Yes", "Cancel"))
                        {
                            DUI.DeleteUIElementsCategory(category);
                            RefreshUIElementsDatabase(true);
                            QUI.EndHorizontal();
                            break;
                        }
                    }
                    #endregion
                }
                QUI.EndHorizontal();
                if (!UIElementsDatabaseAnimBool.ContainsKey(category))
                {
                    RefreshUIElementsDatabase(true);
                }
                else
                {
                    if (QUI.BeginFadeGroup(UIElementsDatabaseAnimBool[category].faded))
                    {
                        QUI.BeginChangeCheck();
                        {
                            if (DUI.UIElementsDatabase[category] == null)
                            {
                                RefreshUIElementsDatabase();
                            }
                            else
                            {
                                DrawNamesList(DUI.UIElementsDatabase[category].data, PAGE_WIDTH - 200, "Category is empty...");
                            }
                        }
                        if (QUI.EndChangeCheck())
                        {
                            if (DUI.UIElementsDatabase[category] == null)
                            {
                                RefreshUIElementsDatabase();
                            }
                            else
                            {
                                EditorUtility.SetDirty(DUI.UIElementsDatabase[category]);
                            }
                        }
                        QUI.Space(8);
                    }
                    QUI.EndFadeGroup();
                }
                QUI.Space(2);
            }
        }
示例#20
0
        private void DrawMainSettings()
        {
            QUI.BeginHorizontal(WIDTH_420);
            {
                QUI.SetGUIBackgroundColor(AccentColorOrange);
                switch (autoStart.enumValueIndex)
                {
                case (int)PoolySpawner.AutoStart.Start:
                    tempContent.text = "自动产生:Start 调用  ";
                    break;

                case (int)PoolySpawner.AutoStart.OnSpawned:
                    tempContent.text = "自动产生:OnSpawned 调用";

                    break;

                case (int)PoolySpawner.AutoStart.Never:
                    tempContent.text = "不自动产生,使用代码产生 ";
                    break;
                }
                QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                QUI.Popup(autoStart, 86);
                QUI.FlexibleSpace();
                if (autoStart.enumValueIndex != (int)PoolySpawner.AutoStart.Never)
                {
                    tempContent.text = "延迟";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.PropertyField(spawnStartDelay, 40);
                    if (spawnStartDelay.floatValue < 0)
                    {
                        spawnStartDelay.floatValue = 0;
                    }
                    tempContent.text = "秒";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                }
                QUI.ResetColors();
            }
            QUI.EndHorizontal();
            QUI.Space(SPACE_4 * infoMessage["AutoStartNever"].show.faded);
            animBoolDespawnWhenFinished.target = autoStart.enumValueIndex == (int)PoolySpawner.AutoStart.OnSpawned;
            if (QUI.BeginFadeGroup(animBoolDespawnWhenFinished.faded))
            {
                QUI.BeginHorizontal(WIDTH_420);
                {
                    QUI.SetGUIBackgroundColor(AccentColorOrange);
                    QUI.Toggle(despawnWhenFinished);
                    QUI.ResetColors();
                    QUI.Label("调用“Despawn” 当完成发射", Style.Text.Normal, WIDTH_420);
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
            }
            QUI.EndFadeGroup();
            QUI.BeginHorizontal(WIDTH_420);
            {
                if (!spawnForever.boolValue)
                {
                    tempContent.text = "产生数量   ";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.SetGUIBackgroundColor(AccentColorOrange);
                    QUI.PropertyField(spawnCount, 90);
                    QUI.ResetColors();
                    if (spawnCount.intValue < 0)
                    {
                        spawnCount.intValue = 0;
                    }
                    QUI.FlexibleSpace();
                }
                QUI.SetGUIBackgroundColor(QColors.OrangeLight.Color);
                QUI.Toggle(spawnForever);
                QUI.ResetColors();
                tempContent.text = "是否一直循环产生";
                QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();

            // 固定间隔 还是随机间隔
            QUI.Space(SPACE_4 * infoMessage["SpawnForever"].show.faded);
            QUI.BeginHorizontal(WIDTH_420);
            {
                QUI.SetGUIBackgroundColor(AccentColorOrange);
                if (spawnAtRandomIntervals.boolValue)
                {
                    QUI.Toggle(spawnAtRandomIntervals);
                    tempContent.text = "随机产生:";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.Space(20);
                    tempContent.text = "Min";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.PropertyField(spawnAtRandomIntervalMinimum, 40);
                    if (spawnAtRandomIntervalMinimum.floatValue < 0)
                    {
                        spawnAtRandomIntervalMinimum.floatValue = 0;
                    }
                    QUI.Label("-", Style.Text.Normal, 8);
                    tempContent.text = "Max";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.PropertyField(spawnAtRandomIntervalMaximum, 40);
                    if (spawnAtRandomIntervalMaximum.floatValue < spawnAtRandomIntervalMinimum.floatValue)
                    {
                        spawnAtRandomIntervalMaximum.floatValue = spawnAtRandomIntervalMinimum.floatValue;
                    }
                    tempContent.text = "秒";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                }
                else
                {
                    tempContent.text = "Spawn Every";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.PropertyField(spawnInterval, 56);
                    tempContent.text = "秒";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.Space(45);
                    QUI.Toggle(spawnAtRandomIntervals);
                    tempContent.text = "使用随机时间间隔";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                }
                QUI.ResetColors();
            }
            QUI.EndHorizontal();

            if (useSpawnerAsSpawnLocation.boolValue ||
                (!useSpawnerAsSpawnLocation.boolValue && poolySpawner.spawnAt == PoolySpawner.SpawnAt.Transform))
            {
                QUI.SetGUIBackgroundColor(AccentColorOrange);
                QUI.BeginHorizontal(WIDTH_420);
                {
                    tempContent.text = "额外的 Spawn 设置";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                }
                QUI.EndHorizontal();

                QUI.BeginHorizontal(WIDTH_420);
                {
                    QUI.Space(SPACE_8);
                    QUI.Toggle(matchTransformRotation);
                    tempContent.text = "匹配 " + (useSpawnerAsSpawnLocation.boolValue ? "Spawner" : "Target") + " Transform Rotation";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
                QUI.BeginHorizontal(WIDTH_420);
                {
                    QUI.Space(SPACE_8);
                    QUI.Toggle(matchTransformScale);
                    tempContent.text = "匹配 " + (useSpawnerAsSpawnLocation.boolValue ? "Spawner" : "Target") + " Transform Scale";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
                QUI.BeginHorizontal(WIDTH_420);
                {
                    QUI.Space(SPACE_8);
                    QUI.Toggle(reparentUnderTransform);
                    tempContent.text = "重新设置父级 " + (useSpawnerAsSpawnLocation.boolValue ? "Spawner" : "Target") + " Transform";
                    QUI.Label(tempContent.text, Style.Text.Normal, QStyles.CalcSize(tempContent, Style.Text.Normal).x);
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
                QUI.ResetColors();
            }
        }