public static void ShowGameOverScreen() { ConsoleRenderer.Clear(); const int skullHeight = 19; string centerPadding = new string(' ', Console.BufferWidth / 4); var deathScreen = File.ReadAllLines("../../UI/Utility/GameOver.txt"); Console.CursorVisible = false; Console.ForegroundColor = ConsoleColor.Gray; for (int i = 0; i < skullHeight; i++) { ConsoleRenderer.Write(centerPadding); ConsoleRenderer.WriteLine(deathScreen[i]); } Console.ForegroundColor = ConsoleColor.Red; for (int i = skullHeight; i < deathScreen.Length; i++) { ConsoleRenderer.Write(centerPadding); ConsoleRenderer.WriteLine(deathScreen[i]); } Console.ForegroundColor = ConsoleColor.White; Environment.Exit(0); }
private void OnStartPressed(object sender, MouseEventArgs e) { ConsoleRenderer.Clear(); startButton.HideAndDisable(); placeholder.Hide(); DrawMain(); }
private void OnKeyPressed(KeyEventArgs args) { bool ctrlPressed = args.ControlKeyState.HasFlag(ControlKeyState.LeftCtrlPressed); if (args.Key == ConsoleKey.R && ctrlPressed) { ConsoleRenderer.Clear(); startButton.ShowAndEnable(); placeholder.Show(); DrawStart(); } else if (args.Key == ConsoleKey.Q && ctrlPressed) { //Cursor = !Cursor; } }
private void Redraw() { ConsoleRenderer.Clear(); }
protected virtual void ExecuteCommand(IKeyInfo commandKey) { IGameCommand currentCommand; switch (commandKey.Key) { case ConsoleKey.F1: currentCommand = new HelpCommand(this); currentCommand.Execute(); break; case ConsoleKey.M: ConsoleRenderer.Clear(); currentCommand = new PrintMapCommand(this); currentCommand.Execute(); break; case ConsoleKey.LeftArrow: case ConsoleKey.RightArrow: case ConsoleKey.UpArrow: case ConsoleKey.DownArrow: ConsoleRenderer.Clear(); RenderSuccessMoveMessage(commandKey); currentCommand = new MovePlayerCommand(this); currentCommand.Execute(commandKey); currentCommand = new PrintMapCommand(this); currentCommand.Execute(); break; case ConsoleKey.S: currentCommand = new PlayerStatusCommand(this); currentCommand.Execute(); break; case ConsoleKey.C: ConsoleRenderer.Clear(); break; case ConsoleKey.H: currentCommand = new HealCommand(this); currentCommand.Execute(); break; case ConsoleKey.I: currentCommand = new BoostHealthCommand(this); currentCommand.Execute(); break; case ConsoleKey.R: this.Player.Inventory.BackPack.RemoveLastItem(); break; case ConsoleKey.B: currentCommand = new BackPackCommand(this); currentCommand.Execute(); break; case ConsoleKey.Escape: this.ExitApplication(); break; default: { throw new ArgumentException("Unknown command"); } } }