public void OnDrop(PointerEventData eventData) { ItemView dragged = eventData.pointerDrag.GetComponent <ItemView>(); SlotView other = dragged.currentSlot; Slot.GetSlotFromId(other.slotID).ClearSlot(); }
public void OnPointerEnter(PointerEventData eventData) { if (isStandalone) { return; } Tooltip.instance.Activate(Slot.GetSlotFromId(currentSlot.slotID).item); }
public void OnDrop(PointerEventData eventData) { ItemView dragged = eventData.pointerDrag.GetComponent <ItemView>(); SlotView other = dragged.currentSlot; Slot sl = Slot.GetSlotFromId(other.slotID); InventoryController.getInventoryType(InventoryController.Inventory.Both).RemoveItem(sl.item.id, sl.amount); sl.ClearSlot(); }
internal static ItemView Create(SlotView slot) { ItemView toReturn = Instantiate(prefab).GetComponent <ItemView>(); toReturn.currentSlot = slot; toReturn.isStandalone = false; toReturn.amount = Slot.GetSlotFromId(slot.slotID).amount; toReturn.amountView.text = toReturn.amount.ToString(); toReturn.GetComponent <Image>().sprite = Slot.GetSlotFromId(slot.slotID).item.Sprite; return(toReturn); }
public void UpdateView() { if (itemView != null) { Destroy(itemView.gameObject); itemView = null; } if (!Slot.GetSlotFromId(slotID).IsEmpty()) { ItemView itemView = ItemView.Create(this); itemView.transform.SetParent(transform, false); this.itemView = itemView; } }