Esempio n. 1
0
    // The program part of the Main Menu
    // Directs players to other parts of the program

    public static void MenuProg()
    {
        string rawInput = "TBC";
        char   input    = '0';
        bool   check    = false;

        GameDraw();



        // Checks if player input is valid
        while (!check)
        {
            Console.Write("\nYour Input: ");

            rawInput = Console.ReadLine();
            try{
                input = Convert.ToChar(rawInput);
                if (input >= 49 && input <= 56)
                {
                    check = true;
                }
                else
                {
                    GameDraw();
                    Console.WriteLine("\nError: '{0}' is not a valid input", rawInput);
                }
            }
            catch {
                if (rawInput == "")
                {
                    check = true;
                }
                else
                {
                    GameDraw();
                    Console.WriteLine("\nError: '{0}' is not a valid input", rawInput);
                }
            }
        }

        // Directs player to corresponding menu
        switch (input)
        {
        case '1':
            Func1.CovidAnnProg(Global.covidAnnPurch);
            break;

        case '2':
            Func2.HealthProg();
            break;

        case '3':
            Func3.VaccineProg();
            break;

        case '4':
            Func4.BorderProg();
            break;

        case '5':
            Func5.DefenceProg();
            break;

        case '6':
            Func6.EducationProg();
            break;

        case '7':
            Intro(true);
            break;

        case '8':
            Help();
            break;

        default:
            // Initiates all inputs and simulates Covid-19
            Game.Submit();
            break;
        }
    }