Files
plugin-library/Assets/00.StaryEvo/Runtime/Rule/ICanRegisterEvent.cs

125 lines
4.5 KiB
C#
Raw Normal View History

2025-03-31 11:16:52 +08:00
using System;
namespace Stary.Evo
{
2025-10-31 11:18:23 +08:00
public interface ICanRegisterEvent : IBelongToArchitecture
2025-03-31 11:16:52 +08:00
{
}
2025-10-31 11:18:23 +08:00
2025-03-31 11:16:52 +08:00
public static class CanRegisterEventExtension
{
2025-10-31 11:18:23 +08:00
public static IUnRegister RegisterEvent<T>(this ICanRegisterEvent self, T key, Action onEvent)
where T : IConvertible
{
return self.GetArchitecture().RegisterEvent(key, onEvent);
}
public static IUnRegister RegisterEvent<T, T1>(this ICanRegisterEvent self, T key, Action<T1> onEvent)
where T : IConvertible
{
return self.GetArchitecture().RegisterEvent(key, onEvent);
}
public static IUnRegister RegisterEvent<T, T1, T2>(this ICanRegisterEvent self, T key, Action<T1, T2> onEvent)
where T : IConvertible
{
return self.GetArchitecture().RegisterEvent(key, onEvent);
}
public static IUnRegister RegisterEvent<T, T1, T2, T3>(this ICanRegisterEvent self, T key,
Action<T1, T2, T3> onEvent) where T : IConvertible
{
return self.GetArchitecture().RegisterEvent(key, onEvent);
}
public static IUnRegister RegisterEvent<T>(this ICanRegisterEvent self, T key, Action<object[]> onEvent)
where T : IConvertible
{
return self.GetArchitecture().RegisterEvent(key, onEvent);
}
public static void UnRegisterEvent<T>(this ICanRegisterEvent self, T key, Action onEvent) where T : IConvertible
{
self.GetArchitecture().UnRegisterEvent(key, onEvent);
}
public static void UnRegisterEvent<T, T1>(this ICanRegisterEvent self, T key, Action<T1> onEvent)
where T : IConvertible
{
self.GetArchitecture().UnRegisterEvent(key, onEvent);
}
2025-03-31 11:16:52 +08:00
2025-10-31 11:18:23 +08:00
public static void UnRegisterEvent<T, T1, T2>(this ICanRegisterEvent self, T key, Action<T1, T2> onEvent)
where T : IConvertible
2025-03-31 11:16:52 +08:00
{
2025-10-31 11:18:23 +08:00
self.GetArchitecture().UnRegisterEvent(key, onEvent);
2025-03-31 11:16:52 +08:00
}
2025-10-31 11:18:23 +08:00
public static void UnRegisterEvent<T, T1, T2, T3>(this ICanRegisterEvent self, T key,
Action<T1, T2, T3> onEvent) where T : IConvertible
2025-03-31 11:16:52 +08:00
{
2025-10-31 11:18:23 +08:00
self.GetArchitecture().UnRegisterEvent(key, onEvent);
2025-03-31 11:16:52 +08:00
}
2025-10-31 11:18:23 +08:00
public static void UnRegisterEvent<T>(this ICanRegisterEvent self, T key, Action<object[]> onEvent)
where T : IConvertible
2025-03-31 11:16:52 +08:00
{
2025-10-31 11:18:23 +08:00
self.GetArchitecture().UnRegisterEvent(key, onEvent);
2025-03-31 11:16:52 +08:00
}
2025-10-31 11:18:23 +08:00
public static IUnRegister RegisterEvent(this ICanRegisterEvent self, string key, Action onEvent)
2025-03-31 11:16:52 +08:00
{
2025-10-31 11:18:23 +08:00
return self.GetArchitecture().RegisterEvent(key, onEvent);
2025-03-31 11:16:52 +08:00
}
2025-10-31 11:18:23 +08:00
public static IUnRegister RegisterEvent<T1>(this ICanRegisterEvent self, string key, Action<T1> onEvent)
2025-03-31 11:16:52 +08:00
{
2025-10-31 11:18:23 +08:00
return self.GetArchitecture().RegisterEvent(key, onEvent);
2025-03-31 11:16:52 +08:00
}
2025-10-31 11:18:23 +08:00
public static IUnRegister RegisterEvent<T1, T2>(this ICanRegisterEvent self, string key, Action<T1, T2> onEvent)
2025-03-31 11:16:52 +08:00
{
2025-10-31 11:18:23 +08:00
return self.GetArchitecture().RegisterEvent(key, onEvent);
2025-03-31 11:16:52 +08:00
}
2025-10-31 11:18:23 +08:00
public static IUnRegister RegisterEvent<T1, T2, T3>(this ICanRegisterEvent self, string key,
Action<T1, T2, T3> onEvent)
2025-03-31 11:16:52 +08:00
{
2025-10-31 11:18:23 +08:00
return self.GetArchitecture().RegisterEvent(key, onEvent);
2025-03-31 11:16:52 +08:00
}
2025-10-31 11:18:23 +08:00
public static IUnRegister RegisterEvent(this ICanRegisterEvent self, string key, Action<object[]> onEvent)
2025-03-31 11:16:52 +08:00
{
2025-10-31 11:18:23 +08:00
return self.GetArchitecture().RegisterEvent(key, onEvent);
2025-03-31 11:16:52 +08:00
}
2025-10-31 11:18:23 +08:00
public static void UnRegisterEvent(this ICanRegisterEvent self, string key, Action onEvent)
2025-03-31 11:16:52 +08:00
{
2025-10-31 11:18:23 +08:00
self.GetArchitecture().UnRegisterEvent(key, onEvent);
2025-03-31 11:16:52 +08:00
}
2025-10-31 11:18:23 +08:00
public static void UnRegisterEvent<T1>(this ICanRegisterEvent self, string key, Action<T1> onEvent)
{
self.GetArchitecture().UnRegisterEvent(key, onEvent);
}
public static void UnRegisterEvent<T1, T2>(this ICanRegisterEvent self, string key, Action<T1, T2> onEvent)
{
self.GetArchitecture().UnRegisterEvent(key, onEvent);
}
public static void UnRegisterEvent<T1, T2, T3>(this ICanRegisterEvent self, string key,
Action<T1, T2, T3> onEvent)
{
self.GetArchitecture().UnRegisterEvent(key, onEvent);
}
public static void UnRegisterEvent(this ICanRegisterEvent self, string key, Action<object[]> onEvent)
2025-03-31 11:16:52 +08:00
{
2025-10-31 11:18:23 +08:00
self.GetArchitecture().UnRegisterEvent(key, onEvent);
2025-03-31 11:16:52 +08:00
}
}
}