private static void UserChooseInstructionsMenu() { Console.Clear(); DimitarPiskov.Instructions(); Console.SetCursorPosition(5, 30); Console.ForegroundColor = ConsoleColor.White; Console.Write("Press ENTER to return"); Console.SetCursorPosition(10, 31); Console.Write("to the MENU"); if (Console.ReadKey().Key == ConsoleKey.Enter) { returnFromInstructions = false; Console.Clear(); Main(); } else { returnFromInstructions = false; Console.Clear(); Main(); } }
public static void Main() { Console.Title = "EatSharp"; Dimitar.SetConsoleWidthAndHeight(); Console.OutputEncoding = Encoding.UTF8; if (returnFromHighScores && returnFromInstructions && returnFromLevelOne && returnFromLevelTwo) { DrawLogo(20); DimitarPiskov.PrintGameName(); Console.ReadKey(); Console.Clear(); DimitarPiskov.Introduction(); Console.ReadKey(); Console.Clear(); } // Menu Ivaylo.PrintingMenuGame(); waveOutDevice = new WaveOut(); ConsoleKeyInfo choice = Console.ReadKey(); StringBuilder userNickname = new StringBuilder(); if (choice.Key == ConsoleKey.D1) { Console.Clear(); int currentColumn = 15; bool inputSuccess = true; var nickname = new List <ConsoleKeyInfo>(); Dimitar.AskUserForNickname(ref currentColumn, ref inputSuccess, nickname); Console.ForegroundColor = ConsoleColor.White; Mariyan.DrawGameBoardLevelOne(); Dimitar.StartCounter(); InitDotsArray(1); waveOutDevice.Init(audioFileReader); waveOutDevice.Play(); while (!endLevelOne) { Thread.Sleep(200); Ivaylo.MonsterNMovingLevelOne(); Dimitar.MonsterIMovingLevelOne(); Mariyan.MonsterDLevelOne(); Antonina.monsterEMovingLevelOne(); Georgi.RefreshScreen(badGuysCoordinates, Mariyan.wallsLevelOne); if (points >= 1280) //1280 { Thread.Sleep(1500); endLevelOne = true; currentLevel = 2; break; } else if (endGame == false) { Dimitar.AskUserToRestartLevelOne(waveOutDevice, audioFileReader); } } waveOutDevice.Stop(); Dimitar.LevelTwoMessage(); Console.ReadKey(); Console.Clear(); Console.ForegroundColor = ConsoleColor.White; Mariyan.DrawGameBoardLevelTwo(); Dimitar.StartCounter(); InitDotsArray(2); waveOutDevice.Init(audioFileReader); waveOutDevice.Play(); monsterOneCounter = 0; monsterTwoCounter = 0; monsterThreeCounter = 0; monsterFourCounter = 0; while (!endLevelTwo) { Thread.Sleep(200); Ivaylo.MonsterNMovingLevelTwo(); Mariyan.MonsterILevelTwo(); Evgeni.MonsterDMovingLevelTwo(); Ivaylo.MonsterEMovingLevelTwo(); Georgi.RefreshScreen(badGuysCoordinates, Mariyan.wallsLevelTwo); if (points >= 2600) //2600 { Thread.Sleep(1500); endLevelTwo = true; try { StreamWriter userScores = new StreamWriter(@"..\..\HighScores.txt"); using (userScores) { user.Append(points); userScores.WriteLine(user); } } catch (FileNotFoundException exMessage) { Console.WriteLine("The file is not found!"); Console.WriteLine(exMessage.Message); } break; } else if (endGame == false) { Dimitar.AskUserToRestartLevelTwo(waveOutDevice, audioFileReader); } } } else if (choice.Key == ConsoleKey.D2) { UserChooseInstructionsMenu(); } else if (choice.Key == ConsoleKey.D3) { UserChooseHighScoresMenu(); } else if (choice.Key == ConsoleKey.D4) { Console.Clear(); Environment.Exit(-1); } Console.Clear(); Mariyan.GameOutro(); Console.CursorVisible = false; }