void GameScreen(Game game) { currentScreen = new GameScreen(game, fieldSize); ScreenCaller.Call(currentScreen, drawer, () => game.DelayBetweenFrames).OnExit((o) => { StartScreen(); }); }
void ConfigurationScreen() { currentScreen = new ConfigurationScreen(fieldSize, p); ScreenCaller.Call(currentScreen, drawer, 60).OnExit((newConfig) => { ConfigStorage.Current = (ConfigStorage)newConfig; StartScreen(); }); }
/// <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(); } }); }