Exemple #1
0
        public void OnDrop(PointerEventData eventData)
        {
            ItemView dragged = eventData.pointerDrag.GetComponent <ItemView>();
            SlotView other   = dragged.currentSlot;

            Slot.GetSlotFromId(other.slotID).ClearSlot();
        }
Exemple #2
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     if (isStandalone)
     {
         return;
     }
     Tooltip.instance.Activate(Slot.GetSlotFromId(currentSlot.slotID).item);
 }
Exemple #3
0
        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();
        }
Exemple #4
0
        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);
        }
Exemple #5
0
 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;
     }
 }