Пример #1
0
        void OnDrop(GameObject go)
        {
            var slot = go.GetComponent <UiSlot>();

            if (slot == null)
            {
                return;
            }

            if (!CanSetEquip(slot))
            {
                return;
            }

            var slotItem = slot.ItemModel;

            if (ItemModel != null && ItemModel.Item != null && slot.ItemModel != null && slot.ItemModel.Item != null &&
                slot.ItemModel.Item.GetType() == ItemModel.Item.GetType() &&
                (slot.ItemModel.Item.Durability == null || !slot.ItemModel.Item.ShowDurability))
            {
                ItemModel.ChangeAmount(-slotItem.Amount);
                slot.SetData(_gameManager, null);
            }
            else
            {
                slot.SetData(_gameManager, ItemModel);
                SetData(_gameManager, slotItem);
            }

            if (OnManualValueChanged != null)
            {
                OnManualValueChanged(this);
            }
        }
Пример #2
0
 public void ChangeAmount(int amount = 1)
 {
     ItemModel.ChangeAmount(amount);
 }