colyseus-unity-sdk
colyseus-unity-sdk copied to clipboard
Invert KeyValueEventHandler parameters in MapSchema
public event KeyValueEventHandler<T, string> OnAdd;
public event KeyValueEventHandler<T, string> OnChange;
public event KeyValueEventHandler<T, string> OnRemove;
MapSchema uses string
then T
everwhere except for these events. Because of this inversion, it means we can't just directly call handlers for these events with other MapSchema methods, like ForEach, so you end up having to write
mapSchemaInstance.Foreach((key, t) => OnAdd(t, key))
instead of a nicer mapSchemaInstance.Foreach(OnAdd)
I know it's a breaking chance, but it would just be more coherent and help with readability (I haven't checked other collections, may need to update them as well)