Пример #1
0
 //This method handles all of our Game Over Menu options
 public static bool PerformChosenMenuOption(ConsoleKeyInfo pressedKey, bool leaveMenu)
 {
     //If the player chose Option 1
     if (pressedKey.KeyChar == 49)
     {
         //we simply leave the menu, and the game will play again.
         leaveMenu = true;
     }
     //If we choose Option 2
     else if (pressedKey.KeyChar == 50)
     {
         //Call a method which prints out our complete move log.
         PrintGUI.PrintCompleteLog();
         //We wont leave the menu after this
         leaveMenu = false;
     }
     //If we choose option 3
     else if (pressedKey.KeyChar == 51)
     {
         //Quit the program
         Environment.Exit(404);
     }
     //Return if we should leave the menu or not
     return(leaveMenu);
 }
Пример #2
0
 private void InitiateNewGame()
 {
     Logger.CreateCleanLog();
     engine  = new GameEngine();
     Printer = new PrintGUI();
     newGame = new RunGame(Printer, engine);
     engine.InitiateGame();
 }
Пример #3
0
        public static void EnterGameOverMenu()
        {
            //We want to stay in the menu until we choose
            //a menu option which is to exit the menu
            bool leaveMenu = false;

            while (!leaveMenu)
            {
                //This simply displays the Menu
                PrintGUI.GameOverMenu();
                //This collects your menu choice.
                var pressedKey = Console.ReadKey();
                //This method fetches a bool from the method and lets us know
                //if we should exit the menu or not
                leaveMenu = PerformChosenMenuOption(pressedKey, leaveMenu);
            }
        }
Пример #4
0
 public RunGame(PrintGUI Printer, GameEngine engine)
 {
     this.Printer = Printer;
     this.engine  = engine;
 }