【add】staryEvoTools

This commit is contained in:
2025-09-02 10:54:13 +08:00
parent e3050cd137
commit 796c8d845d
173 changed files with 7783 additions and 0 deletions

View File

@@ -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);
}
}
}