示例#1
0
 override public void Draw(SpriteBatch spriteBatch)
 {
     spriteBatch.Draw(containerTexture, container, Color.White);
     spriteBatch.Draw(itemSlotTexture, itemSlot, Color.White);
     if (equippedItem != null)
     {
         equippedItem.Draw(spriteBatch);
     }
 }
示例#2
0
        override public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(containerTexture, container, color);

            int itemCount = inventoryItems.Count;

            for (int i = 0; i < 7; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    Texture2D texture = itemSlotTexture;
                    if (((i * 5) + j) < itemCount)
                    {
                        if (inventoryItems[(i * 5) + j].GetHovering())
                        {
                            texture = selectedItemSlotTexture;
                        }
                    }
                    spriteBatch.Draw(texture, new Vector2(10 + (container.X + (j * 50)), 40 + (container.Y + (i * 50))), color);
                }
            }

            foreach (InventoryItem item in inventoryItems)
            {
                item.Draw(spriteBatch);
                spriteBatch.DrawString(font, item.GetItem().Count + "", new Vector2(item.GetHitBox().X + item.GetItem().width, item.GetHitBox().Y + item.GetItem().height - 4), Color.Black);
            }
            if (selectedItem != null)
            {
                selectedItem.Draw(spriteBatch);
            }
            foreach (InventoryItem item in inventoryItems)
            {
                if (item.GetHovering())
                {
                    item.DrawPopupText(spriteBatch);
                    break;
                }
            }
        }