框架上传
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public class OnMoveEventTrigger: MonoBehaviour, IMoveHandler
|
||||
{
|
||||
public readonly EasyEvent<AxisEventData> OnMoveEvent = new EasyEvent<AxisEventData>();
|
||||
|
||||
public void OnMove(AxisEventData eventData)
|
||||
{
|
||||
OnMoveEvent.Trigger(eventData);
|
||||
}
|
||||
}
|
||||
|
||||
public static class OnMoveEventTriggerExtension
|
||||
{
|
||||
public static IUnRegister OnMoveEvent<T>(this T self, Action<AxisEventData> onMove)
|
||||
where T : Component
|
||||
{
|
||||
return self.GetOrAddComponent<OnMoveEventTrigger>().OnMoveEvent.Register(onMove);
|
||||
}
|
||||
|
||||
public static IUnRegister OnMoveEvent(this GameObject self, Action<AxisEventData> onMove)
|
||||
{
|
||||
return self.GetOrAddComponent<OnMoveEventTrigger>().OnMoveEvent.Register(onMove);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user