//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, July 31, 2017
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.EventSystems;
|
using UnityEngine.Events;
|
|
namespace vnxbqy.UI
|
{
|
|
public class PointerDownUp : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IPointerClickHandler
|
{
|
|
[SerializeField]
|
UIEvent m_OnPointerDown;
|
public UIEvent onPointerDown { get { return m_OnPointerDown; } }
|
|
[SerializeField]
|
UIEvent m_OnPointerUp;
|
public UIEvent onPointerUp { get { return m_OnPointerUp; } }
|
|
[SerializeField]
|
UIEvent m_OnPointerClick;
|
public UIEvent onPointerClick {
|
get {
|
return m_OnPointerClick;
|
}
|
}
|
|
public void OnPointerUp(PointerEventData eventData)
|
{
|
if (onPointerUp != null)
|
{
|
onPointerUp.Invoke();
|
}
|
}
|
|
public void OnPointerDown(PointerEventData eventData)
|
{
|
if (onPointerDown != null)
|
{
|
onPointerDown.Invoke();
|
}
|
}
|
|
public void OnPointerClick(PointerEventData eventData)
|
{
|
if (onPointerClick != null)
|
{
|
onPointerClick.Invoke();
|
}
|
}
|
|
public void AddPointerDownListener(UnityAction _action)
|
{
|
if (onPointerDown != null)
|
{
|
onPointerDown.AddListener(_action);
|
}
|
}
|
|
public void AddPointerUpListener(UnityAction _action)
|
{
|
if (onPointerUp != null)
|
{
|
onPointerUp.AddListener(_action);
|
}
|
}
|
|
public void AddPointerClickListener(UnityAction _action)
|
{
|
if (onPointerClick != null)
|
{
|
onPointerClick.AddListener(_action);
|
}
|
}
|
|
public void RemoveAllPointerDownListeners()
|
{
|
if (onPointerDown != null)
|
{
|
onPointerDown.RemoveAllListeners();
|
}
|
}
|
|
public void RemoveAllPointerUpListeners()
|
{
|
if (onPointerUp != null)
|
{
|
onPointerUp.RemoveAllListeners();
|
}
|
}
|
|
public void RemoveAllPointerClickListeners()
|
{
|
if (onPointerClick != null)
|
{
|
onPointerClick.RemoveAllListeners();
|
}
|
}
|
|
|
}
|
|
}
|
|
|
|