Exemple #1
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);
        }
        /**
         * <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);
        }
        /**
         * <summary>Recalculates the element's size.
         * This should be called whenever a Menu's shape is changed.</summary>
         * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param>
         */
        public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (!_menu.IsClickable())
            {
                return;
            }

            if (uiToggle != null)
            {
                isOn = uiToggle.isOn;
            }
            else
            {
                if (isOn)
                {
                    isOn = false;
                }
                else
                {
                    isOn = true;
                }
            }

            if (toggleType == AC_ToggleType.Subtitles)
            {
                Options.SetSubtitles(isOn);
            }
            else if (toggleType == AC_ToggleType.Variable)
            {
                if (varID >= 0)
                {
                    GVar var = GlobalVariables.GetVariable(varID);
                    if (var.type == VariableType.Boolean)
                    {
                        if (isOn)
                        {
                            var.val = 1;
                        }
                        else
                        {
                            var.val = 0;
                        }
                        var.Upload(VariableLocation.Global);
                    }
                }
            }

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

            if (actionListOnClick)
            {
                AdvGame.RunActionListAsset(actionListOnClick);
            }

            base.ProcessClick(_menu, _slot, _mouseState);
        }
Exemple #4
0
        public override bool ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (!_menu.IsClickable())
            {
                return(false);
            }

            if (uiToggle)
            {
                isOn = uiToggle.isOn;
            }
            else
            {
                if (isOn)
                {
                    isOn = false;
                }
                else
                {
                    isOn = true;
                }
            }

            switch (toggleType)
            {
            case AC_ToggleType.Subtitles:
                Options.SetSubtitles(isOn);
                break;

            case AC_ToggleType.Variable:
                if (varID >= 0)
                {
                    GVar var = GlobalVariables.GetVariable(varID);
                    if (var.type == VariableType.Boolean)
                    {
                        var.IntegerValue = (isOn) ? 1 : 0;
                        var.Upload(VariableLocation.Global);
                    }
                }
                break;

            case AC_ToggleType.CustomScript:
                MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState);
                break;

            default:
                break;
            }

            if (actionListOnClick)
            {
                AdvGame.RunActionListAsset(actionListOnClick);
            }

            return(base.ProcessClick(_menu, _slot, _mouseState));
        }
        /**
         * <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;
            }

            KickStarter.playerMenus.SelectInputBox(this);
            base.ProcessClick(_menu, _slot, _mouseState);
        }
Exemple #6
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;
            }

            base.ProcessClick(_menu, _slot, _mouseState);

            selected++;
            if (selected > optionsArray.Count - 1)
            {
                selected = 0;
            }

            if (cycleType == AC_CycleType.Language)
            {
                if (selected == 0 && KickStarter.speechManager.ignoreOriginalText && KickStarter.runtimeLanguages.Languages.Count > 1)
                {
                    // Ignore original text by skipping to first language
                    selected = 1;
                }
                Options.SetLanguage(selected);
            }
            else if (cycleType == AC_CycleType.Variable)
            {
                if (varID >= 0)
                {
                    GVar var = GlobalVariables.GetVariable(varID);
                    if (var.type == VariableType.Integer)
                    {
                        var.val = selected;
                        var.Upload();
                    }
                }
            }

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

            if (actionListOnClick)
            {
                AdvGame.RunActionListAsset(actionListOnClick);
            }
        }
Exemple #7
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));
        }
Exemple #8
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 (uiDropdown != null)
            {
                selected = uiDropdown.value;
            }
            else
            {
                CycleOption();
            }

            if (cycleType == AC_CycleType.Language)
            {
                if (selected == 0 && KickStarter.speechManager.ignoreOriginalText && KickStarter.runtimeLanguages.Languages.Count > 1)
                {
                    // Ignore original text by skipping to first language
                    selected = 1;
                }

                if (KickStarter.speechManager != null && KickStarter.speechManager.separateVoiceAndTextLanguages)
                {
                    switch (splitLanguageType)
                    {
                    case SplitLanguageType.TextAndVoice:
                        Options.SetLanguage(selected);
                        Options.SetVoiceLanguage(selected);
                        break;

                    case SplitLanguageType.TextOnly:
                        Options.SetLanguage(selected);
                        break;

                    case SplitLanguageType.VoiceOnly:
                        Options.SetVoiceLanguage(selected);
                        break;
                    }
                }
                else
                {
                    Options.SetLanguage(selected);
                }
            }
            else if (cycleType == AC_CycleType.Variable)
            {
                if (linkedVariable != null)
                {
                    linkedVariable.IntegerValue = selected;
                    linkedVariable.Upload();
                }
            }

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

            if (actionListOnClick)
            {
                AdvGame.RunActionListAsset(actionListOnClick);
            }

            base.ProcessClick(_menu, _slot, _mouseState);
        }
Exemple #9
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;
            }

            base.ProcessClick(_menu, _slot, _mouseState);

            ShowClick();

            if (buttonClickType == AC_ButtonClickType.TurnOffMenu)
            {
                _menu.TurnOff(doFade);
            }
            else if (buttonClickType == AC_ButtonClickType.Crossfade)
            {
                AC.Menu menuToSwitchTo = PlayerMenus.GetMenuWithName(switchMenuTitle);

                if (menuToSwitchTo != null)
                {
                    KickStarter.playerMenus.CrossFade(menuToSwitchTo);
                }
                else
                {
                    ACDebug.LogWarning("Cannot find any menu of name '" + switchMenuTitle + "'");
                }
            }
            else if (buttonClickType == AC_ButtonClickType.OffsetElementSlot)
            {
                if (elementToShift != null)
                {
                    elementToShift.Shift(shiftInventory, shiftAmount);
                    elementToShift.RecalculateSize(_menu.menuSource);
                    _menu.Recalculate();
                }
                else
                {
                    ACDebug.LogWarning("Cannot find '" + inventoryBoxTitle + "' inside '" + _menu.title + "'");
                }
            }
            else if (buttonClickType == AC_ButtonClickType.OffsetJournal)
            {
                MenuJournal journalToShift = (MenuJournal)PlayerMenus.GetElementWithName(_menu.title, inventoryBoxTitle);

                if (journalToShift != null)
                {
                    journalToShift.Shift(shiftInventory, loopJournal, shiftAmount);
                    journalToShift.RecalculateSize(_menu.menuSource);
                    _menu.Recalculate();
                }
                else
                {
                    ACDebug.LogWarning("Cannot find '" + inventoryBoxTitle + "' inside '" + _menu.title + "'");
                }
            }
            else if (buttonClickType == AC_ButtonClickType.RunActionList)
            {
                if (actionList)
                {
                    if (!actionList.canRunMultipleInstances)
                    {
                        KickStarter.actionListAssetManager.EndAssetList(actionList);
                    }

                    AdvGame.RunActionListAsset(actionList, parameterID, parameterValue);
                }
            }
            else if (buttonClickType == AC_ButtonClickType.CustomScript)
            {
                MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState);
            }
            else if (buttonClickType == AC_ButtonClickType.SimulateInput)
            {
                KickStarter.playerInput.SimulateInput(simulateInput, inputAxis, simulateValue);
            }
        }
        /**
         * <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 UNITY_5_3_OR_NEWER
            if (uiDropdown != null)
            {
                selected = uiDropdown.value;
            }
            else
            {
                selected++;
                if (selected > optionsArray.Count - 1)
                {
                    selected = 0;
                }
            }
                        #else
            selected++;
            if (selected > optionsArray.Count - 1)
            {
                selected = 0;
            }
                        #endif

            if (cycleType == AC_CycleType.Language)
            {
                if (selected == 0 && KickStarter.speechManager.ignoreOriginalText && KickStarter.runtimeLanguages.Languages.Count > 1)
                {
                    // Ignore original text by skipping to first language
                    selected = 1;
                }

                if (KickStarter.speechManager != null && KickStarter.speechManager.separateVoiceAndTextLanguages)
                {
                    switch (splitLanguageType)
                    {
                    case SplitLanguageType.TextAndVoice:
                        Options.SetLanguage(selected);
                        Options.SetVoiceLanguage(selected);
                        break;

                    case SplitLanguageType.TextOnly:
                        Options.SetLanguage(selected);
                        break;

                    case SplitLanguageType.VoiceOnly:
                        Options.SetVoiceLanguage(selected);
                        break;
                    }
                }
                else
                {
                    Options.SetLanguage(selected);
                }
            }
            else if (cycleType == AC_CycleType.Variable)
            {
                if (varID >= 0)
                {
                    GVar var = GlobalVariables.GetVariable(varID);
                    if (var.type == VariableType.Integer)
                    {
                        var.val = selected;
                        var.Upload(VariableLocation.Global);
                    }
                }
            }

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

            if (actionListOnClick)
            {
                AdvGame.RunActionListAsset(actionListOnClick);
            }

            base.ProcessClick(_menu, _slot, _mouseState);
        }