Пример #1
0
    void AddItemToContainer(ItemData addItem, int amount, bool isSave)
    {
        if (amount == -1)
        {
            amount = addItem.stackSize;
            addItem.ownerContainer = itemContainer;

            itemContainer.containerItems.Add(addItem);
            itemContainer.AddItemEvent(addItem, isSave);
        }
        else
        {
            addItem.stackSize      = amount;
            addItem.ownerContainer = itemContainer;

            itemContainer.containerItems.Add(addItem);
            itemContainer.AddItemEvent(addItem, isSave);
        }
    }
Пример #2
0
 public void AddItem(ItemData addItem, int amount, bool isSave)
 {
     if (amount == -1)
     {
         amount = addItem.stackSize;
         addItem.ownerContainer = itemContainer;
         if (!AddToExistingStack(addItem, addItem.stackSize, isSave))
         {
             itemContainer.containerItems.Add(addItem);
             itemContainer.AddItemEvent(addItem, isSave);
         }
     }
     else
     {
         addItem.ownerContainer = itemContainer;
         if (!AddToExistingStack(addItem, amount, isSave))
         {
             addItem.stackSize = amount;
             itemContainer.containerItems.Add(addItem);
             itemContainer.AddItemEvent(addItem, isSave);
         }
     }
 }