public void Run() { Console.WriteLine("Welcome"); Console.WriteLine("1-Game"); Console.WriteLine("2-Help"); Console.WriteLine("3-Demo"); Console.WriteLine("ESC-Quit"); ConsoleKeyInfo key = Console.ReadKey(); switch (key.Key) { case ConsoleKey.D1: Game g = new Game(); g.Run(); break; case ConsoleKey.D2: HelpScreen h = new HelpScreen(); h.Run(); break; case ConsoleKey.D3: DemoScreen d = new DemoScreen(); d.Run(); break; } }
public void Run() { Console.ForegroundColor = ConsoleColor.Red; string text = "Welcome To DamMan!"; Console.SetCursorPosition(40 - text.Length / 2, 12); Console.WriteLine(text); Console.ReadKey(); Console.Clear(); do { Console.SetCursorPosition(40, 12); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("D. Demo"); Console.SetCursorPosition(40, 13); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("H. HighScore"); Console.SetCursorPosition(40, 14); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("C. Credits"); Console.SetCursorPosition(40, 15); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("G. Game"); Console.ResetColor(); char option = Convert.ToChar(Console.ReadLine().ToLower()); switch (option) { case 'd': Console.Clear(); myDemoScreen = new DemoScreen(); myDemoScreen.Run(); Console.Clear(); break; case 'h': Console.Clear(); myHiScoresScreen = new HiScoresScreen(); myHiScoresScreen.Run(); Console.Clear(); break; case 'c': Console.Clear(); myCreditsScreen = new CreditsScreen(); myCreditsScreen.Run(); Console.Clear(); break; case 'g': Console.Clear(); Console.SetCursorPosition(40, 15); Console.ForegroundColor = ConsoleColor.Red; //Console.WriteLine("Bye!"); exit = true; break; default: Console.WriteLine("Wrong Option!"); break; } }while (!exit); }