Search in sources :

Example 1 with Property

use of de.gurkenlabs.litiengine.environment.tilemap.xml.Property in project litiengine by gurkenlabs.

the class UndoManager method restoreState.

private static void restoreState(IMapObject target, IMapObject restore) {
    target.setId(restore.getId());
    target.setName(restore.getName());
    target.setType(restore.getType());
    target.setX(restore.getX());
    target.setY(restore.getY());
    target.setWidth(restore.getWidth());
    target.setHeight(restore.getHeight());
    target.getAllCustomProperties().clear();
    for (Property prop : restore.getAllCustomProperties()) {
        target.setCustomProperty(prop.getName(), prop.getValue());
    }
    Game.getEnvironment().reloadFromMap(target.getId());
    if (MapObjectType.get(target.getType()) == MapObjectType.LIGHTSOURCE) {
        Game.getEnvironment().getAmbientLight().updateSection(MapObject.getBounds2D((MapObject) target, (MapObject) restore));
    }
    if (EditorScreen.instance().getMapComponent().getFocusedMapObject() != null && EditorScreen.instance().getMapComponent().getFocusedMapObject().getId() == target.getId()) {
        EditorScreen.instance().getMapObjectPanel().bind(target);
        EditorScreen.instance().getMapSelectionPanel().focus(target);
    }
}
Also used : Property(de.gurkenlabs.litiengine.environment.tilemap.xml.Property) MapObject(de.gurkenlabs.litiengine.environment.tilemap.xml.MapObject) IMapObject(de.gurkenlabs.litiengine.environment.tilemap.IMapObject)

Aggregations

IMapObject (de.gurkenlabs.litiengine.environment.tilemap.IMapObject)1 MapObject (de.gurkenlabs.litiengine.environment.tilemap.xml.MapObject)1 Property (de.gurkenlabs.litiengine.environment.tilemap.xml.Property)1