示例#1
0
  private void appendEntities(Room room, NodeList creatures, DeferredStorage.StorageType type)
      throws FactoryException {
    for (int c = 0; c < creatures.getLength(); ++c) {
      Node creatureLink = creatures.item(c);

      String strX = FactoryUtils.getValue(creatureLink, Attributes.ATTR_X);
      String strY = FactoryUtils.getValue(creatureLink, Attributes.ATTR_Y);
      String id = FactoryUtils.getValue(creatureLink, Attributes.ATTR_ID);
      int x = Integer.parseInt(strX);
      int y = Integer.parseInt(strY);

      storage.add(room, id, type, x, y);
    }
  }
示例#2
0
  @Override
  public Room create(Node node) throws FactoryException {

    Room room = null;

    String id = FactoryUtils.getValue(node, Attributes.ATTR_ID);
    String name = FactoryUtils.getValue(node, Attributes.ATTR_NAME);
    String message = FactoryUtils.getValue(node, Attributes.ATTR_MESSAGE);
    FactoryUtils.validateId(id, adventure);

    appendChildren(room, node);

    return room;
  }