Esempio n. 1
0
        //Second menu - when user hits run game - displays the shop and recipe for the game
        public void RunGame()
        {
            //Validate user input
            do
            {
                Console.WriteLine("");
                Console.WriteLine("Menu");
                Console.WriteLine("1. Shop");
                Console.WriteLine("2. Recipe");
                Console.WriteLine("3. Price");
                Console.WriteLine("4. Continue");
                Console.WriteLine("5. Exit");

                Console.WriteLine("What would you like to do?");
                gameMenuInput = Console.ReadLine();
                Console.WriteLine("");

                if (gameMenuInput == "")
                {
                    Console.WriteLine("You need to input something!");
                }
                else if (gameMenuInput != "1" && gameMenuInput != "2" && gameMenuInput != "3" && gameMenuInput != "4")
                {
                    Console.WriteLine("You need to input a valid option!");
                }
                else
                {
                    gameMenuChoice = Int32.Parse(gameMenuInput);
                }
            } while (gameMenuInput != null && (gameMenuInput != "1" && gameMenuInput != "2" && gameMenuInput != "3" && gameMenuInput != "4" && gameMenuInput != "5"));

            //Menu options
            if (gameMenuChoice == 1)
            {
                Shop shop = new Shop();
                UsersMoney(money);
                shop.BuyItems(money);
            }
            if (gameMenuChoice == 2)
            {
                player.Recipe(allLemons, allSugar, allIce, allCups);
            }
            if (gameMenuChoice == 3)
            {
                player.Price();
            }
            if (gameMenuChoice == 4)
            {
                for (int i = 0; i < time.userTime; i++)
                {
                    currentDay = i;
                    Console.WriteLine("Current Day: " + time.userTime);
                    day.CustomerGenerator();
                    day.Results();
                    Profit();
                }
            }
            if (gameMenuChoice == 5)
            {
                Console.WriteLine("Thanks for playing");
            }
        }