using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class Demo : MonoBehaviour, IPointerClickHandler, IPointerDownHandler, IPointerUpHandler, IDragHandler, IBeginDragHandler, IEndDragHandler
{
public void OnBeginDrag(PointerEventData eventData)
{
this.GetComponent<RectTransform>().anchoredPosition += eventData.delta;
Debug.Log("OnBeginDrag anchoredPosition.x = " + this.GetComponent<RectTransform>().anchoredPosition.x);
}
public void OnDrag(PointerEventData eventData)
{
this.GetComponent<RectTransform>().anchoredPosition += eventData.delta;
Debug.Log("OnDrag anchoredPosition.x = " + this.GetComponent<RectTransform>().anchoredPosition.x);
}
public void OnEndDrag(PointerEventData eventData)
{
this.GetComponent<RectTransform>().anchoredPosition += eventData.delta;
Debug.Log("OnEndDrag anchoredPosition.x = " + this.GetComponent<RectTransform>().anchoredPosition.x);
}
public void OnPointerDown(PointerEventData eventData)
{
Debug.Log("OnPointerDown");
}
public void OnPointerUp(PointerEventData eventData)
{
Debug.Log("OnPointerUp");
}
public void OnPointerClick(PointerEventData eventData)
{
Debug.Log("OnPointerClick");
}
}
|