32 lines
911 B
Plaintext
32 lines
911 B
Plaintext
|
using UnityEngine;
|
||
|
using UnityEngine.EventSystems;
|
||
|
|
||
|
public class DragImage : MonoBehaviour,IDragHandler,IBeginDragHandler,IEndDragHandler
|
||
|
{
|
||
|
public bool isDrag;
|
||
|
public void OnBeginDrag(PointerEventData eventData)
|
||
|
{
|
||
|
GameObject draggedObject = eventData.pointerDrag;
|
||
|
if (draggedObject != null && draggedObject.name == gameObject.name)
|
||
|
{
|
||
|
isDrag = true;
|
||
|
}
|
||
|
}
|
||
|
public void OnDrag(PointerEventData eventData)
|
||
|
{
|
||
|
GameObject draggedObject = eventData.pointerDrag;
|
||
|
if (draggedObject != null && draggedObject.name == gameObject.name)
|
||
|
{
|
||
|
isDrag = true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void OnEndDrag(PointerEventData eventData)
|
||
|
{
|
||
|
GameObject draggedObject = eventData.pointerDrag;
|
||
|
if (draggedObject != null && draggedObject.name == gameObject.name)
|
||
|
{
|
||
|
isDrag = false;
|
||
|
}
|
||
|
}
|
||
|
}
|