예제 #1
0
        public override bool ProcessContinuousClick(AC.Menu _menu, MouseState _mouseState)
        {
            if (KickStarter.stateHandler.gameState == GameState.Cutscene)
            {
                return(false);
            }

            float originalVisualAmount = visualAmount;

            if (uiSlider)
            {
                visualAmount = uiSlider.value;
                UpdateValue();
            }
            else
            {
                if ((KickStarter.stateHandler.gameState == GameState.DialogOptions && KickStarter.menuManager.keyboardControlWhenDialogOptions) ||
                    (KickStarter.stateHandler.gameState == GameState.Paused && KickStarter.menuManager.keyboardControlWhenPaused) ||
                    (KickStarter.stateHandler.IsInGameplay() && KickStarter.playerInput.canKeyboardControlMenusDuringGameplay))
                {
                    // Direct-controlling
                }
                else
                {
                    switch (sliderOrientation)
                    {
                    case SliderOrientation.Horizontal:
                        Change(KickStarter.playerInput.GetMousePosition().x - _menu.GetRect().x);
                        break;

                    case SliderOrientation.Vertical:
                        Change(KickStarter.playerInput.GetInvertedMouse().y - _menu.GetRect().y);
                        break;

                    default:
                        break;
                    }
                }
            }

            if (sliderType == AC_SliderType.CustomScript)
            {
                MenuSystem.OnElementClick(_menu, this, 0, (int)_mouseState);
            }

            if (clickSound && originalVisualAmount != visualAmount)
            {
                KickStarter.sceneSettings.PlayDefaultSound(clickSound, false, true);
            }

            return(true);
        }
예제 #2
0
        /**
         * <summary>Performs what should happen when the element is clicked on.</summary>
         * <param name = "_menu">The element's parent Menu</param>
         * <param name = "_slot">Ignored by this subclass</param>
         * <param name = "_mouseState">The state of the mouse button</param>
         */
        public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (!_menu.IsClickable())
            {
                return;
            }

            if (uiSlider != null)
            {
                visualAmount = uiSlider.value;
                UpdateValue();
            }
            else
            {
                if (KickStarter.settingsManager.inputMethod == InputMethod.KeyboardOrController)
                {
                    Change();
                }
                else
                {
                    Change(KickStarter.playerInput.GetMousePosition().x - _menu.GetRect().x);
                }
            }

            if (sliderType == AC_SliderType.CustomScript)
            {
                MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState);
            }

            KickStarter.eventManager.Call_OnMenuElementClick(_menu, this, _slot, (int)_mouseState);
        }
예제 #3
0
        /**
         * <summary>Performs what should happen when the element is clicked on continuously.</summary>
         * <param name = "_menu">The element's parent Menu</param>
         * <param name = "_mouseState">The state of the mouse button</param>
         */
        public override void ProcessContinuousClick(AC.Menu _menu, MouseState _mouseState)
        {
            if (KickStarter.stateHandler.gameState == GameState.Cutscene)
            {
                return;
            }

            if (uiSlider != null)
            {
                visualAmount = uiSlider.value;
                UpdateValue();
            }
            else
            {
                if (KickStarter.settingsManager.inputMethod == InputMethod.KeyboardOrController)
                {
                    Change();
                }
                else
                {
                    Change(KickStarter.playerInput.GetMousePosition().x - _menu.GetRect().x);
                }
            }

            if (sliderType == AC_SliderType.CustomScript)
            {
                MenuSystem.OnElementClick(_menu, this, 0, (int)_mouseState);
            }
        }
예제 #4
0
        /**
         * <summary>Performs what should happen when the element is clicked on.</summary>
         * <param name = "_menu">The element's parent Menu</param>
         * <param name = "_slot">Ignored by this subclass</param>
         * <param name = "_mouseState">The state of the mouse button</param>
         */
        public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (!_menu.IsClickable())
            {
                return;
            }

            if (uiSlider != null)
            {
                visualAmount = uiSlider.value;
                UpdateValue();
            }
            else
            {
                if (KickStarter.playerInput.canKeyboardControlMenusDuringGameplay &&
                    (KickStarter.stateHandler.gameState == GameState.DialogOptions ||
                     KickStarter.stateHandler.gameState == GameState.Paused ||
                     (KickStarter.stateHandler.IsInGameplay() && KickStarter.playerInput.canKeyboardControlMenusDuringGameplay)))
                {
                    Change();
                }
                else
                {
                    Change(KickStarter.playerInput.GetMousePosition().x - _menu.GetRect().x);
                }
            }

            if (sliderType == AC_SliderType.CustomScript)
            {
                MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState);
            }

            KickStarter.eventManager.Call_OnMenuElementClick(_menu, this, _slot, (int)_mouseState);
        }
예제 #5
0
        public override bool ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (!_menu.IsClickable())
            {
                return(false);
            }

            if (uiSlider)
            {
                visualAmount = uiSlider.value;
                UpdateValue();
            }
            else
            {
                if ((KickStarter.stateHandler.gameState == GameState.DialogOptions && KickStarter.menuManager.keyboardControlWhenDialogOptions) ||
                    (KickStarter.stateHandler.gameState == GameState.Paused && KickStarter.menuManager.keyboardControlWhenPaused) ||
                    (KickStarter.stateHandler.IsInGameplay() && KickStarter.playerInput.canKeyboardControlMenusDuringGameplay))
                {
                    // Direct-controlling
                }
                else
                {
                    switch (sliderOrientation)
                    {
                    case SliderOrientation.Horizontal:
                        Change(KickStarter.playerInput.GetMousePosition().x - _menu.GetRect().x);
                        break;

                    case SliderOrientation.Vertical:
                        Change(KickStarter.playerInput.GetInvertedMouse().y - _menu.GetRect().y);
                        break;

                    default:
                        break;
                    }
                }
            }

            if (sliderType == AC_SliderType.CustomScript)
            {
                MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState);
            }

            return(base.ProcessClick(_menu, _slot, _mouseState));
        }
예제 #6
0
 public override void ProcessContinuousClick(AC.Menu _menu, MouseState _mouseState)
 {
     if (KickStarter.settingsManager.inputMethod == InputMethod.KeyboardOrController)
     {
         Change();
     }
     else
     {
         Change(KickStarter.playerInput.GetMousePosition().x - _menu.GetRect().x);
     }
     if (sliderType == AC_SliderType.CustomScript)
     {
         MenuSystem.OnElementClick(_menu, this, 0, (int)_mouseState);
     }
 }
예제 #7
0
        private void OnGUI()
        {
            if (!Application.isPlaying)
            {
                if (AdvGame.GetReferences())
                {
                    menuManager = AdvGame.GetReferences().menuManager;

                    if (menuManager && menuManager.drawInEditor && AdvGame.GetReferences().viewingMenuManager)
                    {
                        if (menuManager.GetSelectedMenu() != null)
                        {
                            AC.Menu menu = menuManager.GetSelectedMenu();

                            if (menu.IsUnityUI())
                            {
                                return;
                            }

                            CheckScreenSize(menu);

                            if ((menu.appearType == AppearType.Manual || menu.appearType == AppearType.OnInputKey) && menu.pauseWhenEnabled && menuManager.pauseTexture)
                            {
                                GUI.DrawTexture(AdvGame.GUIRect(0.5f, 0.5f, 1f, 1f), menuManager.pauseTexture, ScaleMode.ScaleToFit, true, 0f);
                            }

                            if ((menu.positionType == AC_PositionType.FollowCursor || menu.positionType == AC_PositionType.AppearAtCursorAndFreeze || menu.positionType == AC_PositionType.OnHotspot || menu.positionType == AC_PositionType.AboveSpeakingCharacter || menu.positionType == AC_PositionType.AbovePlayer) && AdvGame.GetReferences().cursorManager&& AdvGame.GetReferences().cursorManager.pointerIcon.texture)
                            {
                                CursorIconBase icon = AdvGame.GetReferences().cursorManager.pointerIcon;
                                GUI.DrawTexture(AdvGame.GUIBox(new Vector2(AdvGame.GetMainGameViewSize().x / 2f, AdvGame.GetMainGameViewSize().y / 2f), icon.size), icon.texture, ScaleMode.ScaleToFit, true, 0f);
                            }

                            menu.StartDisplay();

                            foreach (MenuElement element in menu.visibleElements)
                            {
                                SetStyles(element);

                                for (int i = 0; i < element.GetNumSlots(); i++)
                                {
                                    if (menuManager.GetSelectedElement() == element && element.isClickable && i == 0)
                                    {
                                        //	element.PreDisplay (i, true, 0);
                                        element.Display(highlightedStyle, i, 1f, true);
                                    }

                                    else
                                    {
                                        //	element.PreDisplay (i, true, 0);
                                        element.Display(normalStyle, i, 1f, false);
                                    }
                                }

                                if (UnityEditor.EditorWindow.mouseOverWindow != null && UnityEditor.EditorWindow.mouseOverWindow.ToString().Contains("(UnityEditor.GameView)"))
                                {
                                    if (menu.IsPointerOverSlot(element, 0, Event.current.mousePosition + new Vector2(menu.GetRect().x, menu.GetRect().y)))
                                    {
                                        menuManager.SelectElementFromPreview(menu, element);
                                    }
                                }
                            }

                            menu.EndDisplay();

                            if (menuManager.drawOutlines)
                            {
                                menu.DrawOutline(menuManager.GetSelectedElement());
                            }
                        }
                    }
                }
            }
        }