public static void CollectInput(Farm farm) { Console.WriteLine("1. Seed Harvester"); Console.WriteLine("2. Meat Processor"); Console.WriteLine("3. Egg Gatherer"); Console.WriteLine("4. Composter"); Console.WriteLine("5. Feather Harvester"); Console.WriteLine(); Console.WriteLine("Choose equipment to use."); Console.Write("> "); string choice = Console.ReadLine(); try { switch (Int32.Parse(choice)) { case 1: ChooseSeedHarvester.CollectInput(farm, new SeedHarvester()); break; // case 2: // ChooseMeatHarvester.CollectInput(farm, new MeatProcessor()); // break; case 3: ChooseEggHarvester.CollectInput(farm, new EggHarvester()); break; case 4: ChooseComposter.CollectInput(farm, new Composter()); break; case 5: ChooseFeatherHarvester.CollectInput(farm, new FeatherHarvester()); break; default: break; } } catch (FormatException ex) { Console.WriteLine(ex); } }
public static void CollectInput(Farm farm) { Console.WriteLine("1. Seed Harvester"); Console.WriteLine("2. Meat Processor"); Console.WriteLine("3. Egg Gatherer"); Console.WriteLine("4. Composter"); Console.WriteLine("5. Feather Harvester"); Console.WriteLine(); Console.WriteLine("Choose equipment to use."); Console.Write("> "); string choice = Console.ReadLine(); switch (Int32.Parse(choice)) { case 1: ChooseSeedHarvester.CollectInput(farm); break; case 2: ChooseMeatProcessor.CollectInput(farm); break; case 3: ChooseEggGatherer.CollectInput(farm); break; case 4: ChooseComposter.CollectInput(farm); break; case 5: ChooseFeatherHarvester.CollectInput(farm); break; default: Console.WriteLine(); Console.WriteLine("Invalid input! Press any key to return home"); Console.ReadLine(); break; } }
public static void ListResources(Farm farm, string id, string type, int alreadyProcessedSunflowers) { IEnumerable<NaturalField> CorrectFieldEnumerable = from field in farm.NaturalFields where field.ShortId == id select field; List<NaturalField> CorrectFieldList = CorrectFieldEnumerable.ToList(); NaturalField CorrectField = CorrectFieldList[0]; IEnumerable<NaturalFieldReport> OrderedFlowers = (from flower in CorrectField.plantsList group flower by flower.Type into NewGroup select new NaturalFieldReport { PlantType = NewGroup.Key, Number = NewGroup.Count().ToString() } ); IEnumerable<NaturalFieldReport> JustSunflowers = from flower in OrderedFlowers where flower.PlantType == "Sunflower" select flower; List<NaturalFieldReport> OrderedSunflowersList = JustSunflowers.ToList(); int count = 1; int numberToCheckSunflower = 0; Console.WriteLine(); Console.WriteLine("The following flowers can be processed in the Natural Field"); Console.WriteLine(); foreach (NaturalFieldReport flower in JustSunflowers) { numberToCheckSunflower = Int32.Parse(flower.Number) - alreadyProcessedSunflowers; Console.WriteLine($"{count}: {numberToCheckSunflower} {flower.PlantType}"); count++; } Console.WriteLine(); Console.WriteLine("Which resource should be processed?"); Console.Write("> "); int choice = Int32.Parse(Console.ReadLine()); int correctedChoice = choice - 1; string PlantType = OrderedSunflowersList[correctedChoice].PlantType; Console.WriteLine($"How many {PlantType} should be processed? (Max 5)"); int amountToProcess = Int32.Parse(Console.ReadLine()); while (amountToProcess > 5) { Console.WriteLine("Yo I can't process that much at once, dumbass"); amountToProcess = Int32.Parse(Console.ReadLine()); } while (amountToProcess > numberToCheckSunflower) { Console.WriteLine("Yo there aren't that many to process, dumbass"); amountToProcess = Int32.Parse(Console.ReadLine()); } farm.ProcessingList.Add(new ToProcess { FacilityId = CorrectField.ShortId, Type = PlantType, AmountToProcess = amountToProcess }); Console.WriteLine("Ready to process? (Y/n)"); Console.Write("> "); string input = Console.ReadLine(); switch (input) { case "Y": break; case "n": ChooseSeedHarvester.CollectInput(farm); break; default: break; } }