public override void OnDrop(PointerEventData eventData) { ItemDragHandler itemDragHandler = eventData.pointerDrag.GetComponent <ItemDragHandler>(); if (itemDragHandler == null) { return; } InventorySlot inventorySlot = itemDragHandler.ItemSlotUI as InventorySlot; if (inventorySlot != null) { SlotItem = inventorySlot.ItemSlot.item; return; } HotbarSlot hotbarSlot = itemDragHandler.ItemSlotUI as HotbarSlot; if (hotbarSlot != null) { HotbarItem oldItem = SlotItem; SlotItem = hotbarSlot.SlotItem; hotbarSlot.SlotItem = oldItem; return; } }
public override void OnDrop(PointerEventData eventData) { ItemDragHandler itemDragHandler = eventData.pointerDrag.GetComponent <ItemDragHandler>(); if (itemDragHandler == null) { return; } if ((itemDragHandler.ItemSlotUI as InventorySlot) != null) { inventory.ItemContainer.Swap(itemDragHandler.ItemSlotUI.SlotIndex, SlotIndex); } }