static void Main(string[] args) { // Dictionary to accept keys as argument values in array index Dictionary <string, int> argsAccepter = new Dictionary <string, int>(); // Get arguments given by main func to create a specific gameboard UserInputArgs.UserArgs(argsAccepter, args, UserInputArgs.levelDiff); // Check if all arguments given in the console are valid ConditionsChecker.Conditions(argsAccepter, args); // Initialise new GameLoop to run the application GameLoop loop = new GameLoop(); // Call the Loop function to begin new game loop loop.Loop(UserInputArgs.levelDiff); }
/// <summary> /// Method to store all information needed for the Main menu. /// This method returns nothing /// </summary> public void Menu() { // Clear console Console.Clear(); // Creation of instance of gameloop GameLoop loop = new GameLoop(); // Creation of instance of GameScore GameScore score = new GameScore(); // Creation of instance of PrintText PrintText menuInfo = new PrintText(); // Get the text menu method menuInfo.MenuText(); // Variable ConsoleKey answer; answer = Console.ReadKey().Key; Console.WriteLine(); // Depending on user key input switch to the respective case and // Perform according to its case body switch (answer) { // Start game case ConsoleKey.A: // loop.Loop(); break; // Load Score screen case ConsoleKey.B: Console.WriteLine(); if (File.Exists(($"Highscores_{GameBoard.RowSize}x{GameBoard.ColSize}.txt")) == false) { Console.WriteLine("No highscores for this board yet!"); Console.WriteLine(); Console.WriteLine("Press any key to return"); Console.ReadKey(); } else { menuInfo.ScoreText(); score.LoadScoreFromFile(loop.score); Console.WriteLine(); Console.WriteLine("Press any key to return"); Console.ReadKey(); } Menu(); break; // Load credits screen case ConsoleKey.C: Console.WriteLine("Game developed by:"); Console.WriteLine(); Console.WriteLine("Ana dos Santos - a21801899"); Console.WriteLine("Diana Levay - a21801515"); Console.WriteLine(); Console.WriteLine("Press any key to return"); Console.ReadKey(); Menu(); break; // End game case ConsoleKey.D: Console.WriteLine("Thank you for playing!"); Environment.Exit(0); break; // In case other unknown key are typed by the user. Print the // message and go back to menu. default: Console.WriteLine("Please select one of the letters in the menu!"); Console.WriteLine("Press any key to return"); Console.ReadKey(); Menu(); break; } }