Beispiel #1
0
        static void Main()
        {
            Inventory myInventory = new Inventory();

            myInventory.ListInventory = Console.ReadLine()
                                        .Split(", ", StringSplitOptions.RemoveEmptyEntries)
                                        .ToList();

            string input = Console.ReadLine();

            while (input != "Craft!")
            {
                string[] commands = input.Split(" - ", StringSplitOptions.RemoveEmptyEntries);
                string   command  = commands[0];
                string   item     = commands[1];

                switch (command)
                {
                case "Collect":
                    myInventory.Collect(item);
                    break;

                case "Drop":
                    myInventory.Drop(item);
                    break;

                case "Combine Items":
                    string[] items = item.Split(':');
                    myInventory.CombineItems(items[0], items[1]);
                    break;

                case "Renew":
                    myInventory.Renew(item);
                    break;

                default:
                    break;
                }

                input = Console.ReadLine();
            }

            Console.WriteLine(myInventory);
        }