示例#1
0
文件: RTerrain.java 项目: kba/neon
 public RTerrain(Element e, String... path) {
   super(e.getAttributeValue("id"), path);
   color = e.getAttributeValue("color");
   text = e.getAttributeValue("char");
   description = e.getText();
   String mov = e.getAttributeValue("mod");
   if (mov != null) {
     modifier = Modifier.valueOf(mov.toUpperCase());
   }
   String mod = e.getAttributeValue("sub");
   if (mod != null) {
     type = Subtype.valueOf(mod.toUpperCase());
   }
 }
示例#2
0
文件: RTerrain.java 项目: kba/neon
 public Element toElement() {
   Element terrain = new Element("type");
   terrain.setAttribute("id", id);
   terrain.setAttribute("char", text);
   terrain.setAttribute("color", color);
   if (modifier != Modifier.NONE) {
     terrain.setAttribute("mod", modifier.toString());
   }
   if (description != null && !description.isEmpty()) {
     terrain.setText(description);
   }
   if (type != Subtype.NONE) {
     terrain.setAttribute("sub", type.toString());
   }
   return terrain;
 }