コード例 #1
0
    /// <summary>
    /// Call this method to init game over menu ui.
    /// </summary>
    private void OnGameOverMenuInit()
    {
        _GameOverMenuGameObject.SetActive(true);
        _currentVerticalMenuChoice = 0;

        for (int i = 0; i < _GameOverMenuList.Count; i++)
        {
            _GameOverMenuList[i].SetTextActiveState(this, true);
            if (i == _currentVerticalMenuChoice)
            {
                _GameOverMenuList[i].OnSelect(this);
            }
            else
            {
                _GameOverMenuList[i].OnDeSelect(this);
            }
        }

        OnChangeMenuScene?.Invoke(MenuScene.GameOver);
    }
コード例 #2
0
    /// <summary>
    /// Call this method to open next menu scene.
    /// </summary>
    public void OpenNextMenu()
    {
        MenuScene currentScene = MenuManager.Instance.CurrentMenuScene;

        switch (currentScene)
        {
        case MenuScene.MainMenu:
        {
            MenuScene selectOption = _MainMenuList[_currentVerticalMenuChoice].MenuScene;

            switch (selectOption)
            {
            case MenuScene.CustomMenu:
            {
                OnCustomMenuInit();
                _MainMenuGameObject.SetActive(false);
                _CustomMenuGameObject.SetActive(true);
                _GameStartMenuGameObject.SetActive(false);
                _GameOverMenuGameObject.SetActive(false);
                OnChangeMenuScene?.Invoke(selectOption);
            }
            break;

            case MenuScene.Game:
            {
                _MainMenuGameObject.SetActive(false);
                _CustomMenuGameObject.SetActive(false);
                _GameStartMenuGameObject.SetActive(true);
                _GameOverMenuGameObject.SetActive(false);
                GameUIInit(MenuManager.Instance.Data);
                OnChangeMenuScene?.Invoke(selectOption);
                OnInGameSceneActive?.Invoke(MenuManager.Instance.Data);
            }
            break;
            }
        }
        break;

        case MenuScene.CustomMenu:
        {
            if (_currentVerticalMenuChoice != (int)CustomMenuOrder.ConfirmMenu)
            {
                return;
            }

            MenuScene selectOption = _CustomMenuList[(int)CustomMenuOrder.ConfirmMenu].MenuSceneList[_confirmMenuIndex];

            switch (selectOption)
            {
            case MenuScene.MainMenu:
            {
                OnOpenGame_MainMenuInit();
                _MainMenuGameObject.SetActive(true);
                _CustomMenuGameObject.SetActive(false);
                _GameStartMenuGameObject.SetActive(false);
                _GameOverMenuGameObject.SetActive(false);
                OnChangeMenuScene?.Invoke(selectOption);
            }
            break;

            case MenuScene.Game:
            {
                GameData data = new GameData(MenuManager.Instance.Data);
                data.UpdateData(_lifeSetting, _speedSetting, _bulletSetting);
                _MainMenuGameObject.SetActive(false);
                _CustomMenuGameObject.SetActive(false);
                _GameStartMenuGameObject.SetActive(true);
                _GameOverMenuGameObject.SetActive(false);
                GameUIInit(data);
                OnChangeMenuScene?.Invoke(selectOption);
                OnInGameSceneActive?.Invoke(data);
            }
            break;
            }
        }
        break;

        case MenuScene.GameOver:
        {
            MenuScene selectOption = _GameOverMenuList[_currentVerticalMenuChoice].MenuScene;

            foreach (MenuItemUI menuItemUi in _GameOverMenuList)
            {
                menuItemUi.OnDeSelect(this);
            }

            switch (selectOption)
            {
            case MenuScene.MainMenu:
            {
                OnOpenGame_MainMenuInit();
                _MainMenuGameObject.SetActive(true);
                _CustomMenuGameObject.SetActive(false);
                _GameStartMenuGameObject.SetActive(false);
                _GameOverMenuGameObject.SetActive(false);
                OnChangeMenuScene?.Invoke(selectOption);
                OnResetGameScene?.Invoke();
            }
            break;

            case MenuScene.Game:
            {
                _MainMenuGameObject.SetActive(false);
                _CustomMenuGameObject.SetActive(false);
                _GameStartMenuGameObject.SetActive(true);
                _GameOverMenuGameObject.SetActive(false);
                GameUIInit(GameManager.Instance.Data);
                OnChangeMenuScene?.Invoke(selectOption);
                OnInGameSceneActive?.Invoke(GameManager.Instance.Data);
                OnResetGameScene?.Invoke();
            }
            break;
            }
        }
        break;
        }
    }