colyseus-unity-sdk icon indicating copy to clipboard operation
colyseus-unity-sdk copied to clipboard

Improve use of generics and privacy levels in `ArraySchema` and `MapSchema`

Open rnd256 opened this issue 5 years ago • 4 comments

  • ArraySchema's method signatures for GetItems(), GetByIndex(index), ContainsKey(key), GetTypeDefaultValue(), SetItems(), and InvokeOn{Add,Change,Remove}() should use type T.
  • The Items member should probably be private.
  • It seems like there are some methods that manage internal details which shouldn't be public (eg. GetIndex(index) without the By in the name, and anything that has dynamicIndex in its signature).
  • Similar improvements can be made to MapSchema.

rnd256 avatar Feb 15 '21 22:02 rnd256

Thanks for the feedback @rnd256, I agree completely, all these methods should be for internal usage only and not exposed. I hope we can tackle this sooner or later.

endel avatar Feb 16 '21 02:02 endel

I think the methods in the first bullet point I mention should remain public, but agreed on making the other ones private.

rnd256 avatar Feb 16 '21 02:02 rnd256