示例#1
0
 /**
  * Generates a random dungeon.
  *
  * @param dungeonMapData The dungeon specification, not null
  * @return The entrance to the dungeon, never null
  * @throws IOException If {@link DungeonBuilder#setDungeonMapData(DungeonMapData)} fails
  * @throws ReflectiveOperationException If the desired DungeonBuilder can not be instantiated
  */
 public static DungeonLevel buildDungeon(final DungeonMapData dungeonMapData)
     throws IOException, ReflectiveOperationException {
   final DungeonBuilder builder = getDungeonBuilder(dungeonMapData);
   builder.fromString(builder.buildRandomDungeonString());
   final List<DungeonLevel> dungeonLevels = builder.getLevels();
   return dungeonLevels.get(0);
 }
示例#2
0
 /**
  * De-serializes a dungeon.
  *
  * @param dungeonMapData The dungeon specification, not null
  * @param serializedDungeon The serialized dungeon String, not null
  * @return The entrance to the dungeon, never null
  * @throws IOException If {@link DungeonBuilder#setDungeonMapData(DungeonMapData)} fails
  * @throws ReflectiveOperationException If the desired DungeonBuilder can not be instantiated
  * @see DungeonBuilder#fromString(String)
  */
 public static DungeonLevel fromString(
     final DungeonMapData dungeonMapData, final String serializedDungeon)
     throws IOException, ReflectiveOperationException {
   final DungeonBuilder builder = getDungeonBuilder(dungeonMapData);
   builder.fromString(serializedDungeon);
   final List<DungeonLevel> dungeonLevels = builder.getLevels();
   return dungeonLevels.get(0);
 }