示例#1
0
    public void OnEndDrag(PointerEventData eventData)
    {
        if (eventData.button.ToString() == "Left")
        {
            m_image.color = Color.gray;

            if (InventoryUIManager.GetCurrentCell() != null &&
                InventoryUIManager.AttemptMoveItem(this))
            {
                UpdateReturnPos(GetComponent <RectTransform>().localPosition);
            }
            else if (InventoryUIManager.GetHighlightedItem() != null)
            {
                InventoryUIManager.AttemptSwap(InventoryUIManager.GetHighlightedItem(), this);
            }
            else
            {
                ReturnPos();
            }
            InventoryUIManager.SetHeldItem(null);
            m_image.raycastTarget = true;
        }
    }