EventSystem扩展

This commit is contained in:
2025-01-16 19:21:33 +08:00
parent cb3eff896d
commit 879f74b7bf
11 changed files with 234 additions and 53 deletions
@@ -0,0 +1,66 @@
using AibisDream.Kit;
using UnityEngine;
namespace AibisDream.Framework
{
public class EventSystemEx : SingletonBase<EventSystemEx>
{
public GameObject pointerOverObj;
public GameObject draggingObj;
public GameObject holdingObj;
#region
public void OnPointerEnter(GameObject gameObject)
{
pointerOverObj = gameObject;
EnumEventSystem.Global.Send(TriggerEnum.PointerEnter, gameObject);
}
public void OnPointerExit(GameObject gameObject)
{
EnumEventSystem.Global.Send(TriggerEnum.PointerExit, gameObject);
if (pointerOverObj == gameObject)
{
pointerOverObj = null;
}
}
public void OnPointerDown(GameObject gameObject)
{
EnumEventSystem.Global.Send(TriggerEnum.PointerDown, gameObject);
holdingObj = gameObject;
}
public void OnPointerUp(GameObject gameObject)
{
EnumEventSystem.Global.Send(TriggerEnum.PointerUp, gameObject);
if (holdingObj == gameObject)
{
holdingObj = null;
}
}
#endregion
#region
private EventSystemEx()
{
}
public override void OnSingletonInit()
{
}
#endregion
}
public enum TriggerEnum
{
PointerEnter,
PointerExit,
PointerDown,
PointerUp
}
}