예제 #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 (KickStarter.stateHandler.gameState == GameState.Cutscene)
            {
                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)
                {
                    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);
            }
        }
예제 #2
0
        public override bool ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (!_menu.IsClickable() || _mouseState != MouseState.SingleClick)
            {
                return(false);
            }

            ShowClick();

            switch (buttonClickType)
            {
            case AC_ButtonClickType.TurnOffMenu:
                _menu.TurnOff(doFade);
                break;

            case AC_ButtonClickType.Crossfade:
                Menu menuToSwitchTo = PlayerMenus.GetMenuWithName(switchMenuTitle);
                if (menuToSwitchTo != null)
                {
                    KickStarter.playerMenus.CrossFade(menuToSwitchTo);
                }
                else
                {
                    ACDebug.LogWarning("Cannot find any menu of name '" + switchMenuTitle + "'");
                }
                break;

            case 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 + "'");
                }
                break;

            case 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 + "'");
                }
                break;

            case AC_ButtonClickType.RunActionList:
                if (actionList)
                {
                    if (!actionList.canRunMultipleInstances)
                    {
                        KickStarter.actionListAssetManager.EndAssetList(actionList);
                    }
                    AdvGame.RunActionListAsset(actionList, parameterID, parameterValue);
                }
                break;

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

            case AC_ButtonClickType.SimulateInput:
                KickStarter.playerInput.SimulateInput(simulateInput, inputAxis, simulateValue);
                break;

            default:
                break;
            }

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