コード例 #1
0
ファイル: Game.cs プロジェクト: JasonRoyalHart/LemonadeStand
        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;
                }
            }
        }
コード例 #2
0
 public void PlayerInventory(Inventory inventory)
 {
     inventory.CheckCash(inventory);
     inventory.DisplayInventory();
     Console.ReadLine();
     Console.Clear();
 }
コード例 #3
0
 public void CreateRecipe(Recipe recipe)
 {
     recipe = new Recipe();
     recipe.ChangeRecipe();
     recipe.SetRecipe(inventory);
     inventory.RemoveItems(recipe);
     inventory.DisplayInventory();
 }
コード例 #4
0
 public void BuyItems(Store store, Inventory inventory)
 {
     store.BuyLemons(inventory);
     store.BuySugar(inventory);
     store.BuyIce(inventory);
     store.BuyCups(inventory);
     Console.Clear();
     inventory.DisplayInventory();
     inventory.CheckCash(inventory);
     Console.Clear();
 }
コード例 #5
0
        public void ShowGameMenu()
        {
            bool menuActive = true;

            while (menuActive)
            {
                Console.WriteLine("Game Menu:  What you like to Do?" + "\n" + "Inventory; Store; Recipe; Set Price; Start Selling.");
                string choice = Console.ReadLine();

                switch (choice)
                {
                case "Inventory":
                    Console.WriteLine("Here is your Inventory:");
                    inventory.DisplayInventory();
                    break;

                case "Store":
                    Console.WriteLine("Here is the Store");
                    theStore.ShowStoreMenu(player);
                    break;

                case "Recipe":
                    Console.WriteLine("Here is your Lemonade Recipe:");
                    theStand.ShowLemonadeEquation(player);
                    // menu to view and modify recipe

                    break;

                case "Set Price":
                    Console.WriteLine("Here is the price you are selling at:");
                    theStand.SetUpPrice();
                    // function to udate lemonade price
                    break;

                case "Start Selling":
                    Console.WriteLine("Good luck");
                    SellLemonade();
                    ShowProfit();
                    menuActive = false;
                    //leave menu and start selling
                    break;

                default:
                    break;
                }
            }
        }
コード例 #6
0
ファイル: Player.cs プロジェクト: alexHardy872/LemonadeStand
 public void DisplayInventory()
 {
     inventory.DisplayInventory();
 }
コード例 #7
0
ファイル: Game.cs プロジェクト: Bengcha/LemonadeStandGame
        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;
                }
            }
        }