コード例 #1
0
    public void OnEndDrag(PointerEventData eventData)
    {
        float x = DragSlot.instance.transform.localPosition.x;
        float y = DragSlot.instance.transform.localPosition.y;

        if (_item != null && DragSlot.instance._itemSlot != null)
        {
            if (!((x > _inventoryRect.xMin && x < _inventoryRect.xMax && y > _inventoryRect.yMin && y < _inventoryRect.yMax) ||
                  (x > _quickSlotR.xMin && x < _quickSlotR.xMax && y > _quickSlotRect.transform.localPosition.y - _quickSlotR.yMax && y < _quickSlotRect.transform.localPosition.y - _quickSlotR.yMin)))
            {
                if (!DragSlot.instance._itemSlot.IsQuickSlot)
                {
                    _itemDrop.CallEvent();
                    return;
                }
                ClearSlot();
                DragSlot.instance.SetColor(0);
                DragSlot.instance._itemSlot = null;
            }
            else
            {
                DragSlot.instance.SetColor(0);
                DragSlot.instance._itemSlot = null;
            }
        }
    }