コード例 #1
0
        }   // starts the african countries game menu

        public void RanFctPg()
        {
            try
            {
                MethodLibrary ml = new MethodLibrary();
                int           det;
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.Clear();
                Console.WriteLine("Welcome to the Random Facts page");
                Console.WriteLine("=========================================\n");
                Console.WriteLine("Enter the associated number to choose an option\n");
                Console.WriteLine("1. Give me an African fact");
                Console.WriteLine("2. Return to Main page");
                Console.WriteLine("3. Quit");

                det = Convert.ToInt32(Console.ReadLine());

                if (det > 3 || det == 0)
                {
                    ml.IfState(3);
                    RanFctPg();
                }

                switch (det)
                {
                case 1:
                    AfFactGame();
                    break;

                case 2:
                    DisplayMenu();
                    break;

                case 3:
                    ml.Exit();
                    break;
                }
            }
            catch (FormatException)
            {
                MethodLibrary ml = new MethodLibrary();
                ml.CatchFormat();
                RanFctPg();
            }
            catch
            {
                MethodLibrary ml = new MethodLibrary();
                ml.CatchAll();
                RanFctPg();
            }
        }   // opens the random facts menu
コード例 #2
0
        public void DisplayMenu()
        {
            try
            {
                MethodLibrary ml = new MethodLibrary();

                int det;

                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.Clear();
                Console.WriteLine("Welcome to the African countries game Main page");
                Console.WriteLine("========================================================\n");
                Console.WriteLine("Enter the associated number to choose an option\n");
                Console.WriteLine("1. Play African countries game");
                Console.WriteLine("2. Randomized Fact page");
                Console.WriteLine("3. Learn the countries");

                ml.PrintColor(ConsoleColor.DarkCyan, "4. Play Countries of the world");
                ml.PrintColor(ConsoleColor.DarkCyan, "5. Check Highest score");

                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("6. About us");
                Console.WriteLine("7. Quit");

                det = Convert.ToInt32(Console.ReadLine());

                if (det > 7 || det == 0)
                {
                    ml.IfState(7);
                    DisplayMenu();
                }

                switch (det)
                {
                case 1:
                    AfConGame();
                    break;

                case 2:
                    RanFctPg();
                    break;

                case 3:
                    PracticeCountries();
                    break;

                case 4:
                    ml.proVersionMessage();
                    DisplayMenu();
                    break;

                case 5:
                    ml.proVersionMessage();
                    DisplayMenu();
                    break;

                case 6:
                    AboutUs();
                    break;

                case 7:
                    ml.Exit();
                    break;
                }
            }
            catch (FormatException)
            {
                MethodLibrary ml = new MethodLibrary();
                ml.CatchFormat();
                DisplayMenu();
            }
            catch
            {
                MethodLibrary ml = new MethodLibrary();
                ml.CatchAll();
                DisplayMenu();
            }
        }  // Displays the main menu
コード例 #3
0
        }  // Displays the main menu

        public void AfConGame()
        {
            try
            {
                MethodLibrary ml = new MethodLibrary();

                int det;
                Console.Clear();
                Console.ForegroundColor = ConsoleColor.Cyan;

                //PrintColor(ConsoleColor.Magenta,"Welcome to the African countries game",resetFcolor:true,
                //returnFcolor:ConsoleColor.Cyan);

                Console.WriteLine("Welcome to the African countries game");
                Console.WriteLine("=============================================\n");
                Console.WriteLine("Enter the associated number to choose an option\n");
                Console.WriteLine("1. Play all African countries");
                Console.WriteLine("2. Play all North African countries");
                Console.WriteLine("3. Play all East African countries");
                Console.WriteLine("4. Play all West African countries");
                Console.WriteLine("5. Play all South African countries");
                Console.WriteLine("6. Play all Central African countries");
                Console.WriteLine("7. Return to Menu");

                det = Convert.ToInt32(Console.ReadLine());

                if (det > 7 || det == 0)
                {
                    ml.IfState(7);
                    DisplayMenu();
                }

                switch (det)
                {
                case 1:
                    AfricanCon();
                    break;

                case 2:
                    NorthAfricanCon();
                    break;

                case 3:
                    EastAfricanCon();
                    break;

                case 4:
                    WestAfricanCon();
                    break;

                case 5:
                    SouthAfricanCon();
                    break;

                case 6:
                    CentralAfricanCon();
                    break;

                case 7:
                    DisplayMenu();
                    break;
                }
            }
            catch (FormatException)
            {
                MethodLibrary ml = new MethodLibrary();
                ml.CatchFormat();
                AfConGame();
            }
            catch
            {
                MethodLibrary ml = new MethodLibrary();
                ml.CatchAll();
                AfConGame();
            }
        }   // starts the african countries game menu