public void OnDrop(PointerEventData eventData) { if (eventData.pointerDrag != null) { InventoryItem inventoryItem = eventData.pointerDrag.GetComponent <InventoryItem>(); bool canMove = true; if (inventoryItem.GetParent().owner != owner) { if (inventoryItem.GetParent().owner == Owner.Player) { canMove = _sellController.BuyItem(inventoryItem.GetItem()); } else { canMove = _sellController.SellItem(inventoryItem.GetItem()); } } if (canMove) { eventData.pointerDrag.GetComponent <RectTransform>().anchoredPosition = GetComponent <RectTransform>().anchoredPosition; _image.sprite = SpriteStorage.instance.GetSellSprite(SpriteStorage.SellType.Full); ItemController parent = eventData.pointerDrag.GetComponent <InventoryItem>().GetParent(); if (parent != null) { parent._image.sprite = SpriteStorage.instance.GetSellSprite(SpriteStorage.SellType.Empty); } eventData.pointerDrag.GetComponent <InventoryItem>().SetParent(this); } else { inventoryItem.MoveBack(); } } }