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); } }
public void Start() { slot = GetComponentInParent <CardUISlot>(); }