public static void CollectInput(Farm farm) { Console.Clear(); // List appropriate resource facilities int i = 1; farm.PlowedFields.ForEach(f => { Console.WriteLine($"{i}. {f.GetType().Name}"); i++; }); Console.WriteLine($"{i}. Complete Processing"); int fieldIndex = Prompt.Query("Which facility has the resources to use?") - 1; // If user chose to complete processing if (fieldIndex + 1 == i) { // Output the result of processing the resources farm.SeedHarvester.ProcessResources(); // Remove items from source list ChooseSeedResource.discards.ForEach(d => farm.PlowedFields[d.ListIndex].DiscardResource(d.ItemIndex)); ChooseSeedResource.discards.Clear(); Console.ReadLine(); } else { var chosenField = farm.PlowedFields[fieldIndex]; // List resources in chosen facility i = 1; chosenField.Resources.ForEach(r => { if (!r.InProcess) { Console.WriteLine($"{i}. {r.Type}"); } i++; }); int resourceIndex = Prompt.Query("Which resource?") - 1; var chosenResource = chosenField.Resources[resourceIndex]; chosenResource.InProcess = true; farm.SeedHarvester.Resources.Add(chosenResource); ChooseSeedResource.discards.Add(new Discard { ItemIndex = resourceIndex, ListIndex = fieldIndex }); ChooseSeedResource.CollectInput(farm); } }
public static void CollectInput(Farm farm) { Console.Clear(); Console.WriteLine("1. Composter"); Console.WriteLine("2. Egg Gatherer"); Console.WriteLine("3. Feather Harvester"); Console.WriteLine("4. Meat Processor"); Console.WriteLine("5. Seed Harvester"); Console.WriteLine(); Console.WriteLine("Which equipment do you want to use?"); Console.Write("> "); string input = Console.ReadLine(); switch (Int32.Parse(input)) { case 1: Process.ChooseCompostableResource(farm); break; case 2: Process.ChooseEggResource(farm); break; case 3: Process.ChooseFeatherResource(farm); break; case 4: ChooseMeatResource.CollectInput(farm); break; case 5: ChooseSeedResource.CollectInput(farm); break; default: break; } }