コード例 #1
0
        public InventoryMenu(int width, int height)
            : base(new Microsoft.Xna.Framework.Vector2(0, 0), width, height, Microsoft.Xna.Framework.Color.Black)
        {
            playerItems = new FixedMenu(vector, getWidth() / 4, (int)(getHeight() / 1.8), Microsoft.Xna.Framework.Color.LightSteelBlue, true);
            lootItems = new FixedMenu(new Vector2(0, (int)(getHeight() / 1.8) + 1), getWidth() / 4, getHeight() - (int)(getHeight() / 1.8), Microsoft.Xna.Framework.Color.LightSteelBlue, true);
            itemStats = new FixedMenu(new Vector2(getWidth() - getWidth() / 4, 0), getWidth() / 4, (int)(getHeight() / 1.8), Microsoft.Xna.Framework.Color.LightSteelBlue);
            itemPicture = new FixedMenu(new Vector2(getWidth() - getWidth() / 4, (int)(getHeight() / 1.8) + 1), getWidth() / 4, (int)(getHeight() / 1.8), Microsoft.Xna.Framework.Color.LightSteelBlue);

            playerStats = new FixedMenu(new Vector2(getWidth() / 4 + 1, getHeight() - getHeight() / 3), -(int)(playerItems.getVector().X + getWidth() / 4 - itemStats.getVector().X) - 2, getHeight() / 3, Color.LightSteelBlue);

            takeDropButton = new Button(new Vector2(lootItems.getVector().X + getWidth() / 4 - ResourceHandler.getInstance().getVerdana().MeasureString("Switch").X - 2, (int)(getHeight() / 1.8) + 1), "Switch", Color.White);
            takeDropButton.setBackground(Color.LightSteelBlue);
            takeDropButton.setAction(new SwitchInventory());

            useItemButton = new Button(new Vector2(itemStats.getVector().X, (int)(getHeight()/1.8)), "Use", Color.White);
            useItemButton.setBackground(Color.LightSteelBlue);
            useItemButton.setAction(new UseItemAction());

            equipItemButton = new Button(new Vector2(itemStats.getVector().X, (int)(getHeight() / 1.8) + useItemButton.getHeight()), "Equip", Color.White);
            equipItemButton.setBackground(Color.LightSteelBlue);
            equipItemButton.setAction(new EquipItemAction());

            setLayer(5);
            setEnabled(false);
            takeDropButton.setLayer(6);
            useItemButton.setLayer(6);
            equipItemButton.setLayer(6);
        }
コード例 #2
0
        public FixedMenu(Vector2 vector, int width, int height, Color color, bool scroll)
            : base(vector, width, height, color)
        {
            items = new List<Clickable>();

            if(scroll)
            {
                scrollButton = new Button(Vector2.Zero, "Scroll >>>", Color.White);
                scrollButton.setAction(new ScrollButtonAction(this));
                add(scrollButton);
            }

            scrollable = scroll;
        }
コード例 #3
0
        public SquareChestChunk(int chunkPos, int baseHeight)
            : base(chunkPos, baseHeight)
        {
            inventory = new Inventory();
            inventory.add(ItemFactoryManager.getInstance().createWeapon());
            inventory.add(ItemFactoryManager.getInstance().generateHealthPotion());
            chestButton = new ChestButton(this, Vector2.Zero, inventory);

            Random rand = new Random(new Guid().GetHashCode());

            int bonus = rand.Next(8);

            if (bonus == 6)
            {
                inventory.add(ItemFactoryManager.getInstance().generateAmmoPack());
            }
            else if (bonus == 3)
            {
                inventory.add(ItemFactoryManager.getInstance().generateHealthPotion());
            }
        }
コード例 #4
0
 public SquareChestChunk(int chunkPos, int baseHeight, String inventory)
     : base(chunkPos, baseHeight)
 {
     this.inventory = new Inventory(10, inventory);
     chestButton = new ChestButton(this, Vector2.Zero, this.inventory);
 }