Ejemplo n.º 1
0
        private void RunGame(Game game)
        {
            bool   beginIsSelected;
            string userInput;

            player.SetName(ui);
            Console.Clear();
            ui.DisplayPlayerSetNameSuccessMessage(player);
            ui.DisplayPlayerStartInfo(player);
            ui.DisplayPlayerMenuExplanation();
            Console.WriteLine(Environment.NewLine);
            ui.DisplayBeginGameMessage();
            ui.DisplayPressAnyKeyToContinue();
            Console.Clear();
            day.GenerateSevenDays(random);
            for (int i = 0; day.week.ElementAt(i).dayNumber <= numberOfDaysInGame; i++)
            {
                beginIsSelected = false;
                while (!beginIsSelected)
                {
                    ui.DisplayCurrentPlayerAndDayInfo(player, day.week.ElementAt(i));
                    ui.DisplayPlayerMenu();
                    userInput = ui.GetUserInput(PlayerMenuOptions, game);
                    switch (userInput)
                    {
                    case "store":
                        store.SellToPlayer(player, ui, StoreMenuOptions, game);
                        break;

                    case "recipe":
                        player.SetRecipe(ui, RecipeMenuOptions, game);
                        break;

                    case "weather":
                        player.ViewWeather(ui, numberOfDaysInGame, day);
                        break;

                    case "begin":
                        player.recipe.SetRecipeGrade();
                        GenerateCustomers();
                        pos.RunBusinessDay(day, day.week.ElementAt(i).weather.weather, customers, player, ui);
                        beginIsSelected = true;
                        Console.Clear();
                        ui.DisplayResultsOfTheDay(player, pos, game);
                        player.ResetMoneySpentToday();
                        ui.DisplayPressAnyKeyToContinue();
                        break;
                    }
                    customers.Clear();
                    Console.Clear();
                }
            }
            ui.DisplayEndOfGame(player);
        }