Exemplo n.º 1
0
 public void SellCups(Player player, UI ui)
 {
     ui.DisplayDesiredQuantityRequest();
     userInput                 = ui.GetUserQuantityInput();
     userInputQuantity         = ui.ConvertStringToNumber(userInput, userInputQuantity);
     doesPlayerHaveEnoughMoney = ValidatePriceToPlayerMoney(player, userInputQuantity, cups.purchasePrice);
     if (doesPlayerHaveEnoughMoney)
     {
         for (int i = 1; i <= userInputQuantity; i++)
         {
             player.Money           -= cups.purchasePrice;
             player.TotalMoneySpent += cups.purchasePrice;
             player.MoneySpentToday += cups.purchasePrice;
             player.inventory.cups.Add(new Cup());
             player.inventory.cups.Add(new Cup());
             player.inventory.cups.Add(new Cup());
             player.inventory.cups.Add(new Cup());
             player.inventory.cups.Add(new Cup());
             player.inventory.cups.Add(new Cup());
             player.inventory.cups.Add(new Cup());
             player.inventory.cups.Add(new Cup());
             player.inventory.cups.Add(new Cup());
         }
     }
     else
     {
         Console.WriteLine("Not enough money!");
         Console.ReadKey();
     }
 }
Exemplo n.º 2
0
        public void SetRecipe(UI ui, List <string> options, Game game)
        {
            string userInput;
            int    userQuantityInput = 0;
            bool   exitIsSelected    = false;

            while (!exitIsSelected)
            {
                Console.Clear();
                ui.DisplayRecipeMenu(this);
                userInput = ui.GetUserInput(options, game);
                switch (userInput)
                {
                case "1":
                    userInput         = ui.GetUserQuantityInput();
                    userQuantityInput = ui.ConvertStringToNumber(userInput, userQuantityInput);
                    SetLemonsAmount(userQuantityInput);
                    break;

                case "2":
                    userInput         = ui.GetUserQuantityInput();
                    userQuantityInput = ui.ConvertStringToNumber(userInput, userQuantityInput);
                    SetSugarsAmount(userQuantityInput);
                    break;

                case "3":
                    userInput         = ui.GetUserQuantityInput();
                    userQuantityInput = ui.ConvertStringToNumber(userInput, userQuantityInput);
                    SetIceAmount(userQuantityInput);
                    break;

                case "4":
                    userInput         = ui.GetUserQuantityInput();
                    userQuantityInput = ui.ConvertStringToNumber(userInput, userQuantityInput);
                    SetLemonadePrice(userQuantityInput);
                    break;

                case "5":
                    exitIsSelected = true;
                    break;
                }
            }
        }