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