/// <summary> /// Updates the screen with the nem game info /// </summary> /// <param name="game">The newest state of the game</param> public void Update(IGame game) { Console.SetCursorPosition(0, 1); foreach (var consoleText in _headerModule.Render(game)) { Print(consoleText); } Console.WriteLine(Screen.ConsoleClearLineTillEnd()); var grid = new RoomView(game.Player.Location.Room, game.Player).GetGrid(); var spacing = new ConsoleText(" "); for (var row = 0; row < grid.GetLength(1); row++) { for (var col = 0; col < grid.GetLength(0); col++) { Print(grid[col, row]); Print(spacing); } Console.WriteLine(Screen.ConsoleClearLineTillEnd()); } var originalCursorTop = Console.CursorTop + 1; for (var row = originalCursorTop; row < Console.WindowHeight; row++) { Console.WriteLine(Screen.ConsoleClearLineTillEnd()); } Console.SetCursorPosition(0, originalCursorTop); if (game.Player.Died) { Console.WriteLine("Oh no Indiana, you have lost!"); } else if (game.Player.Won) { Console.WriteLine("Congrats you have escaped the Temple of Doom!"); } if (game.Quit) { Console.WriteLine("Stopping..."); } }
public void Update(IGame game) { Console.Clear(); Console.SetCursorPosition(0, 1); foreach (var line in _headerModule.Render(game)) { Print(line); } Console.WriteLine(); var grid = new RoomViewModel(game.Player.Location.Room, game.Player, game.Enemies).GetGrid(); var spacing = new ConsoleText(" "); for (var row = 0; row < grid.GetLength(1); row++) { for (var col = 0; col < grid.GetLength(0); col++) { Print(grid[col, row]); Print(spacing); } Console.WriteLine(); } Console.WriteLine(); if (game.Player.Died) { Console.WriteLine("Oh no Indiana, you have lost!"); } else if (game.Won) { Console.WriteLine("Congrats you have escaped the Temple of Doom!"); } if (game.Quit) { Console.WriteLine("Stopping..."); } }