IEnumerator InfiniteCoroutine()
{
while(true)
{
yield return null;
}
}
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class TouchPanel : Graphic, IPointerClickHandler, IDragHandler, IPointerDownHandler, IPointerUpHandler
{
public DataEvent onClick = new DataEvent();
public DataEvent onDrag = new DataEvent();
public DataEvent onPointerDown = new DataEvent();
public DataEvent onPointerUp = new DataEvent();
#if UNITY_EDITOR
protected override void Reset()
{
base.Reset();
color = Color.clear;
}
#endif
public void OnPointerClick(PointerEventData eventData)
{
onClick.Invoke(eventData);
}
public void OnDrag(PointerEventData eventData)
{
onDrag.Invoke(eventData);
}
public void OnPointerDown(PointerEventData eventData)
{
onPointerDown.Invoke(eventData);
}
public void OnPointerUp(PointerEventData eventData)
{
onPointerUp.Invoke(eventData);
}
public class DataEvent : UnityEvent<PointerEventData>
{
}
}