public static void SetGameEngine(GameObject _gameEngine = null)
        {
            if (_gameEngine != null)
            {
                gameEnginePrefab = _gameEngine;

                menuSystemComponent        = null;
                playerCursorComponent      = null;
                playerInputComponent       = null;
                playerInteractionComponent = null;
                playerMovementComponent    = null;
                playerMenusComponent       = null;
                playerQTEComponent         = null;
                kickStarterComponent       = null;
                sceneSettingsComponent     = null;
                dialogComponent            = null;
                menuPreviewComponent       = null;
                navigationManagerComponent = null;
                actionListManagerComponent = null;
                localVariablesComponent    = null;
                eventManagerComponent      = null;

                return;
            }

            if (gameEnginePrefab == null)
            {
                SceneSettings sceneSettings = UnityVersionHandler.GetKickStarterComponent <SceneSettings>();
                if (sceneSettings != null)
                {
                    gameEnginePrefab = sceneSettings.gameObject;
                }
            }
        }
Beispiel #2
0
        public override bool ProcessContinuousClick(AC.Menu _menu, MouseState _mouseState)
        {
            switch (buttonClickType)
            {
            case AC_ButtonClickType.SimulateInput:
                if (uiButton && uiPointerState == UIPointerState.PointerClick)
                {
                    // Not applicable here
                    return(false);
                }
                KickStarter.playerInput.SimulateInput(simulateInput, inputAxis, simulateValue);
                return(true);

            case AC_ButtonClickType.CustomScript:
                if (allowContinuousClick)
                {
                    MenuSystem.OnElementClick(_menu, this, 0, (int)_mouseState);
                    return(true);
                }
                return(false);

            default:
                return(false);
            }
        }
Beispiel #3
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);
        }
Beispiel #4
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);
            }
        }
        /**
         * <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);
        }
Beispiel #6
0
        public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (KickStarter.stateHandler.gameState == GameState.Cutscene)
            {
                return;
            }

            base.ProcessClick(_menu, _slot, _mouseState);
            if (uiToggle != null)
            {
                isOn = uiToggle.isOn;
            }
            else
            {
                if (isOn)
                {
                    isOn = false;
                }
                else
                {
                    isOn = true;
                }
            }

            if (toggleType == AC_ToggleType.Subtitles)
            {
                Options.optionsData.showSubtitles = isOn;
                Options.SavePrefs();
            }
            else if (toggleType == AC_ToggleType.Variable)
            {
                if (varID >= 0)
                {
                    GVar var = RuntimeVariables.GetVariable(varID);
                    if (var.type == VariableType.Boolean)
                    {
                        if (isOn)
                        {
                            var.val = 1;
                        }
                        else
                        {
                            var.val = 0;
                        }
                        var.Upload();
                    }
                }
            }

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

            if (actionListOnClick)
            {
                AdvGame.RunActionListAsset(actionListOnClick);
            }
        }
        /**
         * <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);
        }
Beispiel #8
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));
        }
Beispiel #9
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 (buttonClickType == AC_ButtonClickType.SimulateInput)
     {
         KickStarter.playerInput.SimulateInput(simulateInput, inputAxis, simulateValue);
     }
     else if (buttonClickType == AC_ButtonClickType.CustomScript && allowContinuousClick)
     {
         MenuSystem.OnElementClick(_menu, this, 0, (int)_mouseState);
     }
 }
Beispiel #10
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);
        }
Beispiel #11
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);
     }
 }
Beispiel #12
0
        public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (KickStarter.stateHandler.gameState == GameState.Cutscene)
            {
                return;
            }

            if (inventoryBoxType == AC_InventoryBoxType.CustomScript)
            {
                MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState);
            }
            else
            {
                KickStarter.runtimeInventory.ProcessInventoryBoxClick(_menu, this, _slot, _mouseState);
            }
        }
Beispiel #13
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 (buttonClickType == AC_ButtonClickType.SimulateInput)
     {
         if (uiButton != null && uiPointerState == UIPointerState.PointerClick)
         {
             // Not applicable here
             return;
         }
         KickStarter.playerInput.SimulateInput(simulateInput, inputAxis, simulateValue);
     }
     else if (buttonClickType == AC_ButtonClickType.CustomScript && allowContinuousClick)
     {
         MenuSystem.OnElementClick(_menu, this, 0, (int)_mouseState);
     }
 }
Beispiel #14
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);
            }
        }
Beispiel #15
0
        /**
         * <summary>Unsets the values of all script variables, so that they can be re-assigned to the correct scene if multiple scenes are open.</summary>
         */
        public void ClearVariables()
        {
            playerPrefab           = null;
            mainCameraPrefab       = null;
            persistentEnginePrefab = null;
            gameEnginePrefab       = null;

            // Managers
            sceneManagerPrefab     = null;
            settingsManagerPrefab  = null;
            actionsManagerPrefab   = null;
            variablesManagerPrefab = null;
            inventoryManagerPrefab = null;
            speechManagerPrefab    = null;
            cursorManagerPrefab    = null;
            menuManagerPrefab      = null;

            // PersistentEngine components
            optionsComponent                = null;
            runtimeInventoryComponent       = null;
            runtimeVariablesComponent       = null;
            playerMenusComponent            = null;
            stateHandlerComponent           = null;
            sceneChangerComponent           = null;
            saveSystemComponent             = null;
            levelStorageComponent           = null;
            runtimeLanguagesComponent       = null;
            actionListAssetManagerComponent = null;

            // GameEngine components
            menuSystemComponent        = null;
            dialogComponent            = null;
            playerInputComponent       = null;
            playerInteractionComponent = null;
            playerMovementComponent    = null;
            playerCursorComponent      = null;
            playerQTEComponent         = null;
            sceneSettingsComponent     = null;
            navigationManagerComponent = null;
            actionListManagerComponent = null;
            localVariablesComponent    = null;
            menuPreviewComponent       = null;
            eventManagerComponent      = null;

            SetGameEngine();
        }
Beispiel #16
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));
        }
Beispiel #17
0
        public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (KickStarter.stateHandler.gameState == GameState.Cutscene)
            {
                return;
            }

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

            if (cycleType == AC_CycleType.Language)
            {
                if (selected == 0 && KickStarter.speechManager.ignoreOriginalText && KickStarter.speechManager.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 = RuntimeVariables.GetVariable(varID);
                    if (var.type == VariableType.Integer)
                    {
                        var.val = selected;
                        var.Upload();
                    }
                }
            }

            if (cycleType == AC_CycleType.CustomScript)
            {
                MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState);
            }
        }
		private void OnDestroy ()
		{
			actionListManager = null;
			dialog = null;
			playerInput = null;
			playerInteraction = null;
			menuSystem = null;
			stateHandler = null;
			options = null;
			menus = null;
			runtimeInventory = null;
			settingsManager = null;
			cursorManager = null;
			speechManager = null;
			menuManager = null;
			sceneSettings = null;
		}
Beispiel #19
0
        /**
         * <summary>Unsets the values of all script variables, so that they can be re-assigned to the correct scene if multiple scenes are open.</summary>
         */
        public void ClearVariables()
        {
            playerPrefab = null;
            mainCameraPrefab = null;
            persistentEnginePrefab = null;
            gameEnginePrefab = null;

            // Managers
            sceneManagerPrefab = null;
            settingsManagerPrefab = null;
            actionsManagerPrefab = null;
            variablesManagerPrefab = null;
            inventoryManagerPrefab = null;
            speechManagerPrefab = null;
            cursorManagerPrefab = null;
            menuManagerPrefab = null;

            // PersistentEngine components
            optionsComponent = null;
            runtimeInventoryComponent = null;
            runtimeVariablesComponent = null;
            playerMenusComponent = null;
            stateHandlerComponent = null;
            sceneChangerComponent = null;
            saveSystemComponent = null;
            levelStorageComponent = null;
            runtimeLanguagesComponent = null;

            // GameEngine components
            menuSystemComponent = null;
            dialogComponent = null;
            playerInputComponent = null;
            playerInteractionComponent = null;
            playerMovementComponent = null;
            playerCursorComponent = null;
            playerQTEComponent = null;
            sceneSettingsComponent = null;
            navigationManagerComponent = null;
            actionListManagerComponent = null;
            localVariablesComponent = null;
            menuPreviewComponent = null;

            SetGameEngine ();
        }
Beispiel #20
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));
        }
Beispiel #21
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);
        }
Beispiel #22
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);
            }
        }
Beispiel #23
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 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);
        }
		private void GetReferences ()
		{
			settingsManager = AdvGame.GetReferences ().settingsManager;
			if (settingsManager.IsInLoadingScene ())
			{
				return;
			}
			
			speechManager = AdvGame.GetReferences ().speechManager;
			cursorManager = AdvGame.GetReferences ().cursorManager;
			menuManager = AdvGame.GetReferences ().menuManager;
			
			playerCursor = GameObject.FindWithTag (Tags.gameEngine).GetComponent <PlayerCursor>();
			actionListManager = playerCursor.GetComponent <ActionListManager>();
			playerInput = playerCursor.GetComponent <PlayerInput>();
			playerInteraction = playerCursor.GetComponent <PlayerInteraction>();
			menuSystem = playerCursor.GetComponent <MenuSystem>();
			dialog = playerCursor.GetComponent <Dialog>();
			sceneSettings = playerCursor.GetComponent <SceneSettings>();
			
			stateHandler = this.GetComponent <StateHandler>();
			options = this.GetComponent <Options>();
			runtimeInventory = this.GetComponent <RuntimeInventory>();
		}