2026-03-21 21:19:07 +08:00
|
|
|
|
using System;
|
2025-11-14 11:38:28 +08:00
|
|
|
|
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
|
|
|
|
|
|
{
|
2025-12-24 14:34:26 +08:00
|
|
|
|
EventContainer<T>.Publish(in evt);
|
2025-11-14 11:38:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-24 14:34:26 +08:00
|
|
|
|
[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();
|
|
|
|
|
|
}
|
2025-11-14 11:38:28 +08:00
|
|
|
|
}
|
2025-12-24 14:34:26 +08:00
|
|
|
|
}
|