示例#1
0
        void GameScreen(Game game)
        {
            currentScreen = new GameScreen(game, fieldSize);

            ScreenCaller.Call(currentScreen, drawer, () => game.DelayBetweenFrames).OnExit((o) =>
            {
                StartScreen();
            });
        }
示例#2
0
        void ConfigurationScreen()
        {
            currentScreen = new ConfigurationScreen(fieldSize, p);

            ScreenCaller.Call(currentScreen, drawer, 60).OnExit((newConfig) =>
            {
                ConfigStorage.Current = (ConfigStorage)newConfig;
                StartScreen();
            });
        }
示例#3
0
        /// <summary>
        /// Нарисовать окно с выбором игры и ждать пока пользователь выберет
        /// </summary>
        public void StartScreen()
        {
            currentScreen = new SelectGameScreen(new string[] {
                "Snake game",     // 0
                "Snake together", // 1
                "Tetris",         // 2
                "Flappy bird",    // 3
                "Settings",       // 4
                "Exit"            // 5
            }, fieldSize, p);

            ScreenCaller.Call(currentScreen, drawer, 60).OnExit((i) =>
            {
                int selectedIndex = (int)i;

                if (selectedIndex == 0)
                {
                    GameScreen(new SnakeGame(fieldSize, p));
                }
                else if (selectedIndex == 1)
                {
                    GameScreen(new SnakeTogetherGame(fieldSize, p));
                }
                else if (selectedIndex == 2)
                {
                    GameScreen(new TetrisGame(fieldSize, p));
                }
                else if (selectedIndex == 3)
                {
                    GameScreen(new FlappyBirdGame(fieldSize, p));
                }
                else if (selectedIndex == 4)
                {
                    ConfigurationScreen();
                }
                else if (selectedIndex == 5)
                {
                    Exit();
                }
            });
        }