Ejemplo n.º 1
0
    public void OnPointerDown(PointerEventData eventData)
    {
        // If this slot has item
        if (this.item != null)
        {
            // If our cursor has item
            if (selectedItem.item != null)
            {
                //Item clone = new Item(selectedItem.item);
                int  cloneAmount = selectedItem.amountItems;
                Item clone       = ItemDatabase.instance.GetItem(selectedItem.item.id);

                // Make clone of cursors item.
                selectedItem.UpdateItem(this.item, this.amountItems);
                UpdateItem(clone, cloneAmount);
            }
            else
            {
                // Make cursors item this item
                selectedItem.UpdateItem(this.item, this.amountItems);
                // Make this item null.
                UpdateItem(null, 0);
            }
        }
        else if (selectedItem.item != null)
        {
            // Make this item into cursors item.
            UpdateItem(selectedItem.item, selectedItem.amountItems);
            // Make cursors item null
            selectedItem.UpdateItem(null, 0);
        }
    }
Ejemplo n.º 2
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (this.item != null)
     {
         if (selectedItem.item != null)
         {
             Item clone = new Item(selectedItem.item);
             selectedItem.UpdateItem(this.item);
             UpdateItem(clone);
         }
         else
         {
             selectedItem.UpdateItem(this.item);
             UpdateItem(null);
         }
     }
     else if (selectedItem.item != null)
     {
         UpdateItem(selectedItem.item);
         selectedItem.UpdateItem(null);
     }
 }