private static void RemoveSeedDialog(FieldSlot field)
        {
            string remove;

            while (true)
            {
                Console.Clear();
                DrawStatusBar();
                Seed plantedSeed = field.PlantedSeed;
                if (plantedSeed != null)
                {
                    Console.WriteLine("Do you really want to remove the following seed? This kills the seed. [yes; no; more info]");
                    plantedSeed.GetInfo();
                    remove = Console.ReadLine();
                    if (remove == "yes" || remove == "y")
                    {
                        field.RemoveSeed();
                        PrintInfoMessageAndWait("Seed successfully removed.");
                    }
                    else if (remove == "no" || remove == "n")
                    {
                        break;
                    }
                    else if (remove == "more info" || remove == "more" || remove == "m")
                    {
                        PrintInfoMessageAndWait("The seed has the following Crops:\r\n\r\n" + plantedSeed.GetCropInfo());
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Prints info about the crops of the planted seed of the given <paramref name="field"/> 
        /// and lets you select which crop to manage
        /// </summary>
        /// <param name="field">Field with the planted seed whose crops should be shown</param>
        private static void CropInfoDialog(FieldSlot field)
        {
            string anweisung;
              while (true)
              {
            PrintInfoMessage("Which crop do you want to manage? [enter index; back]\r\n\r\n" + field.PlantedSeed.GetCropInfo());

            anweisung = Console.ReadLine();
            if (anweisung == "back" || anweisung == "b")
              break;

            //TODO: implement manage crop
              }
        }
        private static void WaterFieldDialog(FieldSlot field)
        {
            string waterCount;

            while (true)
            {
                Console.Clear();
                DrawStatusBar();
                Console.WriteLine("How many litres to you want to water? This field currently has " + field.Water + " litres of water in it. [number; back]");
                waterCount = Console.ReadLine();
                if (waterCount == "back" || waterCount == "b")
                {
                    break;
                }

                try
                {
                    int    water = int.Parse(waterCount);
                    double price = 0; //TODO: calculate water price based on weather, difficulty etc...

                    string answer;
                    while (true)
                    {
                        PrintInfoMessage("You are about to water your field with " + water + " litres. \r\nThat will cost " + price + "$. Do you want to continue? [yes; no]");
                        answer = Console.ReadLine();

                        if (answer == "yes" || answer == "y")
                        {
                            Game.Money  -= price;
                            field.Water += water;
                            PrintInfoMessageAndWait("You watered your field with " + water + " litres.");
                            break;
                        }
                        else if (answer == "no" || answer == "n")
                        {
                            break;
                        }
                    }

                    //break; ?
                }
                catch
                {
                    PrintInfoMessageAndWait("Thats not a valid number!");
                }
            }
        }
        /// <summary>
        /// Prints info about the crops of the planted seed of the given <paramref name="field"/>
        /// and lets you select which crop to manage
        /// </summary>
        /// <param name="field">Field with the planted seed whose crops should be shown</param>
        private static void CropInfoDialog(FieldSlot field)
        {
            string anweisung;

            while (true)
            {
                PrintInfoMessage("Which crop do you want to manage? [enter index; back]\r\n\r\n" + field.PlantedSeed.GetCropInfo());

                anweisung = Console.ReadLine();
                if (anweisung == "back" || anweisung == "b")
                {
                    break;
                }

                //TODO: implement manage crop
            }
        }
        private static void PlantSeedDialog(FieldSlot field)
        {
            string seedToPlant;

            while (true)
            {
                PrintInfoMessage("Which seed do you want to plant? [enter name and index; back]\r\n\r\n" + Game.GetSeedInventoryInfo());

                seedToPlant = Console.ReadLine();
                if (seedToPlant == "back" || seedToPlant == "b")
                {
                    break;
                }

                Seed seed = GetSeedFromUserInput(seedToPlant);
                field.PlantSeed(seed);
                PrintInfoMessageAndWait("You planted a " + seed.Name + " seed! Take good care of it!");
                break;
            }
        }
        private static void ManageFieldDialog(FieldSlot field)
        {
            string anweisung;

            while (true)
            {
                PrintInfoMessage("What do you want to do? [plant seed; remove seed; water field; crop info; harvest; sell field; back]\r\n\r\n" + field.GetInfo());

                anweisung = Console.ReadLine();

                if (anweisung == "plant seed" || anweisung == "plant" || anweisung == "p")
                {
                    PlantSeedDialog(field);
                }
                else if (anweisung == "remove seed" || anweisung == "remove" || anweisung == "r")
                {
                    RemoveSeedDialog(field);
                }
                else if (anweisung == "water field" || anweisung == "water" || anweisung == "w")
                {
                    WaterFieldDialog(field);
                }
                else if (anweisung == "crop info" || anweisung == "c")
                {
                    CropInfoDialog(field);
                }
                else if (anweisung == "harvest" || anweisung == "h")
                {
                    HarvestFieldDialog(field.PlantedSeed);
                }
                else if (anweisung == "sell field" || anweisung == "sell" || anweisung == "s")
                {
                }
                else if (anweisung == "back" || anweisung == "b")
                {
                    break;
                }
            }
        }
Esempio n. 7
0
        private static void WaterFieldDialog(FieldSlot field)
        {
            string waterCount;
              while (true)
              {
            Console.Clear();
            DrawStatusBar();
            Console.WriteLine("How many litres to you want to water? This field currently has " + field.Water + " litres of water in it. [number; back]");
            waterCount = Console.ReadLine();
            if (waterCount == "back" || waterCount == "b")
              break;

            try
            {
              int water = int.Parse(waterCount);
              double price = 0; //TODO: calculate water price based on weather, difficulty etc...

              string answer;
              while (true)
              {
            PrintInfoMessage("You are about to water your field with " + water + " litres. \r\nThat will cost " + price + "$. Do you want to continue? [yes; no]");
            answer = Console.ReadLine();

            if (answer == "yes" || answer == "y")
            {
              Game.Money -= price;
              field.Water += water;
              PrintInfoMessageAndWait("You watered your field with " + water + " litres.");
              break;
            }
            else if (answer == "no" || answer == "n")
              break;
              }

              //break; ?
            }
            catch
            {
              PrintInfoMessageAndWait("Thats not a valid number!");
            }
              }
        }
Esempio n. 8
0
 private static void RemoveSeedDialog(FieldSlot field)
 {
     string remove;
       while (true)
       {
     Console.Clear();
     DrawStatusBar();
     Seed plantedSeed = field.PlantedSeed;
     if (plantedSeed != null)
     {
       Console.WriteLine("Do you really want to remove the following seed? This kills the seed. [yes; no; more info]");
       plantedSeed.GetInfo();
       remove = Console.ReadLine();
       if (remove == "yes" || remove == "y")
       {
     field.RemoveSeed();
     PrintInfoMessageAndWait("Seed successfully removed.");
       }
       else if (remove == "no" || remove == "n")
     break;
       else if (remove == "more info" || remove == "more" || remove == "m")
     PrintInfoMessageAndWait("The seed has the following Crops:\r\n\r\n" + plantedSeed.GetCropInfo());
     }
       }
 }
Esempio n. 9
0
        private static void PlantSeedDialog(FieldSlot field)
        {
            string seedToPlant;
              while (true)
              {
            PrintInfoMessage("Which seed do you want to plant? [enter name and index; back]\r\n\r\n" + Game.GetSeedInventoryInfo());

            seedToPlant = Console.ReadLine();
            if (seedToPlant == "back" || seedToPlant == "b")
              break;

            Seed seed = GetSeedFromUserInput(seedToPlant);
            field.PlantSeed(seed);
            PrintInfoMessageAndWait("You planted a " + seed.Name + " seed! Take good care of it!");
            break;
              }
        }
Esempio n. 10
0
        private static void ManageFieldDialog(FieldSlot field)
        {
            string anweisung;
              while (true)
              {
            PrintInfoMessage("What do you want to do? [plant seed; remove seed; water field; crop info; harvest; sell field; back]\r\n\r\n" + field.GetInfo());

            anweisung = Console.ReadLine();

            if (anweisung == "plant seed" || anweisung == "plant" || anweisung == "p")
            {
              PlantSeedDialog(field);
            }
            else if (anweisung == "remove seed" || anweisung == "remove" || anweisung == "r")
            {
              RemoveSeedDialog(field);
            }
            else if (anweisung == "water field" || anweisung == "water" || anweisung == "w")
            {
              WaterFieldDialog(field);
            }
            else if (anweisung == "crop info" || anweisung == "c")
            {
              CropInfoDialog(field);
            }
            else if (anweisung == "harvest" || anweisung == "h")
            {
              HarvestFieldDialog(field.PlantedSeed);
            }
            else if (anweisung == "sell field" || anweisung == "sell" || anweisung == "s")
            {

            }
            else if (anweisung == "back" || anweisung == "b")
              break;
              }
        }
Esempio n. 11
0
 /// <summary>
 /// Sets the field in which this seed is planted
 /// </summary>
 /// <param name="field">Field in which this seed is planted</param>
 public void SetField(FieldSlot field)
 {
     Field = field;
 }
Esempio n. 12
0
 /// <summary>
 /// Sets the field in which this seed is planted
 /// </summary>
 /// <param name="field">Field in which this seed is planted</param>
 public void SetField(FieldSlot field)
 {
     Field = field;
 }