private static void CreateGameOverMenu(GameBoard board, bool won) { var gameOverMenu = new Menu { Title = !won ? "GAME OVER! YOU LOST!" : "GAME OVER! CONGRATULATIONS, YOU WON!", Execute = () => BoardUI.PrintBoard(board), MenuItems = new List <MenuItem>() { new MenuItem() { Title = "Start New Game", Execute = StartGameMenu.Run }, new MenuItem() { Title = "Return to Main Menu", Execute = MainMenu.Run }, new MenuItem() { Title = "Exit", Execute = QuitGame } } }; gameOverMenu.Run(); }
private static void PrintGame(GameBoard board) { Console.Clear(); BoardUI.PrintBoard(board); Console.WriteLine("SPACEBAR Open Cell"); Console.WriteLine("F Flag Cell"); Console.WriteLine("M Game Menu"); if (board.GameLost) { CreateGameOverMenu(board, false); return; } if (board.GameWon) { CreateGameOverMenu(board, true); return; } var command = Console.ReadKey().Key; PlayerKeyboardInput(board, command, false); }