|
|
@@ -24,7 +24,7 @@ namespace ET
|
|
|
|
|
|
private readonly Dictionary<Type, List<EventInfo>> allEvents = new();
|
|
|
|
|
|
- private Dictionary<Type, Dictionary<int, object>> allInvokes = new();
|
|
|
+ private Dictionary<Type, Dictionary<long, object>> allInvokes = new();
|
|
|
|
|
|
public void Awake(Dictionary<string, Type> addTypes)
|
|
|
{
|
|
|
@@ -75,7 +75,7 @@ namespace ET
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- this.allInvokes = new Dictionary<Type, Dictionary<int, object>>();
|
|
|
+ this.allInvokes = new Dictionary<Type, Dictionary<long, object>>();
|
|
|
foreach (Type type in types[typeof (InvokeAttribute)])
|
|
|
{
|
|
|
object obj = Activator.CreateInstance(type);
|
|
|
@@ -90,7 +90,7 @@ namespace ET
|
|
|
{
|
|
|
if (!this.allInvokes.TryGetValue(iInvoke.Type, out var dict))
|
|
|
{
|
|
|
- dict = new Dictionary<int, object>();
|
|
|
+ dict = new Dictionary<long, object>();
|
|
|
this.allInvokes.Add(iInvoke.Type, dict);
|
|
|
}
|
|
|
|
|
|
@@ -196,7 +196,7 @@ namespace ET
|
|
|
// 既然Invoke跟函数一样,那么为什么不使用函数呢? 因为有时候不方便直接调用,比如Config加载,在客户端跟服务端加载方式不一样。比如TimerComponent需要根据Id分发
|
|
|
// 注意,不要把Invoke当函数使用,这样会造成代码可读性降低,能用函数不要用Invoke
|
|
|
// publish是事件,抛出去可以没人订阅,调用者跟被调用者属于两个模块,比如任务系统需要知道道具使用的信息,则订阅道具使用事件
|
|
|
- public void Invoke<A>(int type, A args) where A: struct
|
|
|
+ public void Invoke<A>(long type, A args) where A: struct
|
|
|
{
|
|
|
if (!this.allInvokes.TryGetValue(typeof(A), out var invokeHandlers))
|
|
|
{
|
|
|
@@ -216,7 +216,7 @@ namespace ET
|
|
|
aInvokeHandler.Handle(args);
|
|
|
}
|
|
|
|
|
|
- public T Invoke<A, T>(int type, A args) where A: struct
|
|
|
+ public T Invoke<A, T>(long type, A args) where A: struct
|
|
|
{
|
|
|
if (!this.allInvokes.TryGetValue(typeof(A), out var invokeHandlers))
|
|
|
{
|