Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic JSON nodes #1885

Merged
merged 10 commits into from
Mar 25, 2020
Merged

Automatic JSON nodes #1885

merged 10 commits into from
Mar 25, 2020

Conversation

Wibble199
Copy link
Collaborator

This is a quality-of-life feature for profile developers and will not directly affect users.

Adds a new class AutoJsonNode which is a subclass of Node and dynamically creates a constructor based on the fields it has. This constructor is compiled with LINQ and only created once (therefore only incurring the expensive reflection penalty once).

Adds a new method to both Node and GameState called NodeFor<T> which simplifies the creation and caching of sub-nodes inside nodes/gamesstates for the profile dev.

The various GetX methods in the Node (such as GetBool) have been made case-insensitive.

The Minecraft profile has been altered to use these automatic nodes as a demonstration.

Wibble199 and others added 10 commits January 12, 2020 13:02
This is a subclass of the Node<T> and will automatically populate the fields defined on it from the parsed JSON when possible, saving profile developers from needing to add many repetitive statements into the constructor.
Additionally added some methods to Node<T> and GameState<T> that simplify the creating of child-node getters.
Also made the Node's getter methods (e.g bool GetBool(string name)) case insensitive.
Removed multiple identical 'ProviderNode' classes.
@diogotr7 diogotr7 merged commit d143bb1 into antonpup:dev Mar 25, 2020
@Wibble199 Wibble199 deleted the feature/autojsonnode branch April 24, 2020 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
  翻译: