Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 private void OnStartPressed(object sender, MouseEventArgs e)
 {
     ConsoleRenderer.Clear();
     startButton.HideAndDisable();
     placeholder.Hide();
     DrawMain();
 }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
0
 private void Redraw()
 {
     ConsoleRenderer.Clear();
 }
Exemplo n.º 5
0
        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");
            }
            }
        }