decline-cookies/anvil-csharp-core

TinyJSON Refactor and Improvements

Opened this issue · 0 comments

jkeon commented

Based off of future work: #34

  • Further refactoring to make the classes cleaner and functions less long.
  • Update style so it's consistent with the rest of the framework.
  • Encoding/Decoding are two separate systems. If you want to add support for Color for example you need to support Decoding in the UnityProxyString AND UnityTinyJSONParser.DTCheckConvert where as to support Encoding you add it in the UnityEncoder. Ideally Encoding/Decoding should be mirrors of each other and not have logic in different locations.
  • There is an issue where if the CSharp and Unity assembly are not in their own assemblies and just all thrown into the main Unity assembly, that the Unity setting of the UnityTinyJSONParser won't happen until after another static constructor has run in the Editor that uses JSON to decode something. If that something uses something that is Unity specific you'll get an error in the console. The override system could be reworked such that JSON searches through all Assemblies and finds the most derived class of TinyJSONParser and instantiates that instead. However for now, since They will be likely be in different assemblies and the app assembly depends on both of them, it's reasonable to conclude that things will be ready in time.