示例#1
0
 public void StartGame()
 {
     Console.WriteLine("Welcome to your Lemonade Stand!");
     HowManyDays();
     DayLoop();
     day.EndDay(playerOne);
 }
示例#2
0
        public void GameLoop()
        {
            while (playing)
            {
                Console.WriteLine("Day {0}: Choose buy, inventory, recipe, price, day, weather, save, load, or quit.", currentDay);
                string choice = Console.ReadLine().ToLower();
                switch (choice)
                {
                case "buy":
                case "b":
                    store.Buy(inventory.inventory, player, inventory);
                    break;

                case "inventory":
                case "inv":
                case "i":
                    inventory.DisplayInventory();
                    player.DisplayCash();
                    break;

                case "recipe":
                case "r":
                    player.DisplayRecipe();
                    player.GetChangeRecipe();
                    break;

                case "price":
                case "p":
                    player.DisplayPrice();
                    player.GetChangePrice();
                    break;

                case "day":
                case "d":
                    day.StartDay(inventory, player, this, weatherForecast[0]);
                    day.EndDay(this, player, inventory);
                    break;

                case "weather":
                case "w":
                    weather.WeatherCheck(weatherForecast);
                    break;

                case "save":
                case "s":
                    fileWriter.WriteFile(player, inventory, this);
                    break;

                case "load":
                case "l":
                    fileReader.ReadFile(player, inventory, this);
                    break;

                case "quit":
                case "q":
                    playing = false;
                    break;
                }
            }
        }
示例#3
0
        public void RunGame()
        {
            //Game Generate weather
            string todaysWeather = DisplayDailyWeather(day.weather.conditions);

            Message.DisplayMessage(todaysWeather);

            //Player Fill inventory
            Message.DisplayMessage(String.Format("Your current inventory is {0} lemons, {1} cups of sugar, and {2} cups", player.inventory.lemons.Count, player.inventory.sugars.Count, player.inventory.cups.Count));
            store.GetLemons();
            player.AddLemons(store.lemonQty, player.wallet);
            Message.DisplayMessage("New balance: $" + player.wallet.balance);
            store.GetSugar();
            player.AddSugar(store.sugarQty, player.wallet);
            Message.DisplayMessage("New balance: $" + player.wallet.balance);
            store.GetIce();
            player.AddIce(store.iceQty, player.wallet);
            Message.DisplayMessage("New balance: $" + player.wallet.balance);
            store.GetCups();
            player.AddCups(store.cupQty, player.wallet);
            Message.DisplayMessage("New balance: $" + player.wallet.balance);
            spentBalance = 20 - player.wallet.balance;

            //Player set recipe
            ShowRecipe();
            GetNewRecipe(player);

            //Player Set Price
            player.SetPrice();
            player.inventory.GetNewPitcher(player.inventory.pitcher);

            //Create customers//demand
            int customerQty = day.GetCustomerQty();

            day.GenerateCustomer(customerQty);
            day.GetDemand();
            bool buy = day.GetCustomerBuy();

            player.inventory.CheckNewPitcher(player.cupsSold);
            bool empty  = player.inventory.CheckInventory();
            bool endDay = player.CheckCanSell(empty, buy);



            //End day
            day.EndDay();

            //TESTS //working
            //weather.DisplayTest();
            //int lemonQty = inventory.GetLemons();
            //inventory.AddLemons(lemonQty, wallet);
            //Console.WriteLine(wallet.balance);
            //Console.WriteLine(player.inventory.cups.Count + player.inventory.icecubes.Count + player.inventory.lemons.Count + player.inventory.sugars.Count);
            //Console.WriteLine(player.inventory.cups.Count + player.inventory.icecubes.Count + player.inventory.lemons.Count + player.inventory.sugars.Count);

            //TEST INPUT
            //Console.WriteLine("Enter a number");
            //string userInput = Console.ReadLine();
            //bool isInteger = Message.CheckIntegerInput(userInput);
            //Console.WriteLine(isInteger);
            //Message.DisplayMessage("This Customer Demand: " + customer.demand);
            //TEST CUSTOMER DEMAND
        }
示例#4
0
        public void PlayerMenu()
        {
            while (mainMenu)
            {
                DisplayGameTitle();
                Console.ForegroundColor = ConsoleColor.DarkCyan;
                Console.WriteLine("\n*************** DAY {0} ***************", currentDay);
                Console.ResetColor();
                weather.DisplayTodaysWeather(weatherForecast);
                Console.WriteLine("\n{0} what would you like to do?", player.Name);
                Console.ForegroundColor = ConsoleColor.DarkYellow;
                Console.WriteLine("[1] Start Day [2] Inventory [3] Store [4] Cash Balance \n[5] Recipe    [6] Set Price [7] Quit ");
                string choice = Console.ReadLine().ToLower();
                Console.ResetColor();
                switch (choice)
                {
                case "1":
                    Console.Clear();
                    day.StartDay(inventory, player, this, weatherForecast[0]);
                    day.EndDay(this, player, inventory);

                    Console.ReadKey();
                    break;

                case "2":
                    inventory.DisplayInventory();
                    Console.ReadKey();
                    break;

                case "3":
                    store.Purchase(inventory.Storage, player, inventory);
                    Console.ReadKey();
                    break;

                case "4":
                    player.DisplayCash();
                    Console.ReadKey();
                    break;

                case "5":
                    player.DisplayRecipe();
                    player.GetChangeRecipe();
                    Console.ReadKey();
                    break;

                case "6":
                    player.DisplayPricePerLemonadeCup();
                    Console.ReadKey();
                    break;

                case "7":
                    mainMenu = false;
                    Console.WriteLine("You Ended the Game. Goodbye!");
                    Console.ReadKey();
                    Environment.Exit(0);
                    break;

                default:
                    Console.WriteLine("Thats not a valid option, please choose between [1] - [7]");
                    Console.WriteLine("press enter to continue...");
                    Console.ReadLine();
                    mainMenu = true;
                    break;
                }
            }
        }