/// <summary>
 ///
 /// </summary>
 private void Update()
 {
     if (InputHelper.AnyButtonDown(StartActionName))
     {
         SettingsPanelNavigationHandler.CloseSettingsPanel();
     }
 }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="data"></param>
        private IEnumerator OnSubmit(UINavigationData data)
        {
            var shakeTime     = 0.5f;
            var shakeStrenght = 5f;
            var shakeVibrato  = 50;

            switch (data.actionName)
            {
            case "Start":
                data.navigationHandler.Unfocus();
                ShakeAllControllers();
                MatchSettingsManager.showMaps = false;
                yield return(UITitleScreenPanel.titleScreenPanelInstance.playButton.transform.DOShakePosition(shakeTime, shakeStrenght, shakeVibrato).WaitForCompletion());

                UITitleScreenPanel.CloseTitleScreenPanel();
                break;

            case "Settings":
                data.navigationHandler.Unfocus();
                ShakeAllControllers();
                yield return(UITitleScreenPanel.titleScreenPanelInstance.settingsButton.transform.DOShakePosition(shakeTime, shakeStrenght, shakeVibrato).WaitForCompletion());

                UITitleScreenPanel.titleScreenPanelInstance.gameObject.SetActive(false);

                SettingsPanelNavigationHandler.OpenSettingsPanel(() =>
                {
                    data.navigationHandler.Focus();
                    UITitleScreenPanel.titleScreenPanelInstance.gameObject.SetActive(true);
                });
                break;

            case "Credits":
                data.navigationHandler.Unfocus();
                ShakeAllControllers();
                yield return(UITitleScreenPanel.titleScreenPanelInstance.creditsButton.transform.DOShakePosition(shakeTime, shakeStrenght, shakeVibrato).WaitForCompletion());

                UITitleScreenPanel.titleScreenPanelInstance.gameObject.SetActive(false);
                var credits = FindObjectOfType <Credits>();
                credits?.StartCredits(() =>
                {
                    data.navigationHandler.Focus();
                    UITitleScreenPanel.titleScreenPanelInstance.gameObject.SetActive(true);
                });
                UITitleScreenPanel.titleScreenPanelInstance.gameObject.SetActive(false);
                break;

            case "QuitGame":
                data.navigationHandler.Unfocus();
                ShakeAllControllers();
                MenuMusicController.StopMusic();
                yield return(UITitleScreenPanel.titleScreenPanelInstance.quitButton.transform.DOShakePosition(shakeTime, shakeStrenght, shakeVibrato).WaitForCompletion());

                GameplayStatics.TransitionToScene(GameConstants.SupportScene);
                break;
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="data"></param>
        private void OnSubmit(UINavigationData data)
        {
            switch (data.actionName)
            {
            case "Resume":
                GameplayStatics.UnpauseGame();
                break;

            case "Rematch":
                StopMusic();
                GameplayStatics.TransitionToScene(
                    UnityEngine.SceneManagement.SceneManager.GetActiveScene().name
                    );
                break;

            case "Settings":
                data.navigationHandler.Unfocus();
                _pausePanel.gameObject.SetActive(false);

                SettingsPanelNavigationHandler.OpenSettingsPanel(() =>
                {
                    _pausePanel.gameObject.SetActive(true);
                    data.navigationHandler.Focus();
                });
                break;

            case "QuitGame":
                StopMusic();
                GameplayStatics.TransitionToScene(
                    GameConstants.TitleScreenScene
                    );
                break;

            case "ChangeMap":
                MatchSettingsManager.showMaps = true;
                StopMusic();
                GameplayStatics.TransitionToScene(
                    GameConstants.MatchSettingsScene
                    );
                break;
            }
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        private void Update()
        {
            if (_gameStarted)
            {
                return;
            }

            if (InputHelper.AnyButtonDown(SettingsInputName))
            {
                var settingPanel = GameObject.FindObjectOfType <SettingsPanelNavigationHandler>();

                if (settingPanel == null)
                {
                    var allNavigation = GetComponentsInChildren <UINavigation>();
                    foreach (var navigation in allNavigation)
                    {
                        navigation.Unfocus();
                    }

                    SettingsPanelNavigationHandler.OpenSettingsPanel(() =>
                    {
                        foreach (var navigation in allNavigation)
                        {
                            navigation.Focus();
                        }
                    });
                }
                else
                {
                    SettingsPanelNavigationHandler.CloseSettingsPanel();
                }
            }

            if (InputHelper.AnyButtonDown(AddCPUInputName))
            {
                var nextCharacterCPU = _characterSettings.FirstOrDefault(x => !x.isJoining);
                if (nextCharacterCPU != null)
                {
                    nextCharacterCPU.useCPU = true;
                }
            }

            if (InputHelper.AnyButtonDown(RemoveCPUInputName))
            {
                var lastCharacterCPU = _characterSettings.LastOrDefault(x => x.useCPU);
                if (lastCharacterCPU != null)
                {
                    lastCharacterCPU.useCPU = false;
                }
            }

            switch (_state)
            {
            case State.CharacterSelection:
                UpdateCharacterSelection();
                break;

            case State.MapSelection:
                UpdateMapSelection();
                break;

            case State.Transition:
                _elapsedSinceBack = Mathf.Max(0.0f, _elapsedSinceBack - GameplayStatics.gameDeltaTime);
                UpdateBackMask();
                break;
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="action"></param>
 private void OnCancel(UINavigationData action)
 {
     SettingsPanelNavigationHandler.CloseSettingsPanel();
 }