mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-11-19 13:17:10 +00:00
Inverted tracking direction to subtypes for correct EventWrappers contravariance
This commit is contained in:
1 parent
e6994f4e99
commit
bbd8e1deef
1 file changed
+5
-5
@@ -37,7 +37,7 @@ public static class MiraEventManager
|
||||
return false;
|
||||
}
|
||||
|
||||
var callableHandlers = handlers.Where(x => type.IsSubclassOfWithGeneric(x.DefinedType)).ToList();
|
||||
var callableHandlers = handlers.Where(x => x.DefinedType.IsSubclassOf(type)).ToList();
|
||||
if (callableHandlers.Count == 0)
|
||||
{
|
||||
return false;
|
||||
@@ -113,11 +113,11 @@ public static class MiraEventManager
|
||||
|
||||
AddTypeToTracked(eventType);
|
||||
|
||||
TrackedEventTypes[eventType].UnionWith(InternalEventTypes.Where(x => eventType.IsSubclassOfWithGeneric(x)));
|
||||
|
||||
foreach (var subType in InternalEventTypes.Where(x => x.IsSubclassOfWithGeneric(eventType)))
|
||||
// subtypes are added to their supertypes, regardless of which were added first
|
||||
TrackedEventTypes[eventType].UnionWith(InternalEventTypes.Where(x => x.IsSubclassOfWithGeneric(eventType)));
|
||||
foreach (var supertype in InternalEventTypes.Where(x => eventType.IsSubclassOfWithGeneric(x)))
|
||||
{
|
||||
AddTypeToTracked(subType, eventType);
|
||||
AddTypeToTracked(supertype, eventType);
|
||||
}
|
||||
|
||||
info.InternalEventTypes.Add(eventType);
|
||||
|
||||
Reference in new issue
Block a user