/*======================* * 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; } } }
/*==============================* * 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(); }
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); }
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); }