use of com.b3dgs.lionengine.io.Xml in project lionengine by b3dgs.
the class MapTileCollisionModel method loadCollisionGroups.
/**
* Load the collision groups. All previous groups will be cleared.
*
* @param groupsConfig The configuration collision groups file.
*/
private void loadCollisionGroups(Media groupsConfig) {
Verbose.info(INFO_LOAD_GROUPS, groupsConfig.getFile().getPath());
this.groupsConfig = groupsConfig;
final Xml nodeGroups = new Xml(groupsConfig);
final CollisionGroupConfig config = CollisionGroupConfig.imports(nodeGroups, this);
loadCollisionGroups(config);
}
use of com.b3dgs.lionengine.io.Xml in project lionengine by b3dgs.
the class TransitionsConfig method importTiles.
/**
* Import all tiles from their nodes.
*
* @param nodesTileRef The tiles nodes (must not be <code>null</code>).
* @return The imported tiles ref.
*/
private static Collection<TileRef> importTiles(Collection<Xml> nodesTileRef) {
final Collection<TileRef> tilesRef = new HashSet<>(nodesTileRef.size());
for (final Xml nodeTileRef : nodesTileRef) {
final TileRef tileRef = TileConfig.imports(nodeTileRef);
tilesRef.add(tileRef);
}
return tilesRef;
}
use of com.b3dgs.lionengine.io.Xml in project lionengine by b3dgs.
the class TransitionsConfig method exportTiles.
/**
* Export all tiles for the transition.
*
* @param nodeTransition The transition node (must not be <code>null</code>).
* @param tilesRef The transition tiles ref (must not be <code>null</code>).
*/
private static void exportTiles(Xml nodeTransition, Collection<TileRef> tilesRef) {
for (final TileRef tileRef : tilesRef) {
final Xml nodeTileRef = TileConfig.exports(tileRef);
nodeTransition.add(nodeTileRef);
}
}
use of com.b3dgs.lionengine.io.Xml in project lionengine by b3dgs.
the class ActionsConfig method exports.
/**
* Export the action.
*
* @param node The xml node (must not be <code>null</code>).
* @param action The action to export (must not be <code>null</code>).
* @throws LionEngineException If unable to write node.
*/
private static void exports(Xml node, ActionRef action) {
final Xml nodeAction = node.createChild(NODE_ACTION);
nodeAction.writeString(ATT_PATH, action.getPath());
for (final ActionRef ref : action.getRefs()) {
exports(nodeAction, ref);
}
}
use of com.b3dgs.lionengine.io.Xml in project lionengine by b3dgs.
the class AnimationConfig method imports.
/**
* Create the animation data from configurer.
*
* @param root The root reference (must not be <code>null</code>).
* @return The animations configuration instance.
* @throws LionEngineException If unable to read data.
*/
public static AnimationConfig imports(Xml root) {
Check.notNull(root);
final Map<String, Animation> animations = new HashMap<>(0);
for (final Xml node : root.getChildren(ANIMATION)) {
final String anim = node.readString(ANIMATION_NAME);
final Animation animation = createAnimation(node);
animations.put(anim, animation);
}
return new AnimationConfig(animations);
}
Aggregations