Ejemplo n.º 1
0
        private static List <GUIStyle> GeneralStyles()
        {
            List <GUIStyle> styles = new List <GUIStyle>
            {
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonCollapseSideBar), EZResources.sideButtonCollapseSideBar, QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(2, 28, 2, 2), new RectOffset(2, 32, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonExpandSideBar), EZResources.sideButtonExpandSideBar, QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(2, 28, 2, 2), new RectOffset(2, 32, 2, 4)),

                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonControlPanel), EZResources.sideButtonControlPanel, QUI.IsProSkin ? QColors.BlueLight.Color : QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonDefineSymbols), EZResources.sideButtonDefineSymbols, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonDataManager), EZResources.sideButtonDataManager, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonDataBind), EZResources.sideButtonDataBind, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonPooly), EZResources.sideButtonPooly, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonAdsManager), EZResources.sideButtonAdsManager, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonHelpBtnHelp), EZResources.sideButtonHelp, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonAbout), EZResources.sideButtonAbout, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),

                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonTwitter), EZResources.sideButtonTwitter, ColorExtensions.ColorFrom256(128, 128, 128), ColorExtensions.ColorFrom256(242, 242, 242), ColorExtensions.ColorFrom256(0, 153, 209), new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4), 14),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonFacebook), EZResources.sideButtonFacebook, ColorExtensions.ColorFrom256(128, 128, 128), ColorExtensions.ColorFrom256(242, 242, 242), ColorExtensions.ColorFrom256(74, 112, 186), new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4), 14),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonYoutube), EZResources.sideButtonYoutube, ColorExtensions.ColorFrom256(128, 128, 128), ColorExtensions.ColorFrom256(242, 242, 242), ColorExtensions.ColorFrom256(255, 102, 102), new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4), 14),

                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelectedControlPanel), EZResources.sideButtonControlPanelSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelectedDefineSymbols), EZResources.sideButtonDefineSymbolsSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelectedDataManager), EZResources.sideButtonDataManagerSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelectedDataBind), EZResources.sideButtonDataBindSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelectedPooly), EZResources.sideButtonPoolySelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelectedAdsManager), EZResources.sideButtonAdsManagerSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelectedHelpBtnHelp), EZResources.sideButtonHelpSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelectedAbout), EZResources.sideButtonAboutSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
            };

            return(styles);
        }
        void DrawPageHeader(string title, QColor titleColor, string subtitle, QColor subtitleColor, QTexture iconQTexture)
        {
            QUI.Space(SPACE_2);
            QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Gray), WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth, WindowSettings.pageHeaderHeight);
            QUI.Space(-WindowSettings.pageHeaderHeight + (WindowSettings.pageHeaderHeight - WindowSettings.pageHeaderHeight * 0.8f) / 2);
            QUI.BeginHorizontal(WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth, WindowSettings.pageHeaderHeight * 0.8f);
            {
                QUI.Space((WindowSettings.pageHeaderHeight - WindowSettings.pageHeaderHeight * 0.8f));
                QUI.BeginVertical((WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth) / 2, WindowSettings.pageHeaderHeight * 0.8f);
                {
                    QUI.FlexibleSpace();
                    if (!title.IsNullOrEmpty())
                    {
                        QUI.Space(-SPACE_2);
                        QUI.SetGUIColor(titleColor.Color);
                        QUI.Label(title, PageHeaderTitleStyle, (WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth) / 2, 26);
                        QUI.ResetColors();
                    }

                    if (!subtitle.IsNullOrEmpty())
                    {
                        QUI.Space(-SPACE_2);
                        QUI.SetGUIColor(subtitleColor.Color);
                        QUI.Label(subtitle, PageHeaderSubtitleStyle, (WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth) / 2, 18);
                        QUI.ResetColors();
                    }
                    QUI.FlexibleSpace();
                }
                QUI.EndVertical();
                QUI.FlexibleSpace();
                QUI.DrawTexture(iconQTexture.texture, WindowSettings.pageHeaderHeight * 0.8f, WindowSettings.pageHeaderHeight * 0.8f);
                QUI.Space((WindowSettings.pageHeaderHeight - WindowSettings.pageHeaderHeight * 0.8f) / 2);
            }
            QUI.EndHorizontal();
        }
        void DrawTargetParticleSystem(float width)
        {
            QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, uiEffect.targetParticleSystem == null ? QColors.Color.Red : QColors.Color.Blue), width, 20);
            QUI.Space(-20);

            QLabel.text  = "Target ParticleSystem";
            QLabel.style = Style.Text.Normal;

            QUI.BeginHorizontal(width);
            {
                QUI.Space(SPACE_4);
                QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight);
                {
                    QUI.Label(QLabel);
                    QUI.Space(1);
                }
                QUI.EndVertical();
                QUI.PropertyField(targetParticleSystem, width - QLabel.x - 20);
                QUI.FlexibleSpace();
                QUI.Space(SPACE_8);
            }
            QUI.EndHorizontal();

            infoMessage["ParticleSystemDisabled"].show.target = uiEffect.targetParticleSystem == null;
            DrawInfoMessage("ParticleSystemDisabled", GlobalWidth);

            QUI.Space(SPACE_4 * infoMessage["ParticleSystemDisabled"].show.faded);
        }
Ejemplo n.º 4
0
        private static List <GUIStyle> GeneralStyles()
        {
            List <GUIStyle> styles = new List <GUIStyle>
            {
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonCollapseSideBar), EZResources.sideButtonCollapseSideBar, QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(2, 28, 2, 2), new RectOffset(2, 32, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonExpandSideBar), EZResources.sideButtonExpandSideBar, QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(2, 28, 2, 2), new RectOffset(2, 32, 2, 4)),

                GetSideButtonStyle(QStyles.GetStyleName(General.SideButton1), EZResources.sideButtonControlPanel, QUI.IsProSkin ? QColors.BlueLight.Color : QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButton2), EZResources.sideButtonDefineSymbols, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButton3), EZResources.sideButtonDataManager, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButton4), EZResources.sideButtonDataBind, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButton5), EZResources.sideButtonPooly, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButton6), EZResources.sideButtonAdsManager, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButton7), EZResources.sideButtonHelp, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButton8), EZResources.sideButtonAbout, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),

                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonTwitter), EZResources.sideButtonTwitter, MyColor.GetColor(128, 128, 128), MyColor.GetColor(242, 242, 242), MyColor.GetColor(0, 153, 209), new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4), 14),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonBlue), EZResources.sideButtonFacebook, MyColor.GetColor(128, 128, 128), MyColor.GetColor(242, 242, 242), MyColor.GetColor(74, 112, 186), new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4), 14),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonRed), EZResources.sideButtonYoutube, MyColor.GetColor(128, 128, 128), MyColor.GetColor(242, 242, 242), MyColor.GetColor(255, 102, 102), new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4), 14),



                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelected1), EZResources.sideButtonControlPanelSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelected2), EZResources.sideButtonDefineSymbolsSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelected3), EZResources.sideButtonDataManagerSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelected4), EZResources.sideButtonDataBindSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelected5), EZResources.sideButtonPoolySelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelected6), EZResources.sideButtonAdsManagerSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelected7), EZResources.sideButtonHelpSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelected8), EZResources.sideButtonAboutSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
            };

            return(styles);
        }
Ejemplo n.º 5
0
 void DrawNewsArticle(List <NewsArticleData> articles, int index, Object targetObject, bool showDeleteButton, float width)
 {
     QLabel.text  = articles[index].title;
     QLabel.style = Style.Text.Subtitle;
     QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Gray), width, 20);
     QUI.Space(-20);
     QUI.BeginHorizontal(width);
     {
         QUI.Space(6);
         QUI.Label(QLabel);
         QUI.FlexibleSpace();
         if (showDeleteButton)
         {
             if (QUI.ButtonMinus())
             {
                 if (QUI.DisplayDialog("Delete Article", "Delete the '" + QLabel.text + "' article?", "Ok", "Cancel"))
                 {
                     articles.RemoveAt(index);
                     QUI.SetDirty(targetObject);
                     AssetDatabase.SaveAssets();
                     QUI.ExitGUI();
                 }
             }
         }
         QUI.Space(SPACE_4);
     }
     QUI.EndHorizontal();
     QLabel.text  = articles[index].content;
     QLabel.style = Style.Text.Normal;
     QUI.Space(-8 + (showDeleteButton ? 2 : 0));
     EditorGUILayout.LabelField(articles[index].content, QStyles.GetInfoMessageMessageStyle(Style.InfoMessage.Help), GUILayout.Width(width));
     QUI.Space(SPACE_4);
 }
Ejemplo n.º 6
0
        void DrawOrientation(float width)
        {
            QStyles.GetStyle(QStyles.GetStyleName(Style.GhostButton.Purple)).alignment = TextAnchor.MiddleRight;
            if (QUI.GhostButton("update orientation", QColors.Color.Purple, width, 32, 10))
            {
                UpdateOrientationInEditMode();
            }
            QStyles.GetStyle(QStyles.GetStyleName(Style.GhostButton.Purple)).alignment = TextAnchor.MiddleCenter;

            QUI.Space(-32);

            switch (orientationManager.CurrentOrientation)
            {
            case OrientationManager.Orientation.Landscape: QUI.DrawTexture(DUIResources.miniIconOrientationLandscape.texture, 160, 32); break;

            case OrientationManager.Orientation.Portrait: QUI.DrawTexture(DUIResources.miniIconOrientationPortrait.texture, 160, 32); break;

            case OrientationManager.Orientation.Unknown: QUI.DrawTexture(DUIResources.miniIconOrientationUnknown.texture, 160, 32); break;
            }

            QUI.Space(SPACE_2);

            QUI.SetGUIBackgroundColor(QUI.AccentColorPurple);
            QUI.PropertyField(onOrientationChange, true, new GUIContent("OnOrientationChange"), width);
            QUI.ResetColors();
        }
Ejemplo n.º 7
0
 private void DrawRightPage(Texture text, [NotNull] Action page, bool isBox, Action nextButton)  // 画任意 右边页面都使用这个
 {
     QUI.Space(5);
     if (isNeedTu)
     {
         QUI.DrawTexture(text, mWindowSettings.CurrentPageContentWidth, 620);
         QUI.Space(-620);
     }
     QUI.Space(2);
     if (isBox)
     {
         MyCreate.Box(page);
     }
     else
     {
         MyCreate.Box_Hei(page);
     }
     MyCreate.AddSpace();
     if (null != nextButton)
     {
         MyCreate.Heng(() =>
         {
             MyCreate.AddSpace();
             if (GUILayout.Button("", QStyles.GetStyle(Style.LinkButton.Unity), GUILayout.Width(80), GUILayout.Height(20)))
             {
                 nextButton();
             }
         });
     }
 }
        void DrawSettings(float width)
        {
            QUI.Space(SPACE_2);
            QUI.BeginHorizontal(width);
            {
                QUI.QToggle("play on awake", playOnAwake, 20);
                QUI.FlexibleSpace();

                QUI.QToggle("stop instantly on hide", stopInstantly, 20);
                QUI.FlexibleSpace();

                QLabel.text  = "start delay on show";
                QLabel.style = Style.Text.Normal;
                QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, startDelay.floatValue != 0 ? QColors.Color.Blue : QColors.Color.Gray), 4 + QLabel.x + 40 + 16, 20);
                QUI.Space(-(QLabel.x + 40 + 16));
                QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight);
                {
                    QUI.Space(1);
                    QUI.Label(QLabel);
                }
                QUI.EndVertical();
                QUI.PropertyField(startDelay, 40);
                QUI.Space(SPACE_4);
            }
            QUI.EndHorizontal();
        }
        void DrawPair(string title,
                      string firstLabel, SerializedProperty firstProperty, string firstDefaultValue,
                      string secondLabel, SerializedProperty secondProperty, string secondDefaultValue,
                      float width, bool isSingle = false)
        {
            QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Purple), width, 18);
            QUI.Space(-18);

            QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Purple), width, isSingle ? 42 : 60);
            QUI.Space(isSingle ? -44 : -62);

            QLabel.text  = title;
            QLabel.style = Style.Text.Normal;
            QUI.BeginHorizontal(width);
            {
                QUI.Space(6);
                QUI.Label(QLabel);
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();

            QUI.Space(SPACE_2);

            QUI.BeginHorizontal(width);
            {
                QUI.Space(12);
                QLabel.text  = firstLabel;
                QLabel.style = Style.Text.Small;
                QUI.Label(QLabel);
                QUI.PropertyField(firstProperty);
                if (QUI.ButtonReset())
                {
                    firstProperty.stringValue = firstDefaultValue;
                }
                QUI.Space(6);
            }
            QUI.EndHorizontal();

            if (isSingle)
            {
                return;
            }

            QUI.BeginHorizontal(width);
            {
                QUI.Space(12);
                QLabel.text  = secondLabel;
                QLabel.style = Style.Text.Small;
                QUI.Label(QLabel);
                QUI.PropertyField(secondProperty);
                if (QUI.ButtonReset())
                {
                    secondProperty.stringValue = secondDefaultValue;
                }
                QUI.Space(6);
            }
            QUI.EndHorizontal();
        }
Ejemplo n.º 10
0
        private static List <GUIStyle> SideButtonStyles()
        {
            RectOffset expandCollapseBorder  = new RectOffset(2, 28, 2, 2);
            RectOffset expandCollapsePadding = new RectOffset(2, 32, 2, 4);

            RectOffset border   = new RectOffset(28, 2, 2, 2);
            RectOffset padding  = new RectOffset(32, 2, 2, 2);
            int        fontSize = 16;

            RectOffset socialButtonBorder   = new RectOffset(28, 2, 2, 2);
            RectOffset socialButtonPadding  = new RectOffset(28, 2, 2, 2);
            int        socialButtonFontSize = 12;

            Color normalGray   = QUI.IsProSkin ? QColors.UnityMild.Color : QColors.UnityMild.Color;
            Color activeBlue   = QUI.IsProSkin ? QColors.Blue.Color : QColors.BlueDark.Color;
            Color hoverBlue    = QUI.IsProSkin ? QColors.BlueDark.Color : QColors.BlueDark.Color;
            Color selectedBlue = QUI.IsProSkin ? QColors.BlueLight.Color : QColors.BlueDark.Color;


            return(new List <GUIStyle>()
            {
                SideButtonStyle(QStyles.GetStyleName(SideButton.CollapseSideBar), DUIResources.sideButtonCollapseSideBar, normalGray, activeBlue, hoverBlue, expandCollapseBorder, expandCollapsePadding),
                SideButtonStyle(QStyles.GetStyleName(SideButton.ExpandSideBar), DUIResources.sideButtonExpandSideBar, normalGray, activeBlue, hoverBlue, expandCollapseBorder, expandCollapsePadding),

                SideButtonStyle(QStyles.GetStyleName(SideButton.ControlPanel), DUIResources.sideButtonControlPanel, normalGray, activeBlue, hoverBlue, border, padding, fontSize),
                SideButtonSelectedStyle(QStyles.GetStyleName(SideButton.ControlPanelSelected), DUIResources.sideButtonControlPanelSelected, selectedBlue, border, padding, fontSize),

                SideButtonStyle(QStyles.GetStyleName(SideButton.UIElements), DUIResources.sideButtonUIElements, normalGray, activeBlue, hoverBlue, border, padding, fontSize),
                SideButtonSelectedStyle(QStyles.GetStyleName(SideButton.UIElementsSelected), DUIResources.sideButtonUIElementsSelected, selectedBlue, border, padding, fontSize),

                SideButtonStyle(QStyles.GetStyleName(SideButton.UIButtons), DUIResources.sideButtonUIButtons, normalGray, activeBlue, hoverBlue, border, padding, fontSize),
                SideButtonSelectedStyle(QStyles.GetStyleName(SideButton.UIButtonsSelected), DUIResources.sideButtonUIButtonsSelected, selectedBlue, border, padding, fontSize),

                SideButtonStyle(QStyles.GetStyleName(SideButton.UISounds), DUIResources.sideButtonUISounds, normalGray, activeBlue, hoverBlue, border, padding, fontSize),
                SideButtonSelectedStyle(QStyles.GetStyleName(SideButton.UISoundsSelected), DUIResources.sideButtonUISoundsSelected, selectedBlue, border, padding, fontSize),

                SideButtonStyle(QStyles.GetStyleName(SideButton.UICanvases), DUIResources.sideButtonUICanvases, normalGray, activeBlue, hoverBlue, border, padding, fontSize),
                SideButtonSelectedStyle(QStyles.GetStyleName(SideButton.UICanvasesSelected), DUIResources.sideButtonUICanvasesSelected, selectedBlue, border, padding, fontSize),

                SideButtonStyle(QStyles.GetStyleName(SideButton.AnimatorPresets), DUIResources.sideButtonAnimatorPresets, normalGray, activeBlue, hoverBlue, border, padding, fontSize),
                SideButtonSelectedStyle(QStyles.GetStyleName(SideButton.AnimatorPresetsSelected), DUIResources.sideButtonAnimatorPresetsSelected, selectedBlue, border, padding, fontSize),

                SideButtonStyle(QStyles.GetStyleName(SideButton.EditorSettings), DUIResources.sideButtonEditorSettings, normalGray, activeBlue, hoverBlue, border, padding, fontSize),
                SideButtonSelectedStyle(QStyles.GetStyleName(SideButton.EditorSettingsSelected), DUIResources.sideButtonEditorSettingsSelected, selectedBlue, border, padding, fontSize),

                SideButtonStyle(QStyles.GetStyleName(SideButton.Help), DUIResources.sideButtonHelp, normalGray, activeBlue, hoverBlue, border, padding, fontSize),
                SideButtonSelectedStyle(QStyles.GetStyleName(SideButton.HelpSelected), DUIResources.sideButtonHelpSelected, selectedBlue, border, padding, fontSize),

                SideButtonStyle(QStyles.GetStyleName(SideButton.About), DUIResources.sideButtonAbout, normalGray, activeBlue, hoverBlue, border, padding, fontSize),
                SideButtonSelectedStyle(QStyles.GetStyleName(SideButton.AboutSelected), DUIResources.sideButtonAboutSelected, selectedBlue, border, padding, fontSize),

                SideButtonStyle(QStyles.GetStyleName(SideButton.Twitter), DUIResources.sideButtonTwitter, ColorExtensions.ColorFrom256(128, 128, 128), ColorExtensions.ColorFrom256(242, 242, 242), ColorExtensions.ColorFrom256(0, 153, 209), socialButtonBorder, socialButtonPadding, socialButtonFontSize),
                SideButtonStyle(QStyles.GetStyleName(SideButton.Facebook), DUIResources.sideButtonFacebook, ColorExtensions.ColorFrom256(128, 128, 128), ColorExtensions.ColorFrom256(242, 242, 242), ColorExtensions.ColorFrom256(74, 112, 186), socialButtonBorder, socialButtonPadding, socialButtonFontSize),
                SideButtonStyle(QStyles.GetStyleName(SideButton.Youtube), DUIResources.sideButtonYoutube, ColorExtensions.ColorFrom256(128, 128, 128), ColorExtensions.ColorFrom256(242, 242, 242), ColorExtensions.ColorFrom256(255, 102, 102), socialButtonBorder, socialButtonPadding, socialButtonFontSize),
            });
        }
Ejemplo n.º 11
0
        void DrawSortingLayerName(float width)
        {
            QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, useCustomSortingLayerName.boolValue ? QColors.Color.Blue : QColors.Color.Gray), width - 164, 20);
            QUI.Space(-20);

            QUI.BeginHorizontal(width);
            {
                QLabel.text  = "Sorting Layer Name";
                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 (!useCustomSortingLayerName.boolValue)
                {
                    targetSortingLayerName = TargetCanvas.overrideSorting
                                             ? TargetCanvas.sortingLayerName
                                             : TargetCanvas.rootCanvas.sortingLayerName;

                    QLabel.text  = targetSortingLayerName;
                    QLabel.style = Style.Text.Help;

                    QUI.BeginVertical(width - tempFloat - 174, QUI.SingleLineHeight);
                    {
                        QUI.Space(2);
                        QUI.Label(QLabel);
                    }
                    QUI.EndVertical();

                    customSortingLayerName.stringValue = targetSortingLayerName;
                }
                else
                {
                    if (customSortingLayerName.stringValue == MISSING_UIELEMENT)
                    {
                        customSortingLayerName.stringValue = "Default";
                    }

                    QUI.PropertyField(customSortingLayerName, width - tempFloat - 184);
                    QUI.Space(2);
                }

                QUI.QToggle("use a custom layer name", useCustomSortingLayerName, 20);
            }
            QUI.EndHorizontal();
            QUI.Space(SPACE_2);
        }
Ejemplo n.º 12
0
 protected void DrawRightPage([NotNull] Action page, Action nextButton = null)
 {
     QUI.Space(7);
     MyCreate.Box(page);
     MyCreate.AddSpace();
     if (null != nextButton)
     {
         MyCreate.Heng(() =>
         {
             MyCreate.AddSpace();
             if (GUILayout.Button("", QStyles.GetStyle(Style.LinkButton.Unity), GUILayout.Width(80), GUILayout.Height(20)))
             {
                 nextButton();
             }
         });
     }
 }
        void DrawButtonCategoryAndButtonName(float width)
        {
            QUI.BeginHorizontal(width);
            {
                QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Gray), (width - SPACE_2) / 2, 34);
                QUI.Space(SPACE_2);
                QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Gray), (width - SPACE_2) / 2, 34);
            }
            QUI.EndHorizontal();

            QUI.Space(-36);

            QUI.BeginHorizontal(width);
            {
                QUI.Space(6);

                QLabel.text  = "Button Category";
                QLabel.style = Style.Text.Small;
                QUI.BeginHorizontal((width - 6) / 2);
                {
                    QUI.Label(QLabel);
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();

                QLabel.text  = "Button Name";
                QLabel.style = Style.Text.Small;
                QUI.BeginHorizontal((width - 6) / 2);
                {
                    QUI.Label(QLabel);
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
            }
            QUI.EndHorizontal();

            QUI.Space(-SPACE_4);

            QUI.BeginHorizontal(width);
            {
                QUI.Space(4);
                DrawButtonCategory((width - 6) / 2);
                DrawButtonName((width - 6) / 2);
            }
            QUI.EndHorizontal();
        }
Ejemplo n.º 14
0
 void DrawNewsArticle(string title, string content, float width)
 {
     QLabel.text  = title;
     QLabel.style = Style.Text.Subtitle;
     QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Gray), width, 20);
     QUI.Space(-20);
     QUI.BeginHorizontal(width);
     {
         QUI.Space(6);
         QUI.Label(QLabel);
         QUI.FlexibleSpace();
     }
     QUI.EndHorizontal();
     QLabel.text  = content;
     QLabel.style = Style.Text.Normal;
     QUI.Space(-8);
     EditorGUILayout.LabelField(content, QStyles.GetInfoMessageMessageStyle(Style.InfoMessage.Help), GUILayout.Width(width));
 }
Ejemplo n.º 15
0
        void DrawSettings(float width)
        {
            QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, soundy.audioMixerGroup != null ? QColors.Color.Blue : QColors.Color.Gray), width, 20);
            QUI.Space(-20);

            QUI.BeginHorizontal(width);
            {
                QUI.Space(SPACE_4);
                QLabel.text  = "Audio Mixer Group";
                QLabel.style = Style.Text.Normal;
                QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight);
                {
                    QUI.Space(1);
                    QUI.Label(QLabel);
                }
                QUI.EndVertical();
                QUI.PropertyField(audioMixerGroup, width - 8 - QLabel.x - 16);
                QUI.Space(SPACE_4);
            }
            QUI.EndHorizontal();

            QUI.Space(SPACE_4);

            QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, soundy.audioMixerGroup != null ? QColors.Color.Blue : QColors.Color.Gray), width, 20);
            QUI.Space(-20);

            QLabel.style = Style.Text.Normal;
            QLabel.text  = "Master Volume";
            tempFloat    = QLabel.x; //save first label width
            QLabel.text  = "Sound Channels";
            tempFloat   += QLabel.x; //add second label width
            tempFloat   += 8;        //add extra space

            QUI.BeginHorizontal(width);
            {
                QUI.Space(SPACE_4);

                QLabel.text = "Master Volume";
                QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight);
                {
                    QUI.Space(1);
                    QUI.Label(QLabel);
                }
                QUI.EndVertical();

                EditorGUILayout.Slider(masterVolume, 0, 1, GUIContent.none, GUILayout.Width(140));

                QUI.FlexibleSpace();

                QLabel.text = "Sound Channels";
                QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight);
                {
                    QUI.Space(1);
                    QUI.Label(QLabel);
                }
                QUI.EndVertical();

                QUI.PropertyField(numberOfChannels, 40);

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

            if (numberOfChannels.intValue < 1)
            {
                numberOfChannels.intValue = 1;
            }
        }
        void DrawCustomStartPostion(float width)
        {
            QUI.BeginHorizontal(width);
            {
                //CUSTOM START POSITION
                QLabel.text  = "custom start position";
                QLabel.style = Style.Text.Normal;
                tempFloat    = width - QLabel.x - 16 - 12; //extra space after the custom start position label
                QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, useCustomStartAnchoredPosition.boolValue ? QColors.Color.Blue : QColors.Color.Gray), QLabel.x + 16 + 12 + tempFloat * showCustomStartPosition.faded, 18 + 24 * showCustomStartPosition.faded);
                QUI.Space(-QLabel.x - 12 - 12 - tempFloat * showCustomStartPosition.faded);

                QUI.Toggle(useCustomStartAnchoredPosition);
                QUI.BeginVertical(QLabel.x + 8, QUI.SingleLineHeight);
                {
                    QUI.Label(QLabel);
                    QUI.Space(SPACE_2);
                }
                QUI.EndVertical();

                if (showCustomStartPosition.faded > 0.4f)
                {
                    QUI.PropertyField(customStartAnchoredPosition, (tempFloat - 4) * showCustomStartPosition.faded);
                }
            }
            QUI.EndHorizontal();

            showCustomStartPosition.target = useCustomStartAnchoredPosition.boolValue;

            QUI.Space(-20 * showCustomStartPosition.faded); //lift the buttons on the background

            if (showCustomStartPosition.faded > 0.4f)
            {
                tempFloat = (width - 16 - 16) / 3; //button width (3 buttons) that takes into account spaces
                QUI.BeginHorizontal(width);
                {
                    QUI.Space(20 * showCustomStartPosition.faded);
                    if (QUI.GhostButton("Get Position", QColors.Color.Blue, tempFloat * showCustomStartPosition.faded, 16 * showCustomStartPosition.faded))
                    {
                        customStartAnchoredPosition.vector3Value = Drawer.RectTransform.anchoredPosition3D;
                    }

                    QUI.Space(SPACE_4);

                    if (QUI.GhostButton("Set Position", QColors.Color.Blue, tempFloat * showCustomStartPosition.faded, 16 * showCustomStartPosition.faded))
                    {
                        Undo.RecordObject(Drawer.RectTransform, "SetPosition");
                        Drawer.RectTransform.anchoredPosition3D = customStartAnchoredPosition.vector3Value;
                    }

                    QUI.Space(SPACE_4);

                    if (QUI.GhostButton("Reset Position", QColors.Color.Blue, tempFloat * showCustomStartPosition.faded, 16 * showCustomStartPosition.faded))
                    {
                        customStartAnchoredPosition.vector3Value = Vector3.zero;
                    }

                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
            }

            QUI.Space(SPACE_8 * showCustomStartPosition.faded);
        }
        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 DrawSoundsDatabase(float width)
        {
            DrawNewUISoundAndSearch(width);
            QUI.Space(SPACE_8);
            DrawUISoundsFilterButtons(width);
            QUI.Space(SPACE_8);

            for (int i = 0; i < DUIData.Instance.DatabaseUISounds.sounds.Count; i++)
            {
                if (DUIData.Instance.DatabaseUISounds.sounds[i] == null)
                {
                    continue;
                }
                if (WindowSettings.selectedUISoundsFilter == SoundType.UIButtons && DUIData.Instance.DatabaseUISounds.sounds[i].soundType == SoundType.UIElements)
                {
                    continue;
                }
                if (WindowSettings.selectedUISoundsFilter == SoundType.UIElements && DUIData.Instance.DatabaseUISounds.sounds[i].soundType == SoundType.UIButtons)
                {
                    continue;
                }

                QUI.BeginHorizontal(width, 20);
                {
                    if (SearchPatternAnimBool.target)//a search pattern has been entered in the search box
                    {
                        try
                        {
                            if (!Regex.IsMatch(DUIData.Instance.DatabaseUISounds.sounds[i].soundName, SearchPattern, RegexOptions.IgnoreCase))
                            {
                                QUI.EndHorizontal();
                                continue; //this does not match the search pattern --> we do not show this name it
                            }
                        }
                        catch (Exception)
                        { }
                    }

                    QUI.Space(-1);
                    QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, SearchPatternAnimBool.target ? QColors.Color.Orange : QColors.Color.Gray), width + 2, 20);
                    QUI.Space(-2);
                    QUI.Space(-width);

                    SoundType soundType = DUIData.Instance.DatabaseUISounds.sounds[i].soundType;
                    QUI.BeginChangeCheck();
                    soundType = (SoundType)EditorGUILayout.EnumPopup(soundType, GUILayout.Width(PAGE_UISOUNDS_SOUNDTYPE_BUTTON_WIDTH));
                    if (QUI.EndChangeCheck())
                    {
                        Undo.RecordObject(DUIData.Instance, "UpdateSoundType");
                        DUIData.Instance.DatabaseUISounds.sounds[i].soundType = soundType;
                        QUI.SetDirty(DUIData.Instance.DatabaseUISounds.sounds[i]);
                        QUI.SetDirty(DUIData.Instance);
                        AssetDatabase.SaveAssets();
                    }

                    QLabel.text = DUIData.Instance.DatabaseUISounds.sounds[i].soundName;
#if dUI_MasterAudio
                    QLabel.text = "Controlled by MasterAudio";
#endif
                    QUI.Label(QLabel.text, Style.Text.Normal, (width - PAGE_UISOUNDS_SOUNDTYPE_BUTTON_WIDTH - PAGE_UISOUNDS_HORIZONTAL_SPACE * 3 - PAGE_UISOUNDS_BUTTONS_WIDTH * (1 - SearchPatternAnimBool.faded) - 16) * PAGE_UISOUNDS_SOUNDNAME_FIELD_WIDTH_PERCENT);

                    AudioClip audioClip = DUIData.Instance.DatabaseUISounds.sounds[i].audioClip;
                    QUI.BeginChangeCheck();
                    audioClip = (AudioClip)EditorGUILayout.ObjectField("", audioClip, typeof(AudioClip), false, GUILayout.Width((width - PAGE_UISOUNDS_SOUNDTYPE_BUTTON_WIDTH - PAGE_UISOUNDS_HORIZONTAL_SPACE * 3 - PAGE_UISOUNDS_BUTTONS_WIDTH * (1 - SearchPatternAnimBool.faded) - 16) * PAGE_UISOUNDS_AUDIOCLIP_FIELD_WIDTH_PERCENT));
                    if (QUI.EndChangeCheck())
                    {
                        Undo.RecordObject(DUIData.Instance, "UpdateAudioClipReferene");
                        DUIData.Instance.DatabaseUISounds.sounds[i].audioClip = audioClip;
                        QUI.SetDirty(DUIData.Instance.DatabaseUISounds.sounds[i]);
                        QUI.SetDirty(DUIData.Instance);
                        AssetDatabase.SaveAssets();
                    }

                    if (SearchPatternAnimBool.faded < 0.6f)
                    {
                        QUI.Space(PAGE_UISOUNDS_HORIZONTAL_SPACE);

                        if (QUI.ButtonPlay())
                        {
                            DUIUtils.PreviewSound(DUIData.Instance.DatabaseUISounds.sounds[i].soundName);
                        }
                    }

                    if (SearchPatternAnimBool.faded < 0.4f)
                    {
                        QUI.Space(PAGE_UISOUNDS_HORIZONTAL_SPACE);

                        if (QUI.ButtonStop())
                        {
                            DUIUtils.StopSoundPreview(DUIData.Instance.DatabaseUISounds.sounds[i].soundName);
                        }

                        QUI.Space(PAGE_UISOUNDS_HORIZONTAL_SPACE);
                    }

                    if (SearchPatternAnimBool.faded < 0.2f)
                    {
                        if (QUI.ButtonCancel())
                        {
                            if (EditorUtility.DisplayDialog("Delete the '" + DUIData.Instance.DatabaseUISounds.sounds[i].soundName + "' UISound?",
                                                            "Are you sure you want to proceed?" +
                                                            "\n\n" +
                                                            "Operation cannot be undone!",
                                                            "Yes",
                                                            "Cancel"))
                            {
                                DUIData.Instance.DatabaseUISounds.DeleteUISound(DUIData.Instance.DatabaseUISounds.sounds[i].soundName);
                                QUI.SetDirty(DUIData.Instance);
                                AssetDatabase.SaveAssets();
                                QUI.EndHorizontal();
                                continue;
                            }
                        }
                    }
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
                QUI.Space(SPACE_2);
            }
        }
Ejemplo n.º 19
0
        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 DrawPageAnimatorPresetsTabsButtons(float width)
        {
            QUI.BeginHorizontal(width);
            {
                QUI.FlexibleSpace();

                float tempWidth = ANIMATOR_PRESETS_TAB_BUTTON_WIDTH * 3 + ANIMATOR_PRESETS_TAB_BUTTON_SPACING * 2 + ANIMATOR_PRESETS_TAB_TITLE_EXTRA_WIDTH;

                QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low,
                                                   (WindowSettings.selectedAnimatorPresetTab == AnimatorPreset.In) ||
                                                   (WindowSettings.selectedAnimatorPresetTab == AnimatorPreset.Out) ||
                                                   (WindowSettings.selectedAnimatorPresetTab == AnimatorPreset.Loop)
                                                   ? QColors.Color.Blue : QColors.Color.Gray),
                        tempWidth,
                        ANIMATOR_PRESETS_TAB_TITLE_HEIGHT);

                QUI.Space(-tempWidth);
                QUI.Space(ANIMATOR_PRESETS_TAB_TITLE_EXTRA_WIDTH / 2);

                QUI.BeginHorizontal(tempWidth - ANIMATOR_PRESETS_TAB_TITLE_EXTRA_WIDTH / 2);
                {
                    QLabel.text  = "UIElement Animations";
                    QLabel.style = Style.Text.Small;
                    QUI.Space((tempWidth - QLabel.x) / 2);
                    QUI.Label(QLabel.text, Style.Text.Small, QLabel.x, ANIMATOR_PRESETS_TAB_TITLE_HEIGHT - 4);
                    QUI.Space((tempWidth - QLabel.x) / 2);
                }
                QUI.EndHorizontal();

                QUI.Space(ANIMATOR_PRESETS_TAB_BUTTON_SPACING * 6);

                tempWidth = ANIMATOR_PRESETS_TAB_BUTTON_WIDTH * 2 + ANIMATOR_PRESETS_TAB_BUTTON_SPACING + ANIMATOR_PRESETS_TAB_TITLE_EXTRA_WIDTH;

                QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low,
                                                   (WindowSettings.selectedAnimatorPresetTab == AnimatorPreset.Punch) ||
                                                   (WindowSettings.selectedAnimatorPresetTab == AnimatorPreset.State)
                                                   ? QColors.Color.Blue : QColors.Color.Gray),
                        tempWidth,
                        ANIMATOR_PRESETS_TAB_TITLE_HEIGHT);

                QUI.Space(-tempWidth);

                QUI.BeginHorizontal(tempWidth - ANIMATOR_PRESETS_TAB_TITLE_EXTRA_WIDTH / 2);
                {
                    QLabel.text  = "UIButton Animations";
                    QLabel.style = Style.Text.Small;
                    QUI.Space((tempWidth - QLabel.x) / 2);
                    QUI.Label(QLabel.text, Style.Text.Small, QLabel.x, ANIMATOR_PRESETS_TAB_TITLE_HEIGHT - 4);
                    QUI.Space((tempWidth - QLabel.x) / 2);
                }
                QUI.EndHorizontal();

                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();
            QUI.Space(ANIMATOR_PRESETS_TAB_BUTTON_SPACING);
            QUI.BeginHorizontal(width);
            {
                QUI.FlexibleSpace();
                QUI.Space(ANIMATOR_PRESETS_TAB_TITLE_EXTRA_WIDTH / 2);

                DrawAnimatorPresetsTabButton(AnimatorPreset.In);
                QUI.Space(ANIMATOR_PRESETS_TAB_BUTTON_SPACING);
                DrawAnimatorPresetsTabButton(AnimatorPreset.Out);
                QUI.Space(ANIMATOR_PRESETS_TAB_BUTTON_SPACING);
                DrawAnimatorPresetsTabButton(AnimatorPreset.Loop);

                QUI.Space(ANIMATOR_PRESETS_TAB_TITLE_EXTRA_WIDTH);
                QUI.Space(ANIMATOR_PRESETS_TAB_BUTTON_SPACING * 6);
                QUI.Space(ANIMATOR_PRESETS_TAB_TITLE_EXTRA_WIDTH);

                DrawAnimatorPresetsTabButton(AnimatorPreset.Punch);
                QUI.Space(ANIMATOR_PRESETS_TAB_BUTTON_SPACING);
                DrawAnimatorPresetsTabButton(AnimatorPreset.State);

                QUI.Space(ANIMATOR_PRESETS_TAB_TITLE_EXTRA_WIDTH / 2);
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();
        }
Ejemplo n.º 21
0
        void DrawTargetUIElement(float width)
        {
            QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, uiEffect.targetUIElement == null ? QColors.Color.Red : QColors.Color.Blue), width, 54);
            QUI.Space(-54);

            QUI.BeginHorizontal(width);
            {
                QLabel.text  = "Target UIElement";
                QLabel.style = Style.Text.Normal;
                tempFloat    = QLabel.x; //save label width

                QUI.Space(SPACE_4);

                QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight);
                {
                    QUI.Label(QLabel);
                    QUI.Space(1);
                }
                QUI.EndVertical();

                QUI.BeginChangeCheck();
                QUI.PropertyField(targetUIElement, width - QLabel.x - 20);
                if (QUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                    RenameGameObject();
                }
                QUI.FlexibleSpace();
                QUI.Space(SPACE_8);
            }
            QUI.EndHorizontal();
            QUI.Space(-SPACE_2);
            tempFloat += SPACE_4 + 8; //calculate the indent for the next two rows
            QUI.BeginHorizontal(width);
            {
                QUI.Space(tempFloat);

                QLabel.text  = "Element Category";
                QLabel.style = Style.Text.Small;

                QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight);
                {
                    QUI.Label(QLabel);
                    QUI.Space(1);
                }
                QUI.EndVertical();

                QLabel.text  = uiEffect.targetUIElement != null ? uiEffect.targetUIElement.elementCategory : MISSING_UIELEMENT;
                QLabel.style = Style.Text.Help;
                QUI.Label(QLabel);
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();
            QUI.Space(-SPACE_4);
            QUI.BeginHorizontal(width);
            {
                QUI.Space(tempFloat);

                QLabel.text  = "Element Name";
                QLabel.style = Style.Text.Small;

                QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight);
                {
                    QUI.Label(QLabel);
                    QUI.Space(1);
                }
                QUI.EndVertical();

                QLabel.text  = uiEffect.targetUIElement != null ? uiEffect.targetUIElement.elementName : MISSING_UIELEMENT;
                QLabel.style = Style.Text.Help;
                QUI.Label(QLabel);
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();

            infoMessage["UIElementDisabled"].show.target = uiEffect.targetUIElement == null;
            DrawInfoMessage("UIElementDisabled", GlobalWidth);

            QUI.Space(SPACE_4 * infoMessage["UIElementDisabled"].show.faded);
        }
Ejemplo n.º 22
0
 void DrawEffect()
 {
     QUI.SetGUIBackgroundColor(accentColorPurple);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Label("Despawn After", Style.Text.Normal, 86);
         QUI.BeginChangeCheck();
         QUI.PropertyField(despawnAfter, 100);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.despawnAfter = (PoolyDespawner.DespawnAfter)despawnAfter.enumValueIndex;
                 }
             }
         }
         QUI.FlexibleSpace();
         QUI.BeginChangeCheck();
         QUI.Toggle(playOnSpawn);
         if (QUI.EndChangeCheck())
         {
             if (serializedObject.isEditingMultipleObjects)
             {
                 Undo.RecordObjects(targets, "Multiple Edit");
                 for (int i = 0; i < targets.Length; i++)
                 {
                     PoolyDespawner despawner = (PoolyDespawner)targets[i];
                     despawner.playOnSpawn = playOnSpawn.boolValue;
                 }
             }
         }
         QUI.Label("Play On Spawn", Style.Text.Normal, 84);
     }
     QUI.EndHorizontal();
     if (poolyDespawner.pSystem == null)
     {
         QUI.Label("ParticleSystem: Not Found", Style.Text.Normal, WIDTH_420);
         infoMessage["poolyDespawner.pSystem"].show.target = true;
     }
     else
     {
         QUI.Label("ParticleSystem: " + poolyDespawner.pSystem.gameObject.name, Style.Text.Normal, WIDTH_420);
         QUI.BeginHorizontal(WIDTH_420);
         {
             QUI.BeginChangeCheck();
             QUI.PropertyField(useParticleSystemDuration, 12);
             if (QUI.EndChangeCheck())
             {
                 if (serializedObject.isEditingMultipleObjects)
                 {
                     Undo.RecordObjects(targets, "Multiple Edit");
                     for (int i = 0; i < targets.Length; i++)
                     {
                         PoolyDespawner despawner = (PoolyDespawner)targets[i];
                         despawner.useParticleSystemDuration = useParticleSystemDuration.boolValue;
                     }
                 }
             }
             QUI.Label("Duration: " + poolyDespawner.pSystem.main.duration + " seconds", Style.Text.Normal, WIDTH_420 - 12);
         }
         QUI.EndHorizontal();
         QUI.BeginHorizontal(WIDTH_420);
         {
             QUI.BeginChangeCheck();
             QUI.PropertyField(useParticleSystemStartDelay, 12);
             if (QUI.EndChangeCheck())
             {
                 if (serializedObject.isEditingMultipleObjects)
                 {
                     Undo.RecordObjects(targets, "Multiple Edit");
                     for (int i = 0; i < targets.Length; i++)
                     {
                         PoolyDespawner despawner = (PoolyDespawner)targets[i];
                         despawner.useParticleSystemStartDelay = useParticleSystemStartDelay.boolValue;
                     }
                 }
             }
             QUI.Label("Start Delay: " + poolyDespawner.pSystem.main.startDelay.constant + " seconds", Style.Text.Normal, WIDTH_420);
         }
         QUI.EndHorizontal();
         QUI.BeginHorizontal(WIDTH_420);
         {
             QUI.BeginChangeCheck();
             QUI.PropertyField(useParticleSystemStartLifetime, 12);
             if (QUI.EndChangeCheck())
             {
                 if (serializedObject.isEditingMultipleObjects)
                 {
                     Undo.RecordObjects(targets, "Multiple Edit");
                     for (int i = 0; i < targets.Length; i++)
                     {
                         PoolyDespawner despawner = (PoolyDespawner)targets[i];
                         despawner.useParticleSystemStartLifetime = useParticleSystemStartLifetime.boolValue;
                     }
                 }
             }
             QUI.Label("Start Lifetime: " + poolyDespawner.pSystem.main.startLifetime.constant + " seconds", Style.Text.Normal, WIDTH_420);
         }
         QUI.EndHorizontal();
         QUI.BeginHorizontal(WIDTH_420);
         {
             QUI.Label("Extra Time", Style.Text.Normal, 65);
             QUI.BeginChangeCheck();
             QUI.PropertyField(extraTime, 40);
             if (QUI.EndChangeCheck())
             {
                 if (serializedObject.isEditingMultipleObjects)
                 {
                     Undo.RecordObjects(targets, "Multiple Edit");
                     for (int i = 0; i < targets.Length; i++)
                     {
                         PoolyDespawner despawner = (PoolyDespawner)targets[i];
                         despawner.extraTime = extraTime.floatValue;
                     }
                 }
             }
             QUI.Label("seconds", Style.Text.Normal, 50);
         }
         QUI.EndHorizontal();
         QUI.Space(SPACE_2);
         QUI.Button(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Purple), WIDTH_420, 20);
         QUI.Space(-20);
         QUI.BeginHorizontal(WIDTH_420);
         {
             QUI.Space(2);
             QUI.Label("Total Duration until despawn: " + poolyDespawner.pSystemTotalDuration + " seconds", Style.Text.Normal, WIDTH_420);
         }
         QUI.EndHorizontal();
         infoMessage["poolyDespawner.pSystem"].show.target = false;
     }
     QUI.ResetColors();
     DrawInfoMessage("poolyDespawner.pSystem", WIDTH_420);
 }
Ejemplo n.º 23
0
        static void HierarchyCustomizer(int instanceID, Rect selectionRect)
        {
            if (DUI.DUISettings == null || !DUI.DUISettings.HierarchyManager_Enabled)
            {
                return;
            }

            QLabel = new QLabel("", Style.Text.Small);

            rect        = new Rect(selectionRect);
            rect.x      = rect.xMax - iconWidth;
            rect.width  = iconWidth;
            rect.height = iconHeight;

#if dUI_PlayMaker
            if (DUI.DUISettings.HierarchyManager_PlaymakerEventDispatcher_ShowIcon && playmakerEventDispatcherIDs.ContainsKey(instanceID) && playmakerEventDispatcherIDs[instanceID] != null)
            {
                GUI.Label(rect, DUIResources.iconPlayMakerEventDispatcher.texture); rect.x -= iconWidth;
            }
#endif
            if (DUI.DUISettings.HierarchyManager_UITrigger_ShowIcon && uiTriggerIDs.ContainsKey(instanceID) && uiTriggerIDs[instanceID] != null)
            {
                GUI.Label(rect, DUIResources.iconUITrigger.texture); rect.x -= iconWidth;
            }
            if (DUI.DUISettings.HierarchyManager_UIManager_ShowIcon && UIManagerID == instanceID)
            {
                GUI.Label(rect, DUIResources.iconUIManager.texture); rect.x -= iconWidth;
            }
            if (DUI.DUISettings.HierarchyManager_Soundy_ShowIcon && SoundyID == instanceID)
            {
                GUI.Label(rect, DUIResources.iconSoundy.texture); rect.x -= iconWidth;
            }
            if (DUI.DUISettings.HierarchyManager_UINotificationManager_ShowIcon && UINotificationManagerID == instanceID)
            {
                GUI.Label(rect, DUIResources.iconUINotificationManager.texture); rect.x -= iconWidth;
            }
            if (DUI.DUISettings.HierarchyManager_OrientationManager_ShowIcon && OrientationManagerID == instanceID)
            {
                GUI.Label(rect, DUIResources.iconOrientationManager.texture); rect.x -= iconWidth;
            }
            if (DUI.DUISettings.HierarchyManager_SceneLoader_ShowIcon && SceneLoaderID == instanceID)
            {
                GUI.Label(rect, DUIResources.iconSceneLoader.texture); rect.x -= iconWidth;
            }

            if (DUI.DUISettings.HierarchyManager_UICanvas_Enabled && uiCanvasIDs.ContainsKey(instanceID) && uiCanvasIDs[instanceID] != null)
            {
                if (DUI.DUISettings.HierarchyManager_UICanvas_ShowIcon)
                {
                    GUI.Label(rect, DUIResources.iconUICanvas.texture);
                }
                else
                {
                    rect.x += iconWidth;
                }
                uic          = uiCanvasIDs[instanceID];
                QLabel.text  = "";
                QLabel.style = Style.Text.Small;
                QLabel.text  = (DUI.DUISettings.HierarchyManager_UICanvas_ShowCanvasName ? "[ " + uic.canvasName + " ]" : "")
                               + (DUI.DUISettings.HierarchyManager_UICanvas_ShowSortingLayerNameAndOrder ? " " + uic.Canvas.sortingLayerName + " " + uic.Canvas.sortingOrder : "");
                if (!string.IsNullOrEmpty(QLabel.text))
                {
                    rect.x    -= QLabel.x;
                    rect.width = QLabel.x;
                    GUI.Label(rect, QLabel.text, QStyles.GetStyle(QStyles.GetStyleName(QLabel.style)));
                }
            }

            if (DUI.DUISettings.HierarchyManager_UIButton_Enabled && uiButtonIDs.ContainsKey(instanceID) && uiButtonIDs[instanceID] != null)
            {
                if (DUI.DUISettings.HierarchyManager_UIButton_ShowIcon)
                {
                    GUI.Label(rect, DUIResources.iconUIButton.texture);
                }
                else
                {
                    rect.x += iconWidth;
                }
                uib          = uiButtonIDs[instanceID];
                QLabel.text  = "";
                QLabel.style = Style.Text.Small;
                QLabel.text  = (DUI.DUISettings.HierarchyManager_UIButton_ShowButtonCategory ? "[ " + uib.buttonCategory + " ]" : "")
                               + (DUI.DUISettings.HierarchyManager_UIButton_ShowButtonName ? "[ " + uib.buttonName + " ]" : "");
                if (!string.IsNullOrEmpty(QLabel.text))
                {
                    rect.x    -= QLabel.x;
                    rect.width = QLabel.x;
                    GUI.Label(rect, QLabel.text, QStyles.GetStyle(QStyles.GetStyleName(QLabel.style)));
                }
            }

            if (DUI.DUISettings.HierarchyManager_UINotification_ShowIcon && uiNotificationIDs.ContainsKey(instanceID))
            {
                GUI.Label(rect, DUIResources.iconUINotification.texture); rect.x -= iconWidth;
            }
            if (DUI.DUISettings.HierarchyManager_UIElement_Enabled && uiElementIDs.ContainsKey(instanceID) && uiElementIDs[instanceID] != null)
            {
                if (DUI.DUISettings.HierarchyManager_UIElement_ShowIcon)
                {
                    GUI.Label(rect, DUIResources.iconUIElement.texture);
                }
                else
                {
                    rect.x += iconWidth;
                }
                uie          = uiElementIDs[instanceID];
                QLabel.text  = "";
                QLabel.style = Style.Text.Small;
                if (uie.linkedToNotification)
                {
                    QLabel.text = "linked to notification";
                }
                else
                {
                    QLabel.text = (DUI.DUISettings.HierarchyManager_UIElement_ShowElementCategory ? "[ " + uie.elementCategory + " ]" : "")
                                  + (DUI.DUISettings.HierarchyManager_UIElement_ShowElementName ? "[ " + uie.elementName + " ]" : "")
                                  + (DUI.DUISettings.HierarchyManager_UIElement_ShowSortingLayerNameAndOrder ? " " + uie.Canvas.sortingLayerName + " " + uie.Canvas.sortingOrder : "");
                }
                if (!string.IsNullOrEmpty(QLabel.text))
                {
                    rect.x    -= QLabel.x;
                    rect.width = QLabel.x;
                    GUI.Label(rect, QLabel.text, QStyles.GetStyle(QStyles.GetStyleName(QLabel.style)));
                }
            }

            if (DUI.DUISettings.HierarchyManager_UIEffect_Enabled && uiEffectIDs.ContainsKey(instanceID) && uiEffectIDs[instanceID] != null)
            {
                if (DUI.DUISettings.HierarchyManager_UIEffect_ShowIcon)
                {
                    GUI.Label(rect, DUIResources.iconUIEffect.texture);
                }
                else
                {
                    rect.x += iconWidth;
                }
                uief = uiEffectIDs[instanceID];
                if (DUI.DUISettings.HierarchyManager_UIEffect_ShowSortingLayerNameAndOrder)
                {
                    if (uief.targetUIElement != null)
                    {
                        if (uief.targetUIElement.linkedToNotification)
                        {
                            QLabel.text = "linked to notification";
                        }
                        else
                        {
                            QLabel.text = (uief.useCustomSortingLayerName
                                     ? uief.customSortingLayerName
                                     : uief.targetUIElement.Canvas.overrideSorting
                                       ? uief.targetUIElement.Canvas.sortingLayerName
                                       : uief.targetUIElement.Canvas.rootCanvas.sortingLayerName)
                                          + " " +
                                          (uief.useCustomOrderInLayer
                                     ? uief.customOrderInLayer
                                     : uief.targetUIElement.Canvas.overrideSorting
                                       ? uief.targetUIElement.Canvas.sortingOrder
                                       : uief.targetUIElement.Canvas.rootCanvas.sortingOrder);
                        }
                    }
                    else
                    {
                        QLabel.text = "DISABLED";
                    }
                    rect.x    -= QLabel.x;
                    rect.width = QLabel.x;
                    GUI.Label(rect, QLabel.text, QStyles.GetStyle(QStyles.GetStyleName(QLabel.style)));
                }
            }
        }
Ejemplo n.º 24
0
        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 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);
        }
Ejemplo n.º 26
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();
        }
Ejemplo n.º 27
0
 /// <summary>
 /// Returns a style that has been added to the skin.
 /// This method is to be used paired with the enums in the Style class.
 /// </summary>
 public static GUIStyle GetStyle <T>(T styleName)
 {
     return(Skin.GetStyle(QStyles.GetStyleName(styleName)));
 }
Ejemplo n.º 28
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 DrawTargetCanvas(float width)
        {
            QUI.BeginHorizontal(width);
            {
                tempFloat = width - 72; //background width
                QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Gray), tempFloat, 20);
                QUI.Space(-tempFloat);
                QUI.Space(SPACE_4);

                QLabel.text  = "Canvas Name";
                QLabel.style = Style.Text.Small;
                QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight);
                {
                    QUI.Space(1);
                    QUI.Label(QLabel);
                }
                QUI.EndVertical();

                if (EditorApplication.isPlayingOrWillChangePlaymode)
                {
                    GUI.enabled = false;
                }

                tempFloat = width - QLabel.x - 92; //field width

                if (customTargetCanvasName.boolValue)
                {
                    QUI.PropertyField(targetCanvasName, tempFloat);

                    if (Event.current.isKey &&
                        (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.Escape) &&
                        Event.current.type == EventType.KeyUp)   //if the Enter or Escape key have been pressed
                    {
                        customTargetCanvasName.boolValue = false;
                    }
                }
                else
                {
                    ValidateCanvasName();
                    QUI.BeginChangeCheck();
                    canvasNameIndex = EditorGUILayout.Popup(canvasNameIndex, DatabaseUICanvases.ToArray(), GUILayout.Width(tempFloat));
                    if (QUI.EndChangeCheck())
                    {
                        Undo.RecordObject(target, "UpdateCanvasName");
                        targetCanvasName.stringValue = DUIData.Instance.DatabaseUICanvases[canvasNameIndex];
                    }
                }
                QUI.Space(SPACE_4);
                QLabel.text  = "custom";
                QLabel.style = Style.Text.Normal;
                QUI.BeginChangeCheck();
                QUI.BeginVertical(QLabel.x + 28, 18);
                {
                    QUI.Space(1);
                    QUI.QToggle("custom", customTargetCanvasName);
                }
                QUI.EndVertical();
                if (QUI.EndChangeCheck())
                {
                    if (!customTargetCanvasName.boolValue)
                    {
                        ValidateCanvasName();
                    }
                }

                GUI.enabled = true;
            }
            QUI.EndHorizontal();

            infoMessage["EmptyTargetCanvasName"].show.target = string.IsNullOrEmpty(targetCanvasName.stringValue);
            DrawInfoMessage("EmptyTargetCanvasName", width);
        }
Ejemplo n.º 30
0
 private void DrawPrefabs()
 {
     // 先画个盒子,再提上去写文字
     QUI.Space(SPACE_8);
     QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Orange), WIDTH_420, 20);
     QUI.Space(-20);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Space(SPACE_4);
         QUI.Label("PREFAB" + ((poolySpawner.spawnPrefabs != null && poolySpawner.spawnPrefabs.Count > 1) ? "S" : "") + " TO SPAWN(拖预制体进来)", Style.Text.Normal, 200, HEIGHT_16);
         QUI.Space(SPACE_4);
         QUI.FlexibleSpace();
         if (poolySpawner.spawnPrefabs != null && poolySpawner.spawnPrefabs.Count > 1)
         {
             QUI.Label("Spawn Type", Style.Text.Normal, 68);
             QUI.SetGUIBackgroundColor(AccentColorOrange);
             QUI.Popup(prefabSpawnType, 80, SpawnTypes);
             QUI.ResetColors();
         }
         QUI.Space(SPACE_8);
     }
     QUI.EndHorizontal();
     QUI.Space(SPACE_4);
     if (poolySpawner.spawnPrefabs == null || poolySpawner.spawnPrefabs.Count == 0)
     {
         poolySpawner.spawnPrefabs = new List <PoolySpawner.SpawnPrefab> {
             new PoolySpawner.SpawnPrefab(null)
         };
     }
     if (poolySpawner.spawnPrefabs.Count == 1 && poolySpawner.prefabSpawnType == PoolySpawner.SpawnType.Random)
     {
         poolySpawner.prefabSpawnType = PoolySpawner.SpawnType.Sequential;
     }
     infoMessage["NoPrefabs"].show.target = !poolySpawner.HasPrefabs();
     // 画框框提示
     DrawInfoMessage("NoPrefabs", WIDTH_420 - 20);
     for (int i = 0; i < poolySpawner.spawnPrefabs.Count; i++)
     {
         QUI.Space(SPACE_2);
         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 prefabObject = poolySpawner.spawnPrefabs[i].prefab;
             QUI.SetGUIBackgroundColor(AccentColorOrange);
             prefabObject = (Transform)QUI.ObjectField(prefabObject, typeof(Transform), false, (WIDTH_420 - SPACE_2 - tempContentSize.x - SPACE_8 - SPACE_16) - 240 * animBoolSpawnRandomPrefab.faded);
             QUI.ResetColors();
             if (QUI.EndChangeCheck())
             {
                 Undo.RecordObject(poolySpawner, "Changed Value For Prefab Slot " + i);
                 poolySpawner.spawnPrefabs[i].prefab = prefabObject;
             }
             if (QUI.ButtonMinus())
             {
                 if (poolySpawner.spawnPrefabs.Count > 1)
                 {
                     Undo.RecordObject(poolySpawner, "Removed Prefab Slot " + i);
                     poolySpawner.spawnPrefabs.RemoveAt(i);
                 }
                 else if (poolySpawner.spawnPrefabs == null || poolySpawner.spawnPrefabs[0].prefab != null)
                 {
                     Undo.RecordObject(poolySpawner, "Reset Prefab Slot");
                     poolySpawner.spawnPrefabs = new List <PoolySpawner.SpawnPrefab> {
                         new PoolySpawner.SpawnPrefab(null)
                     };
                 }
                 QUI.SetDirty(poolySpawner);
                 QUI.ExitGUI();
             }
             animBoolSpawnRandomPrefab.target = prefabSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random;
             if (poolySpawner.spawnPrefabs != null && poolySpawner.spawnPrefabs.Count > 1 && prefabSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random)
             {
                 QUI.Space(SPACE_2);
                 QUI.Label("weight", Style.Text.Small, 50 * animBoolSpawnRandomPrefab.faded);
                 QUI.Space(-SPACE_8);
                 QUI.BeginChangeCheck();
                 int spawnPrefabWeight = poolySpawner.spawnPrefabs[i].weight;
                 QUI.SetGUIBackgroundColor(AccentColorOrange);
                 spawnPrefabWeight = EditorGUILayout.IntSlider(spawnPrefabWeight, 0, 100);
                 QUI.ResetColors();
                 if (QUI.EndChangeCheck())
                 {
                     Undo.RecordObject(poolySpawner, "Changed Weight Of Prefab " + i);
                     poolySpawner.spawnPrefabs[i].weight = spawnPrefabWeight;
                 }
             }
             QUI.FlexibleSpace();
         }
         QUI.EndHorizontal();
     }
     QUI.Space(SPACE_2);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.FlexibleSpace();
         if (QUI.ButtonPlus())
         {
             Undo.RecordObject(poolySpawner, "Added New Prefab Slot");
             poolySpawner.spawnPrefabs.Add(new PoolySpawner.SpawnPrefab(null));
             QUI.SetDirty(poolySpawner);
             QUI.ExitGUI();
         }
         QUI.Space(3 + 240 * animBoolSpawnRandomPrefab.faded);
     }
     QUI.EndHorizontal();
 }