Skip to content

Commit 443e6ba

Browse files
committed
[修改] 函数冲突的问题
1 parent dfb3533 commit 443e6ba

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

GameFrameX.Core/Components/ComponentRegister.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static Task Init(Assembly assembly = null)
8484
if (type.GetCustomAttribute(typeof(ComponentTypeAttribute)) is ComponentTypeAttribute compAttr)
8585
{
8686
var actorType = compAttr.Type;
87-
var compTypes = ActorComponentDic.GetOrAdd(actorType);
87+
var compTypes = ActorComponentDic.GetOrAddValue(actorType);
8888
compTypes.Add(type);
8989

9090
ComponentActorDic[type] = actorType;
@@ -93,7 +93,7 @@ public static Task Init(Assembly assembly = null)
9393
{
9494
if (type.GetCustomAttribute(typeof(FuncAttribute)) is FuncAttribute funcAttr)
9595
{
96-
var set = FuncComponentDic.GetOrAdd(funcAttr.Func);
96+
var set = FuncComponentDic.GetOrAddValue(funcAttr.Func);
9797
set.Add(type);
9898
ComponentFuncDic[type] = funcAttr.Func;
9999
}

GameFrameX.Core/Hotfix/HotfixModule.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ private bool AddEvent(Type type)
358358
var compAgentType = type.BaseType.GetGenericArguments()[0];
359359
var compType = compAgentType.BaseType.GetGenericArguments()[0];
360360
var actorType = ComponentRegister.ComponentActorDic[compType];
361-
var evtListenersDic = _actorEvtListeners.GetOrAdd(actorType);
361+
var evtListenersDic = _actorEvtListeners.GetOrAddValue(actorType);
362362

363363
var eventInfoAttributes = type.GetCustomAttributes<EventInfoAttribute>();
364364
var infoAttributes = eventInfoAttributes.ToList();
@@ -374,7 +374,7 @@ private bool AddEvent(Type type)
374374
}
375375

376376
var evtId = eventInfoAttribute.EventId;
377-
var listeners = evtListenersDic.GetOrAdd(evtId);
377+
var listeners = evtListenersDic.GetOrAddValue(evtId);
378378
listeners.Add((IEventListener)Activator.CreateInstance(type));
379379

380380
return true;

0 commit comments

Comments
 (0)