- Changed event aliases to be case insensitive.
This commit is contained in:
committed by
Evil Factory
parent
fd324ac67e
commit
c3a9551683
@@ -24,14 +24,14 @@ public partial class EventService : IEventService
|
|||||||
public TypeStringKey(Type type)
|
public TypeStringKey(Type type)
|
||||||
{
|
{
|
||||||
Type = type ?? throw new ArgumentNullException(nameof(type));
|
Type = type ?? throw new ArgumentNullException(nameof(type));
|
||||||
TypeName = type.Name;
|
TypeName = type.Name.ToLowerInvariant();
|
||||||
HashCode = TypeName.GetHashCode();
|
HashCode = TypeName.GetHashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeStringKey(string typeName)
|
public TypeStringKey(string typeName)
|
||||||
{
|
{
|
||||||
Type = null;
|
Type = null;
|
||||||
TypeName = typeName ?? throw new ArgumentNullException(nameof(typeName));
|
TypeName = typeName?.ToLowerInvariant() ?? throw new ArgumentNullException(nameof(typeName));
|
||||||
HashCode = TypeName.GetHashCode();
|
HashCode = TypeName.GetHashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ public partial class EventService : IEventService
|
|||||||
private readonly AsyncReaderWriterLock _operationsLock = new();
|
private readonly AsyncReaderWriterLock _operationsLock = new();
|
||||||
private readonly ConcurrentDictionary<TypeStringKey, ConcurrentDictionary<OneOf<IEvent, string>, IEvent>> _subscribers = new();
|
private readonly ConcurrentDictionary<TypeStringKey, ConcurrentDictionary<OneOf<IEvent, string>, IEvent>> _subscribers = new();
|
||||||
private readonly ConcurrentDictionary<TypeStringKey, (TypeStringKey Event, Func<LuaCsFunc, IEvent> RunnerFactory)> _luaAliasEventFactory = new();
|
private readonly ConcurrentDictionary<TypeStringKey, (TypeStringKey Event, Func<LuaCsFunc, IEvent> RunnerFactory)> _luaAliasEventFactory = new();
|
||||||
private readonly ConcurrentDictionary<string, ConcurrentDictionary<string, LuaCsFunc>> _luaLegacyEventsSubscribers = new();
|
private readonly ConcurrentDictionary<TypeStringKey, ConcurrentDictionary<TypeStringKey, LuaCsFunc>> _luaLegacyEventsSubscribers = new();
|
||||||
private readonly ConcurrentDictionary<IEventService, IEventService> _subscribedEventDispatchers = new();
|
private readonly ConcurrentDictionary<IEventService, IEventService> _subscribedEventDispatchers = new();
|
||||||
|
|
||||||
#region LifeCycle
|
#region LifeCycle
|
||||||
@@ -118,7 +118,7 @@ public partial class EventService : IEventService
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var eventSubs = _luaLegacyEventsSubscribers.GetOrAdd(eventName, key => new ConcurrentDictionary<string, LuaCsFunc>());
|
var eventSubs = _luaLegacyEventsSubscribers.GetOrAdd(eventName, key => new ConcurrentDictionary<TypeStringKey, LuaCsFunc>());
|
||||||
eventSubs[identifier] = callback;
|
eventSubs[identifier] = callback;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user