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);
}
}
Aggregations