InventoryUI.AddItem C# (CSharp) Méthode

AddItem() public méthode

public AddItem ( Item, item ) : bool
item Item,
Résultat bool
    public bool AddItem(Item item)
    {
        return this.AddItem (item, Item.Type.General);
    }

Same methods

InventoryUI::AddItem ( Item, item, Item, type ) : bool

Usage Example

    public void AddItem(Item _item, int _amount)
    {
        //Do we already have this item? then add the amounts
        foreach (InventoryItem item in items)
        {
            if (item.item == _item)
            {
                item.amount += _amount;
                int diff = 0;

                if (item.amount > item.item.stack)
                {
                    diff = item.amount - item.item.stack;
                    invUI.AddItem(new InventoryItem(_item, diff), true);
                }

                invUI.AddAmountToItem(new InventoryItem(_item, _amount - diff));


                return;
            }
        }


        items.Add(new InventoryItem(_item, _amount));
        invUI.AddItem(new InventoryItem(_item, _amount));
    }
All Usage Examples Of InventoryUI::AddItem