框架上传
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public class OnCancelEventTrigger: MonoBehaviour, ICancelHandler
|
||||
{
|
||||
public readonly EasyEvent<BaseEventData> OnCancelEvent = new EasyEvent<BaseEventData>();
|
||||
|
||||
public void OnCancel(BaseEventData eventData)
|
||||
{
|
||||
OnCancelEvent.Trigger(eventData);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static class OnCancelEventTriggerExtension
|
||||
{
|
||||
public static IUnRegister OnCancelEvent<T>(this T self, Action<BaseEventData> onCancel)
|
||||
where T : Component
|
||||
{
|
||||
return self.GetOrAddComponent<OnCancelEventTrigger>().OnCancelEvent.Register(onCancel);
|
||||
}
|
||||
|
||||
public static IUnRegister OnCancelEvent(this GameObject self, Action<BaseEventData> onCancel)
|
||||
{
|
||||
return self.GetOrAddComponent<OnCancelEventTrigger>().OnCancelEvent.Register(onCancel);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user