61 lines
1.4 KiB
C#
61 lines
1.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.Events;
|
|
|
|
public class UI_Button : MonoBehaviour, IPointerEnterHandler, IPointerDownHandler, IPointerClickHandler,IPointerUpHandler, IPointerExitHandler
|
|
{
|
|
public bool m_PointerDown;
|
|
public bool m_PointerClick;
|
|
public bool m_PointerUp;
|
|
|
|
public bool m_PointerStay;
|
|
|
|
public UnityEvent PointerEnterEvent;
|
|
public UnityEvent PointerDownEvent;
|
|
public UnityEvent PointerClickEvent;
|
|
public UnityEvent PointerUpEvent;
|
|
public UnityEvent PointerExitEvent;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
{
|
|
PointerEnterEvent?.Invoke();
|
|
m_PointerStay = true;
|
|
}
|
|
|
|
public void OnPointerDown(PointerEventData eventData)
|
|
{
|
|
PointerDownEvent?.Invoke();
|
|
Debug.Log("Down");
|
|
}
|
|
|
|
public void OnPointerClick(PointerEventData eventData)
|
|
{
|
|
PointerClickEvent?.Invoke();
|
|
Debug.Log("Click");
|
|
}
|
|
|
|
public void OnPointerUp(PointerEventData eventData)
|
|
{
|
|
PointerUpEvent?.Invoke();
|
|
}
|
|
|
|
public void OnPointerExit(PointerEventData eventData)
|
|
{
|
|
PointerExitEvent?.Invoke();
|
|
m_PointerStay = false;
|
|
}
|
|
}
|