Example #1
0
        private void mainMenu()
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("<======================================================================================================================>");
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write("                                  <<Please select an option from the list below>>");
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write("\n\n                             1.)");
            Console.ResetColor();
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write("Instructions ");
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write("2.) ");
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write("Play Game ");
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write("3.) ");
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write("Credits ");
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write("4.) ");
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write("Exit Game ");
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("\n<======================================================================================================================>");
            Console.ResetColor();

            int menuSelection;

            do
            {
                try
                {
                    menuSelection = Int32.Parse(Console.ReadLine());
                }
                catch (System.FormatException)
                {
                    menuSelection = -1;
                }
            } while (menuSelection > 4 && menuSelection < 1);

            Console.Clear();

            switch (menuSelection)
            {
            case 1:
                Instructions();
                break;

            case 2:
                Game startGame = new Game();
                startGame.start();
                break;

            case 3:
                Credits();
                break;

            case 4:
                Exit();
                break;

            default:
                Console.Clear();

                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("<======================================================================================================================>");
                Console.ResetColor();

                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("You did not follow instructions...\n");
                Console.WriteLine("Please select an option from the list below (1, 2, 3, or 4.)\n");
                Console.ResetColor();

                break;
            }
        }