com.alicizax.unity.framework/Runtime/ABase/Event/EventPublisher.cs
b4lie 93aba55cb0 增加Event调试编辑器
1.增加Event调试编辑器查看订阅信息
2.调试编辑器增加快照查看泄露风险数据
2026-03-21 21:19:07 +08:00

44 lines
1.4 KiB
C#

using System;
using System.Runtime.CompilerServices;
using Unity.IL2CPP.CompilerServices;
namespace AlicizaX
{
public static class EventPublisher
{
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static EventRuntimeHandle Subscribe<T>(Action<T> handler) where T : struct, IEventArgs
{
return EventContainer<T>.Subscribe(handler);
}
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.DivideByZeroChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Publish<T>(in T evt) where T : struct, IEventArgs
{
EventContainer<T>.Publish(in evt);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int GetSubscriberCount<T>() where T : struct, IEventArgs
{
return EventContainer<T>.SubscriberCount;
}
public static void EnsureCapacity<T>(int capacity) where T : struct, IEventArgs
{
EventContainer<T>.EnsureCapacity(capacity);
}
public static void Clear<T>() where T : struct, IEventArgs
{
EventContainer<T>.Clear();
}
}
}