Example #1
0
        /*======================*
         * 4. In-game user input *
         *=======================*/
        private static void GameLoop()
        {
            inGame = true;
            while (inGame)
            {
                char input = FrontEnd.ReadUserInput();
                switch (input)
                {
                case 'p':
                    ReadStartQuitGame();
                    break;

                case 'q':
                    Environment.Exit(0);
                    break;
                }
            }
        }
Example #2
0
        /*==============================*
         *  3. Handle game control flow  *
         *===============================*/
        private static void ReadStartQuitGame()
        {
            bool setup = true;

            while (setup && !inGame)
            {
                char input = FrontEnd.ReadUserInput();
                switch (input)
                {
                case 'p':
                    HandleSetupGame();
                    break;

                case 'q':
                    Environment.Exit(0);
                    break;
                }
            }
            HandleSetupGame();
        }
Example #3
0
        private static int HandleGetSizeSelection()
        {
            int listSize = 0;

            while (listSize == 0)
            {
                char input = FrontEnd.ReadUserInput();
                switch (input)
                {
                case 's':
                    listSize = 6;
                    break;

                case 'm':
                    listSize = 12;
                    break;

                case 'l':
                    listSize = 18;
                    break;
                }
            }
            return(listSize);
        }
Example #4
0
        private static string HandleGetListSelection()
        {
            string listSelected = "";

            while (listSelected == "")
            {
                char input = FrontEnd.ReadUserInput();
                switch (input)
                {
                case 'i':
                    listSelected = "Instruments";
                    break;

                case 'm':
                    listSelected = "Mammals";
                    break;

                case 'o':
                    listSelected = "Occupations";
                    break;
                }
            }
            return(listSelected);
        }