示例#1
0
        static void Main(string[] args)
        {
            ShopItemRegistry.RegisterAll();
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.White;
            Console.Clear();
            Console.CursorVisible = false;
            Task mainLoopTask = new Task(Tick);

            Pet testPet  = new Pet("Tomcat", 100, 0, 0.3f, 100, new PetCapabilities(false, true, false, true, false), 25);
            Pet testPet2 = new Pet("Clifford", 110, 0, 0.5f, 100, new PetCapabilities(true, true, false, true, false), 25);

            testPet.Room   = Rooms[0];
            testPet2.Room  = Rooms[0];
            testPet.Owner  = Player;
            testPet2.Owner = Player;
            Player.Pets.AddPet(testPet);
            Player.Pets.AddPet(testPet2);
            Player.Pets.SelectedPet      = testPet;
            Player.Pets.SelectedPet.Room = Rooms[0];
            MainMenu           = new MainMenu();
            Menu               = MainMenu;
            Menu.ActivePet     = Player.Pets.SelectedPet;
            Menu.CurrentPlayer = Player;
            // Player.PlayerInventory.AddItem(new ToyBall());
            Player.PlayerInventory.AddItem(new FoodSteak());
            Player.PlayerInventory.AddItem(new FoodSteak());
            Player.PlayerInventory.AddItem(new FoodSteak());
            Player.PlayerInventory.AddItem(new ToyBall());
            Player.PlayerInventory.Coins = 1000;
            //MainMenu = Menu;

            mainLoopTask.Start();

            //Input loop here
            try
            {
                while (Running)
                {
                    Menu.HandleInput(Console.ReadKey(true));
                }
            }
            catch (Exception e)
            {
                finalMessage = e.Message + e.StackTrace;
                Running      = false;
            }

            Console.Clear();
            Console.WriteLine(finalMessage);

            Console.ReadKey();
        }
示例#2
0
        public ItemShopMenu(ItemType shopItemsType)
        {
            items = ShopItemRegistry.GetShopItemsByType(shopItemsType);

            foreach (InventoryItem item in this.items)
            {
                this.AvailableActions.Add(new ActionShopItem(item));
            }

            // this.AvailableActions.Add(new ActionShopItem(new ToyBall()));
            // this.AvailableActions.Add(new ActionShopItem(new FoodSteak()));
            this.AvailableActions.Add(new ActionPreviousMenu());
            this.AvailableActions.Add(new ActionGoToMainMenu());
        }