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();
        }
Esempio n. 2
0
        void DrawSettings(float width)
        {
            QUI.QToggle("Auto disable Button Clicks when an UIElement is in trasition", autoDisableButtonClicks);

            QUI.Space(SPACE_4);

            //CONTROLLER INPUT MODE
            QUI.BeginHorizontal(width);
            {
                if ((ControllerInputMode)backButtonInputMode.enumValueIndex == ControllerInputMode.None)
                {
                    QUI.SetGUIBackgroundColor(QUI.AccentColorRed);
                }
                QUI.QObjectPropertyField("'Back' button Input Mode", backButtonInputMode, 260, 20, false);
                QUI.ResetColors();
                QUI.Space(SPACE_2);
                if ((ControllerInputMode)backButtonInputMode.enumValueIndex != ControllerInputMode.None)
                {
                    QUI.QToggle("enable alternate inputs", enableBackButtonAlternateInputs);
                }
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();
            if ((ControllerInputMode)backButtonInputMode.enumValueIndex != ControllerInputMode.None)
            {
                QUI.BeginHorizontal(width);
                {
                    if ((ControllerInputMode)backButtonInputMode.enumValueIndex == ControllerInputMode.KeyCode)
                    {
                        QUI.QObjectPropertyField("Key Code", backButtonKeyCode, width / 2 - 1, 20, false);
                        QUI.Space(SPACE_2);
                        GUI.enabled = enableBackButtonAlternateInputs.boolValue;
                        if (!enableBackButtonAlternateInputs.boolValue)
                        {
                            QUI.SetGUIBackgroundColor(QUI.AccentColorRed);
                        }
                        QUI.QObjectPropertyField("Alternate", backButtonKeyCodeAlt, width / 2 - 1, 20, false);
                        QUI.ResetColors();
                        GUI.enabled = true;
                    }
                    else if ((ControllerInputMode)backButtonInputMode.enumValueIndex == ControllerInputMode.VirtualButton)
                    {
                        QUI.QObjectPropertyField("Virtual Button", backButtonVirtualButtonName, width / 2 - 1, 20, false);
                        QUI.Space(SPACE_2);
                        GUI.enabled = enableBackButtonAlternateInputs.boolValue;
                        if (!enableBackButtonAlternateInputs.boolValue)
                        {
                            QUI.SetGUIBackgroundColor(QUI.AccentColorRed);
                        }
                        QUI.QObjectPropertyField("Alternate", backButtonVirtualButtonNameAlt, width / 2 - 1, 20, false);
                        QUI.ResetColors();
                        GUI.enabled = true;
                    }
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
            }
        }
 void DrawDetectGestures(float width)
 {
     QUI.BeginHorizontal(width);
     {
         QUI.QToggle("Detect Gestures", detectGestures);
         QUI.FlexibleSpace();
     }
     QUI.EndHorizontal();
 }
 void DrawAbout()
 {
     QUI.BeginHorizontal(WIDTH_420);
     {
         showHowToUse.target = QUI.QToggle("Remind me how to use this with PlayMaker", showHowToUse.target);
     }
     QUI.EndHorizontal();
     infoMessage["HowToUse"].show.target = showHowToUse.target;
     DrawInfoMessage("HowToUse", WIDTH_420);
 }
        void DrawButtonNameOptions(float width)
        {
            if (!triggerOnButtonClick.boolValue &&
                !triggerOnButtonDoubleClick.boolValue &&
                !triggerOnButtonLongClick.boolValue)
            {
                return;
            }

            gameEvent.stringValue = string.Empty;

            DrawDatabaseButtons(width);

            QUI.Space(SPACE_4);

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

            QUI.Space(SPACE_2);

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

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

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

            QUI.Space(SPACE_2);

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

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

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

            infoMessage["DispatchAllLongButtonClicks"].show.target = triggerOnButtonLongClick.boolValue && dispatchAll.boolValue;
            DrawInfoMessage("DispatchAllLongButtonClicks", GlobalWidth);
        }
 void DrawDebug(float width)
 {
     QUI.BeginHorizontal(width);
     {
         QUI.QToggle("Debug Drawer", debugDrawer);
         QUI.Space(SPACE_4);
         QUI.QToggle("Debug Events", debugEvents);
         QUI.FlexibleSpace();
     }
     QUI.EndHorizontal();
 }
        public override void OnInspectorGUI()
        {
            DrawHeader(DUIResources.headerGestureDetector.texture, WIDTH_420, HEIGHT_42);

            serializedObject.Update();

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

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

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

            serializedObject.ApplyModifiedProperties();
            QUI.Space(SPACE_4);
        }
        void 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);
        }
 void DrawDispatcherSelector()
 {
     QUI.BeginHorizontal(WIDTH_420);
     {
         QLabel.text  = "Dispatch";
         QLabel.style = Style.Text.Normal;
         QUI.Label(QLabel);
         QUI.QToggle("Game Events", dispatchGameEvents);
         QUI.QToggle("Button Clicks", dispatchButtonClicks);
         QUI.FlexibleSpace();
     }
     QUI.EndHorizontal();
 }
Esempio n. 10
0
 public override void OnInspectorGUI()
 {
     DrawHeader(DUIResources.headerTouchManager.texture, WIDTH_420, HEIGHT_42);
     serializedObject.Update();
     QUI.QToggle("debug", debug);
     QUI.Space(SPACE_2);
     QUI.QObjectPropertyField("Min Swipe Length", minSwipeLength, GlobalWidth, 20, false);
     QUI.Space(SPACE_2);
     QUI.QObjectPropertyField("Long Tap Duration", longTapDuration, 174, 20, false);
     QUI.Space(SPACE_2);
     QUI.QToggle("use eight directions", useEightDirections);
     serializedObject.ApplyModifiedProperties();
     QUI.Space(SPACE_4);
 }
Esempio n. 11
0
 void DrawDebugOptions(float width)
 {
     QUI.BeginHorizontal(width);
     {
         QUI.LabelWithBackground("Debug");
         QUI.FlexibleSpace();
         QUI.QToggle("GameEvents", debugGameEvents, Style.Text.Small);
         QUI.FlexibleSpace();
         QUI.QToggle("UIButtons", debugUIButtons, Style.Text.Small);
         QUI.FlexibleSpace();
         QUI.QToggle("UIElements", debugUIElements, Style.Text.Small);
         QUI.FlexibleSpace();
         QUI.QToggle("UINotifications", debugUINotifications, Style.Text.Small);
     }
     QUI.EndHorizontal();
 }
 void DrawOverlay(float width)
 {
     QUI.QObjectPropertyField("Overlay", overlay, width, 20, true);
     QUI.BeginHorizontal(width);
     {
         QLabel.text  = "When Closed";
         QLabel.style = Style.Text.Small;
         QUI.LabelWithBackground(QLabel);
         QUI.Space(SPACE_4);
         QUI.QToggle("Disable", disableOverlayWhenClosed);
         QUI.Space(SPACE_4);
         QUI.QToggle("Dont Disable Canvas", dontDisableOverlayCanvasWhenClosed);
         QUI.FlexibleSpace();
     }
     QUI.EndHorizontal();
 }
        void DrawListenSelector(float width)
        {
            GUI.enabled = false; //disable gui interractions

            QUI.BeginHorizontal(width);
            {
                GUI.enabled = !triggerOnButtonClick.boolValue && !triggerOnButtonDoubleClick.boolValue && !triggerOnButtonLongClick.boolValue;
                QUI.BeginChangeCheck();
                QUI.QToggle("game event", triggerOnGameEvent);
                if (QUI.EndChangeCheck())
                {
                    if (triggerOnGameEvent.boolValue && !dispatchAll.boolValue) //if game event has been selected and dispatch all is disabled -> select the text field
                    {
                        QUI.FocusTextInControl("gameEvent");
                    }
                    if (!triggerOnGameEvent.boolValue) //if game event has been disabled -> reset game event string
                    {
                        gameEvent.stringValue = dispatchAll.boolValue ? DUI.DISPATCH_ALL : string.Empty;
                    }
                }

                GUI.enabled = false;
                QUI.Space(SPACE_8);

                GUI.enabled = !triggerOnGameEvent.boolValue && !triggerOnButtonDoubleClick.boolValue && !triggerOnButtonLongClick.boolValue;
                QUI.QToggle("button click", triggerOnButtonClick);

                GUI.enabled = false;
                QUI.Space(SPACE_8);

                GUI.enabled = !triggerOnGameEvent.boolValue && !triggerOnButtonClick.boolValue && !triggerOnButtonLongClick.boolValue;
                QUI.QToggle("double click", triggerOnButtonDoubleClick);

                GUI.enabled = false;
                QUI.Space(SPACE_8);

                GUI.enabled = !triggerOnGameEvent.boolValue && !triggerOnButtonClick.boolValue && !triggerOnButtonDoubleClick.boolValue;
                QUI.QToggle("long click", triggerOnButtonLongClick);

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

            GUI.enabled = true; //enable gui interractions
        }
 void DrawContainer(float width)
 {
     QUI.QObjectPropertyField("Container", container, width, 20, true);
     QUI.BeginHorizontal(width);
     {
         QLabel.text  = "When Closed";
         QLabel.style = Style.Text.Small;
         QUI.LabelWithBackground(QLabel);
         QUI.Space(SPACE_4);
         QUI.QToggle("Fade Out", fadeOutContainerWhenClosed);
         QUI.Space(SPACE_4);
         QUI.QToggle("Disable", disableContainerWhenClosed);
         QUI.Space(SPACE_4);
         QUI.QToggle("Dont Disable Canvas", dontDisableContainerCanvasWhenClosed);
         QUI.FlexibleSpace();
     }
     QUI.EndHorizontal();
     QUI.BeginHorizontal(width);
     {
         QUI.QObjectPropertyField("Container Size", containerSize, width - 160 - 2, 20, false);
         QUI.Space(SPACE_2);
         if (QUI.GhostButton("Update Container", QColors.Color.Gray, 160, 20, false))
         {
             UpdateContainer();
         }
     }
     QUI.EndHorizontal();
     QUI.BeginHorizontal(width);
     {
         if ((UIDrawer.ContainerSize)containerSize.enumValueIndex == UIDrawer.ContainerSize.PercentageOfScreen)
         {
             QUI.QObjectPropertyField("Percentage (0 - 1)", containerPercentageOfScreenSize, (width - 4) * 0.2f, 20, false);
             QUI.Space(SPACE_2);
             QUI.QObjectPropertyField("Min Size", containerMinimumSize, (width - 2) * 0.6f, 20, false);
         }
         else if ((UIDrawer.ContainerSize)containerSize.enumValueIndex == UIDrawer.ContainerSize.FixedSize)
         {
             QUI.QObjectPropertyField("Fixed Size", containerFixedSize, width, 20, false);
         }
     }
     QUI.EndHorizontal();
 }
        void DrawPerformDatabaseUpgrade(float width)
        {
            QUI.BeginHorizontal(width);
            {
                QLabel.text  = "Find";
                QLabel.style = Style.Text.Button;
                if (QUI.GhostButton(QLabel.text, QColors.Color.Gray, QLabel.x + 16, 18))
                {
                    // Load object
                    UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(DUI.RELATIVE_PATH_VERSION + "DUIVersion" + ".asset", typeof(UnityEngine.Object));

                    // Select the object in the project folder
                    Selection.activeObject = obj;

                    // Also flash the folder yellow to highlight it
                    EditorGUIUtility.PingObject(obj);
                }

                QUI.Space(SPACE_2);

                QLabel.text  = "DoozyUI " + Internal.DUIVersion.Instance.version;
                QLabel.style = Style.Text.Button;
                QUI.Label(QLabel);

                QUI.Space(SPACE_2);

                QLabel.text  = "Perform Database Upgrade";
                QLabel.style = Style.Text.Button;
                QUI.BeginChangeCheck();
                Internal.DUIVersion.Instance.performDatabaseUpgrade = QUI.QToggle("Perform Database Upgrade", Internal.DUIVersion.Instance.performDatabaseUpgrade);
                if (QUI.EndChangeCheck())
                {
                    QUI.SetDirty(Internal.DUIVersion.Instance);
                    AssetDatabase.SaveAssets();
                }


                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();
        }
 void DrawTargetFSM()
 {
     QUI.BeginHorizontal(WIDTH_420);
     {
         GUI.enabled = overrideTargetFSM.boolValue;
         QUI.QObjectPropertyField("Target FSM", targetFSM, WIDTH_420 - 78);
         GUI.enabled = true;
         if (targetFSM == null)
         {
             overrideTargetFSM.boolValue = true;
         }
         QUI.QToggle("override", overrideTargetFSM);
     }
     QUI.EndHorizontal();
     QUI.Space(-SPACE_2);
     QUI.BeginHorizontal(WIDTH_420);
     {
         QUI.Space(78);
         QLabel.text  = "FSM Name: " + (playmakerEventDispatcher.targetFSM == null ? "---" : playmakerEventDispatcher.targetFSM.FsmName);
         QLabel.style = Style.Text.Help;
         QUI.Label(QLabel);
     }
     QUI.EndHorizontal();
 }
        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);
        }
 void DrawListenForBackButton(float width)
 {
     QUI.QToggle("Listen for the 'Back' button (close when pressing 'Back' or ESC)", listenForBackButton);
 }
        void DrawArrow(float width)
        {
            QUI.BeginHorizontal(width);
            {
                QUI.QToggle("Show Arrow", showArrow);
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();

            showArrowAnimBool.target = showArrow.boolValue;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            case Gestures.SimpleSwipe.Down: UIDrawer.MatchRectTransform(Drawer.downDrawerArrowOpenedPosition, Drawer.downDrawerArrowClosedPosition); break;
                            }
                        }
                    }
                    QUI.EndHorizontal();
                    QUI.Space(SPACE_2);
                    if (QUI.GhostBar("Show Arrow References", showArrowReferences.target ? QColors.Color.Blue : QColors.Color.Gray, showArrowReferences, width * showArrowAnimBool.faded, MiniBarHeight))
                    {
                        showArrowReferences.target = !showArrowReferences.target;
                    }
                    QUI.BeginHorizontal(width);
                    {
                        QUI.Space(SPACE_8 * showArrowReferences.faded);
                        if (QUI.BeginFadeGroup(showArrowReferences.faded))
                        {
                            QUI.BeginVertical(width - SPACE_8);
                            {
                                QUI.Space(SPACE_4 * showArrowReferences.faded);
                                QUI.QObjectPropertyField("Arrow Container", arrowContainer, width - SPACE_8, 20, true);
                                QUI.Space(SPACE_2 * showArrowReferences.faded);
                                DrawArrowHolder("Left", leftDrawerArrowHolder, leftDrawerArrowClosedPosition, leftDrawerArrowOpenedPosition, width);
                                QUI.Space(SPACE_2 * showArrowReferences.faded);
                                DrawArrowHolder("Right", rightDrawerArrowHolder, rightDrawerArrowClosedPosition, rightDrawerArrowOpenedPosition, width);
                                QUI.Space(SPACE_2 * showArrowReferences.faded);
                                DrawArrowHolder("Up", upDrawerArrowHolder, upDrawerArrowClosedPosition, upDrawerArrowOpenedPosition, width);
                                QUI.Space(SPACE_2 * showArrowReferences.faded);
                                DrawArrowHolder("Down", downDrawerArrowHolder, downDrawerArrowClosedPosition, downDrawerArrowOpenedPosition, width);
                                QUI.Space(SPACE_2 * showArrowReferences.faded);
                            }
                            QUI.EndVertical();
                        }
                        QUI.EndFadeGroup();
                    }
                    QUI.EndHorizontal();
                    QUI.Space(SPACE_2 * showArrowAnimBool.faded);
                }
                QUI.EndVertical();
            }
            QUI.EndFadeGroup();
        }
        void DrawGameEventOptions(float width)
        {
            if (!triggerOnGameEvent.boolValue)
            {
                return;
            }

            buttonCategory.stringValue = DUI.UNCATEGORIZED_CATEGORY_NAME;
            buttonName.stringValue     = DUI.DEFAULT_BUTTON_NAME;

            QUI.BeginHorizontal(width);
            {
                if (dispatchAll.boolValue)                //if dispatchAll is enabled -> set game event to empty and disable the field
                {
                    gameEvent.stringValue = string.Empty; //set game event as an empty string
                    GUI.enabled           = false;        //disable gui
                }

                QLabel.text  = "Game Event";
                QLabel.style = Style.Text.Normal;
                QUI.BeginVertical(QLabel.x, QUI.SingleLineHeight);
                {
                    QUI.Label(QLabel);
                    QUI.Space(SPACE_2);
                }
                QUI.EndVertical();

                tempFloat = QLabel.x;          //save label width

                QLabel.text  = "dispatch all"; //create and calculate a new label
                QLabel.style = Style.Text.Normal;

                tempFloat += QLabel.x; //add the second label width
                tempFloat += 12;       //add the size of a toggle
                tempFloat += 8;        //add space (4 to left and 4 to right)
                tempFloat += 24;

                QUI.SetNextControlName("gameEvent");
                EditorGUILayout.DelayedTextField(gameEvent, GUIContent.none, GUILayout.Width(width - tempFloat));

                GUI.enabled = true; //enable gui in case it was disabled by dispatch all

                QUI.BeginChangeCheck();
                QUI.QToggle("dispatch all", dispatchAll);
                if (QUI.EndChangeCheck())
                {
                    if (triggerOnGameEvent.boolValue)
                    {
                        gameEvent.stringValue = dispatchAll.boolValue ? DUI.DISPATCH_ALL : string.Empty;
                        if (!dispatchAll.boolValue)
                        {
                            QUI.FocusTextInControl("gameEvent");
                        }
                    }
                    else if (triggerOnButtonClick.boolValue || triggerOnButtonDoubleClick.boolValue || triggerOnButtonLongClick.boolValue)
                    {
                        buttonName.stringValue = dispatchAll.boolValue ? DUI.DISPATCH_ALL : DUI.DEFAULT_BUTTON_NAME;
                        if (dispatchAll.boolValue)
                        {
                            buttonCategory.stringValue = DUI.UNCATEGORIZED_CATEGORY_NAME;
                        }
                        else
                        {
                            buttonCategory.stringValue = DUI.UNCATEGORIZED_CATEGORY_NAME;
                            buttonName.stringValue     = DUI.DEFAULT_BUTTON_NAME;
                            ValidateButtonCategoryAndButtonName();
                        }
                    }
                }
                QUI.FlexibleSpace();
            }
            QUI.EndHorizontal();

            infoMessage["SetGameEvent"].show.target = triggerOnGameEvent.boolValue && string.IsNullOrEmpty(gameEvent.stringValue) && !dispatchAll.boolValue;
            DrawInfoMessage("SetGameEvent", GlobalWidth);

            infoMessage["DispatchAllGameEvents"].show.target = dispatchAll.boolValue;
            DrawInfoMessage("DispatchAllGameEvents", width);
        }
        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();
        }
Esempio n. 22
0
 void DrawSettings(float width)
 {
     QUI.QToggle("Auto disable Button Clicks when an UIElement is in trasition", autoDisableButtonClicks);
 }
 void DrawDontDestroyOnLoad(float width)
 {
     QUI.QToggle("Don't Destroy On Load", dontDestroyOnLoad);
 }
 void DrawDebug()
 {
     QUI.QToggle("debug", debug);
 }