Example #1
0
    /// <summary>
    /// Главная управляющая процедура
    /// </summary>
    public void MainControl(TypeSystemActions TSA)
    {
        // Список действий пользователя
        ListActions.Add(TSA);
        switch (TSA)
        {
        case TypeSystemActions.ShowStartMenu:
            SetScreen(TypeScreens.StartMenu);
            break;

        case TypeSystemActions.StartGame:
            GetOptionsValues();
            SetScreen(TypeScreens.Game);
            this.GetComponent <Game>().StartNewGame();
            break;

        case TypeSystemActions.LoadGame:
            SetScreen(TypeScreens.Game);
            this.GetComponent <Game>().LoadGame();
            break;

        case TypeSystemActions.ShowGameScreen:
            SetScreen(TypeScreens.Game);
            break;

        case TypeSystemActions.SoundTurn:
            /*---------- З А Г Л У Ш К А ----------*/
            break;
            break;

        case TypeSystemActions.Close:
            /*---------- З А Г Л У Ш К А ----------*/
            switch (CurrentScreen)
            {
            case TypeScreens.LevelEditor:

                break;
            }
            break;

        case TypeSystemActions.BackToStartMenu:
            if (ListActions[ListActions.Count - 2] == TypeSystemActions.ShowOptions)
            {
                GetOptionsValues();
            }
            if (CurrentScreen == TypeScreens.PauseGameMenu)
            {
                this.GetComponent <Game>().SaveGame();
            }
            SetScreen(TypeScreens.StartMenu);
            break;

        case TypeSystemActions.ShowOptions:
            SetScreen(TypeScreens.Options);
            break;

        case TypeSystemActions.ShowLevelEditor:
            SetScreen(TypeScreens.LevelEditor);
            break;

        case TypeSystemActions.ShowLevelEditorMenu:
            SetScreen(TypeScreens.LevelEditorMenu);
            break;

        case TypeSystemActions.ShowNewMapMenu:
            SetScreen(TypeScreens.NewLevelMenu);
            break;

        case TypeSystemActions.Restart:

            SetScreen(TypeScreens.Game);
            this.GetComponent <Game>().Restart();
            break;

        case TypeSystemActions.PauseGame:
            if (CurrentScreen == TypeScreens.Game)
            {
                SetScreen(TypeScreens.PauseGameMenu);
                this.GetComponent <Game>().Pause();
            }
            else
            {
                SetScreen(TypeScreens.Game);
                this.GetComponent <Game>().ResumeGame();
            }
            break;

        case TypeSystemActions.ResumeGame:
            SetScreen(TypeScreens.Game);
            break;

        case TypeSystemActions.CreateMap:
            _LevelEditor.CreateMap();
            SetScreen(TypeScreens.LevelEditor);
            break;

        case TypeSystemActions.SaveMap:
            _LevelEditor.SaveMap();
            break;

        case TypeSystemActions.LoadMap:
            _LevelEditor.LoadMap();
            SetScreen(TypeScreens.LevelEditor);
            break;

        case TypeSystemActions.DeleteMap:
            _LevelEditor.DeleteMap();
            break;

        case TypeSystemActions.ShowEndGame:
            SetScreen(TypeScreens.EndGameMenu);
            break;
        }
    }