46 lines
1.0 KiB
C#
46 lines
1.0 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.Events;
|
|
|
|
public class UIImageAdvancedInteractions : MonoBehaviour,
|
|
IPointerEnterHandler,
|
|
IPointerExitHandler
|
|
{
|
|
[System.Serializable]
|
|
public class UIEvent : UnityEvent<PointerEventData> { }
|
|
|
|
[Header("Events")]
|
|
public UIEvent onPointerEnter;
|
|
public UIEvent onPointerExit;
|
|
public UIEvent onPointerClick;
|
|
|
|
private Image _image;
|
|
|
|
private void Awake()
|
|
{
|
|
_image = GetComponent<Image>();
|
|
}
|
|
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
{
|
|
onPointerEnter.Invoke(eventData);
|
|
Debug.Log("OnPointerEnter");
|
|
}
|
|
|
|
public void OnPointerExit(PointerEventData eventData)
|
|
{
|
|
onPointerExit.Invoke(eventData);
|
|
Debug.Log("OnPointerExit");
|
|
}
|
|
|
|
public void OnPointerClick(PointerEventData eventData)
|
|
{
|
|
onPointerClick.Invoke(eventData);
|
|
Debug.Log("OnPointerClick");
|
|
}
|
|
} |