コード例 #1
0
        //member methods

        public void VisitStand(Day day, Weather weather, Recipe recipe, Wallet wallet, Inventory inventory)
        {
            for (int j = 0; j < day.NumberOfCustomers; j++)
            {
                CheckWeather(weather, recipe, wallet, inventory);
                CheckPrice(recipe, weather, wallet, inventory);
                BuyLemonade(recipe, wallet, inventory);
            }
        }
コード例 #2
0
 public static void NumberOfLemonades(Inventory inventory)
 {
     Console.WriteLine("You have made " + inventory.cupsOfLemonade + " cups of Lemonade.");
 }
コード例 #3
0
 public static void DisplaysWallet(Inventory inventory)
 {
     Console.WriteLine("Your wallet has $" + inventory.wallet);
 }
コード例 #4
0
        public void ReadFile(Player player, Inventory inventory, Game game)
        {
            string        line;
            string        path       = "LemonadeSaveFile.txt";
            string        fullPath   = System.IO.Path.GetFullPath(path);
            List <string> textToRead = new List <string>();

            try {
                System.IO.StreamReader file = new System.IO.StreamReader(fullPath);
                if ((line = file.ReadLine()) != null)
                {
                    player.SetName(line);
                }
                if ((line = file.ReadLine()) != null)
                {
                    player.SetCash(Convert.ToDouble(line));
                }
                inventory.Reset();
                if ((line = file.ReadLine()) != null)
                {
                    //lemons
                    inventory.AddLemons(Int32.Parse(line));
                }
                if ((line = file.ReadLine()) != null)
                {
                    //ice
                    inventory.AddIces(Int32.Parse(line));
                }
                if ((line = file.ReadLine()) != null)
                {
                    //sugar
                    inventory.AddSugars(Int32.Parse(line));
                }
                if ((line = file.ReadLine()) != null)
                {
                    //cups
                    inventory.AddCups(Int32.Parse(line));
                }
                if ((line = file.ReadLine()) != null)
                {
                    //total spent
                    player.SetTotalSpent(Convert.ToDouble(line));
                }
                if ((line = file.ReadLine()) != null)
                {
                    //total profit
                    player.SetTotalProfit(Int32.Parse(line));
                }
                if ((line = file.ReadLine()) != null)
                {
                    //current day
                    game.SetCurrentDay(Int32.Parse(line));
                }
                Console.WriteLine("Game loaded.");
                file.Close();
            }
            catch
            {
                Console.WriteLine("Error trying to load file.");
            }
        }
コード例 #5
0
 public LemonadeStand()
 {
     cupsPerPitcher = 12;
     inventory      = new Inventory();
 }
コード例 #6
0
ファイル: Player.cs プロジェクト: chadklebba/LemonadeStand
 public Player()
 {
     inventory = new Inventory();
     recipe    = new Recipe();
     wallet    = new Wallet();
 }
コード例 #7
0
 public Store(Player player)
 {
     playerWallet    = player.wallet;
     playerInventory = player.inventory;
 }
コード例 #8
0
ファイル: Player.cs プロジェクト: BBarry29/LemonadeStand
 public Player()
 {
     Wallet    wallet    = new Wallet();
     Inventory inventory = new Inventory();
 }
コード例 #9
0
 public Player()
 {
     CurrentMoney     = new Wallet();
     CurrentInventory = new Inventory();
     recipe           = new Recipe();
 }
コード例 #10
0
 public static void EndDay(Inventory inventory)
 {
     Console.WriteLine("You ended today with $" + inventory.moneyCounter + ". and all of your ice has melted");
     Console.ReadLine();
     Console.Clear();
 }
コード例 #11
0
 public static void DisplayInventory(Inventory inventory)
 {
     Console.WriteLine("\nYou now have $" + inventory.moneyCounter + " and the following ingredients and supplies:\n" + inventory.sugar + " cups of sugar\n" + inventory.lemons + " lemons\n" + inventory.iceCubes + " ice cubes\n" + inventory.cups + " paper cups.\n");
 }