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