public void OnPointerDown(PointerEventData eventData)
 {
     if (this.item != null)
     {
         UICraftResult craftResult = GetComponent <UICraftResult>();
         if (craftResult != null && this.item != null && selectedItem.item == null)
         {
             craftResult.PickItem();
             selectedItem.UpdateItem(this.item);
             craftResult.ClearSlots();
         }
         else if (!craftingResultSlot)
         {
             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 && !craftingResultSlot)
     {
         UpdateItem(selectedItem.item);
         selectedItem.UpdateItem(null);
     }
 }
Beispiel #2
0
 public void OnPointerDown(PointerEventData eventData)
 {
     if (this.item != null)
     {
         UICraftResult craftResult = GetComponent <UICraftResult>();
         if (craftResult != null && this.item != null && selectedItem.item == null)
         {
             craftResult.PickItem();
             selectedItem.UpdateItem(this.item);
             craftResult.ClearSlots();
         }
         else if (!craftingResultSlot)
         {
             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 && !craftingResultSlot)
     {
         UpdateItem(selectedItem.item);
         selectedItem.UpdateItem(null);
     }
     ////check if player cliks on empty slot or filled slot.
     //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);
     //}
 }
 public void OnPointerDown(PointerEventData eventData)
 {
     if (this.item != null)
     {
         UICraftResult craftResult = GetComponent <UICraftResult>();
         if (craftResult != null && selectedItem.item == null) // Successful craft
         {
             craftResult.PickItem();
             selectedItem.UpdateItem(this.item);
             craftResult.ClearSlots();
         }
         else if (!isCraftingResultSlot)
         {
             if (IsAnItemSelected())
             {
                 if (isPlayerEquipmentSlot)
                 {
                     if (IsEquippable(selectedItem))
                     {
                         SwapItems();
                     }
                     else
                     {
                         inventoryController.DeselectItem();
                     }
                 }
                 else
                 {
                     SwapItems();
                 }
             }
             else
             {
                 selectedItem.UpdateItem(this.item);
                 UpdateItem(null);
             }
         }
     }
     else if (IsAnItemSelected() && !isCraftingResultSlot)
     {
         if (isPlayerEquipmentSlot && !IsEquippable(selectedItem))
         {
             inventoryController.DeselectItem();
         }
         else
         {
             UpdateItem(selectedItem.item);
             selectedItem.UpdateItem(null);
         }
     }
 }
        public override void OnPointerDown(PointerEventData eventData)
        {
            base.OnPointerDown(eventData);

            UICraftResult craftResult = GetComponent <UICraftResult>();

            if (craftResult != null && ItemInSlot != null && selectedItem.ItemInSlot == null)
            {
                //UpdateSlot(null);
                craftResult.PickItem();
                selectedItem.UpdateSlot(ItemInSlot);
                UpdateSlot(null);
                craftResult.ClearSlots();
            }
        }