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

Implement possibility to export an IEntity as an IMapObject (from code) #66

Closed
gurkenlabs opened this Issue Jan 21, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@ghost
Copy link
Collaborator

ghost commented Jan 21, 2018

Currently, the editor does something similar when creating new map objects but not based on an existing entity.

There should be something like a MapObjectCreator that would either take an entity or the respective properties (x, y, ..., + custom properties list) and create a new MapObjectProperty instance.

The approach could look similar to the MapObjectLoader implementation but exactly the other way around.

This could be done by reflection maybe (especially for Emitter and Particle).

@gurkenlabs gurkenlabs added the feature label Jan 21, 2018

@gurkenlabs gurkenlabs changed the title Implement possibility to export an IEntity as a IMapObject Implement possibility to export an IEntity as an IMapObject Jan 21, 2018

@gurkenlabs gurkenlabs changed the title Implement possibility to export an IEntity as an IMapObject Implement possibility to export an IEntity as an IMapObject (from code) Jan 27, 2018

@gurkenlabs gurkenlabs added this to the v0.5.0-beta milestone Jan 30, 2018

steffen-wilke added a commit that referenced this issue Aug 5, 2018

Implement MapObjectSerializer
This implementation uses the TmxProperty annotation and reflection to determine which fields of the IEntity implementation need to be serialized to a custom property of the MapObject.
Replaced the CustomMapObjectProperty annotation by the TmxProperty annotation. This new annotation is defined on the actual field which is more practical.
Also this annotation directly links the field to a key value for custom properties. Previously this was a very loose connection and one had to know the related field.

Annotated all currently implemented custom properties for the engine's default entity types with the TmxProperty annotation.
This will also allow to further automate the MapObjectLoaders in the long run.

Implement a unit test that ensures that the MapObjectSerializer works properly.
Rename some MapObjectProperty constants to better reflect their use case.

Closes #66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment