Пример #1
0
    public void OnDrop(PointerEventData eventData)
    {
        CardUISlot dropSlot = eventData.pointerCurrentRaycast.gameObject.GetComponentInParent <CardUISlot>();
        CardUISlot dragSlot = eventData.pointerDrag.GetComponentInParent <CardUISlot>();

        if (dropSlot != null && dragSlot != null)
        {
            int dragIndex = dragSlot.index;
            int dropIndex = dropSlot.index;
            if (dropIndex - dragIndex > 1)
            {
                dropIndex--;
            }
            if (dropIndex - dragIndex < -1)
            {
                dropIndex++;
            }
            cardUI.Drop(dragIndex, dropIndex);
        }
    }
Пример #2
0
 public void Start()
 {
     slot = GetComponentInParent <CardUISlot>();
 }