本文整理汇总了Java中com.badlogic.gdx.utils.XmlReader.Element.get方法的典型用法代码示例。如果您正苦于以下问题:Java Element.get方法的具体用法?Java Element.get怎么用?Java Element.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.XmlReader.Element
的用法示例。
在下文中一共展示了Element.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TiledObjectTypes
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
public TiledObjectTypes(String file) {
xml_reader = new XmlReader();
try {
root = xml_reader.parse(Gdx.files.internal(file));
} catch (IOException e) {
e.printStackTrace();
}
types = new ObjectMap<String, TiledObjectTypes.TiledObjectType>();
if(root == null)
throw new GdxRuntimeException(String.format("Unable to parse file %s. make sure it is the correct path.", file));
Array<Element> types = root.getChildrenByName("objecttype");
for (Element element : types) {
TiledObjectType tot = new TiledObjectType(element.get("name"));
Array<Element> properties = element.getChildrenByName("property");
for (int i = 0; i < properties.size; i++) {
Element element2 = properties.get(i);
TypeProperty property = new TypeProperty(element2.get("name"), element2.get("type"), element2.hasAttribute("default")?element2.get("default"):"");
tot.addProperty(property);
}
this.types.put(tot.name, tot);
}
}
示例2: loadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void loadFromXML(Element root) throws IOException {
super.loadFromXML(root);
if (s_maxUses == 0) {
s_maxUses = 1;
}
usesLeft = s_maxUses;
String projectileValue =root.get(XMLUtil.XML_PROJECTILE,null);
if (projectileValue != null) {
s_projectile = projectileValue;
}
Element conditionElement = root.getChildByName(XMLUtil.XML_CONDITION);
if (conditionElement != null && conditionElement.getChildCount() > 0) {
useCondition = Condition.getCondition(conditionElement.getChild(0));
}
XMLUtil.readEffect(this, root.getChildByName(XMLUtil.XML_EFFECTS));
XMLUtil.readTargetType(this, root.getChildByName(XMLUtil.XML_TARGET));
}
示例3: SurvivalHazardConfig
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
private SurvivalHazardConfig(Element element) {
for (int i = 0; i < element.getChildCount(); ++i) {
Element stageElement = element.getChild(i);
String name = stageElement.get(XMLUtil.XML_ATTRIBUTE_NAME, "");
String timesString = stageElement.get(XML_TIMES, null);
Integer times = timesString != null ? Integer.valueOf(timesString) : null;
SurvivalHazardStage stage = new SurvivalHazardStage(name);
XMLUtil.readModifiers(stage, stageElement);
if (times == null) {
defaultStage = stage;
} else {
this.stages.put(times, stage);
}
}
}
示例4: loadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
public void loadFromXML(Element root) {
if (root.getName().toLowerCase(Locale.ENGLISH).startsWith("activated")) {
s_isActivated = true;
}
XMLUtil.readPrimitiveMembers(this, root);
if (s_iconFile != null) {
s_iconFile = Configuration.addModulePath(s_iconFile);
}
XMLUtil.readModifiers(this, root.getChildByName(XMLUtil.XML_MODIFIERS));
XMLUtil.readEffect(this, root.getChildByName(XMLUtil.XML_EFFECTS));
XMLUtil.readTargetType(this, root.getChildByName(XMLUtil.XML_TARGET));
String projectileValue = root.get(XMLUtil.XML_PROJECTILE,null);
if (projectileValue != null) {
projectile = projectileValue;
}
if (root.getChildByName(XML_LEARN_REQUIREMENTS) != null) {
s_learnRequirements = Condition.getCondition(root.getChildByName(XML_LEARN_REQUIREMENTS).getChild(0));
}
if (root.getChildByName(XML_ACTIVATION_REQUIREMENTS) != null) {
s_activationRequirements = Condition.getCondition(root.getChildByName(XML_ACTIVATION_REQUIREMENTS).getChild(0));
}
}
示例5: validateAndLoadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void validateAndLoadFromXML(Element conditionElement) {
if (conditionElement.get(XML_ENEMY_GROUP, null) == null) {
throw new GdxRuntimeException(XML_ENEMY_GROUP
+ " must be set for action SwitchToCombatMap in element: \n\n" + conditionElement);
}
}
示例6: loadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
public void loadFromXML(Element element) {
Element uiElement = element.getChildByName(XML_CAMP_PANEL);
if (uiElement != null) {
String id = uiElement.get(XML_LAST_HUNTER, null);
if (id != null) {
this.lastHunter = (GameCharacter) GameState.getGameObjectByInternalId(id);
}
id = uiElement.get(XML_LAST_WATER_SCOUT, null);
if (id != null) {
this.lastWaterScout = (GameCharacter) GameState.getGameObjectByInternalId(id);
}
}
}
示例7: validateAndLoadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void validateAndLoadFromXML(Element conditionElement) {
String spellId = conditionElement.get(XML_SPELL_ID, null);
if (spellId == null) {
throw new GdxRuntimeException(XML_SPELL_ID+" must be set for condition KnowsSpell in element: \n\n"+conditionElement);
}
if (!Spell.spellExists(spellId)) {
throw new GdxRuntimeException(XML_SPELL_ID+" contains invalid value "+spellId+", which is not an existing spell in condition KnowsSpell in element: \n\n"+conditionElement);
}
}
示例8: validateAndLoadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void validateAndLoadFromXML(Element actionElement) {
if (actionElement.get(XML_FACTION, null) == null) {
throw new GdxRuntimeException(XML_FACTION+" must be set for action ModifyDisposition in element: \n\n"+actionElement);
}
String value = actionElement.get(XML_VALUE, null);
if (value == null) {
throw new GdxRuntimeException(XML_VALUE+" must be set for action ModifyDisposition in element: \n\n"+actionElement);
}
try {
Integer.parseInt(value);
} catch (NumberFormatException e){
throw new GdxRuntimeException(XML_VALUE+" must be an Integer for action ModifyDisposition in element: \n\n"+actionElement);
}
}
示例9: validateAndLoadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void validateAndLoadFromXML(Element conditionElement) {
String skillName = conditionElement.get(XML_SKILL_NAME, null);
if (skillName == null) {
throw new GdxRuntimeException(XML_SKILL_NAME+" must be set for condition HasSkill in element: \n\n"+conditionElement);
}
try {
Skill.valueOf(skillName.toUpperCase(Locale.ENGLISH));
} catch (IllegalArgumentException e){
throw new GdxRuntimeException(XML_SKILL_NAME+" contains invalid value "+skillName+", which is not an existing skill in condition HasSkill in element: \n\n"+conditionElement);
}
}
示例10: validateAndLoadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void validateAndLoadFromXML(Element conditionElement) {
if (conditionElement.get(XML_CHARACTER_ID, null) == null && conditionElement.get(PARAM_TARGET_OBJECT, null) == null) {
throw new GdxRuntimeException(XML_CHARACTER_ID+" or "+PARAM_TARGET_OBJECT+" must be set for condition CharacterInParty in element: \n\n"+conditionElement);
}
}
示例11: validateAndLoadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void validateAndLoadFromXML(Element conditionElement) {
if (conditionElement.get(XMLUtil.XML_ATTRIBUTE_ID, null) == null) {
throw new GdxRuntimeException(XMLUtil.XML_ATTRIBUTE_ID+" must be set for action DisplayStorySequence in element: \n\n"+conditionElement);
}
}
示例12: validateAndLoadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void validateAndLoadFromXML(Element conditionElement) {
if (conditionElement.get(XML_AMOUNT, null) == null) {
throw new GdxRuntimeException(XML_AMOUNT+" must be set for action GiveExperience in element: \n\n"+conditionElement);
}
}
示例13: validateAndLoadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void validateAndLoadFromXML(Element conditionElement) {
if (conditionElement.get(XML_RACE) == null) {
throw new GdxRuntimeException(XML_RACE+" must be set for condition RaceEqualTo in element: \n\n"+conditionElement);
}
}
示例14: validateAndLoadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void validateAndLoadFromXML(Element conditionElement) {
if (conditionElement.get(XML_AMOUNT, null) == null) {
throw new GdxRuntimeException(XML_AMOUNT+" must be set for action AddToMP in element: \n\n"+conditionElement);
}
}
示例15: loadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
public void loadFromXML(Element root) throws IOException {
Element properties = root.getChildByName(XMLUtil.XML_PROPERTIES);
XMLUtil.readPrimitiveMembers(this, properties);
XMLUtil.readPrimitiveMembers(owner, properties);
if (s_inventoryIconFile != null) {
s_inventoryIconFile = Configuration.addModulePath(s_inventoryIconFile);
}
if (s_mapIconFile != null) {
s_mapIconFile = Configuration.addModulePath(s_mapIconFile);
}
XMLUtil.readModifiers(this, root.getChildByName(XMLUtil.XML_MODIFIERS));
Element triggersElement = root.getChildByName(XMLUtil.XML_TRIGGERS);
if (triggersElement != null) {
Element trigger = triggersElement.getChildByName(XML_ON_EQUIP);
if (trigger != null) {
if (trigger.getChildByName(XMLUtil.XML_CONDITION) != null) {
s_onEquipCondition = Condition.getCondition(trigger.getChildByName(XMLUtil.XML_CONDITION).getChild(0));
}
s_onEquipAction = Action.getAction(trigger.getChildByName(XMLUtil.XML_ACTION));
}
trigger = triggersElement.getChildByName(XML_ON_PICKUP);
if (trigger != null) {
if (trigger.getChildByName(XMLUtil.XML_CONDITION) != null) {
s_onPickUpCondition = Condition.getCondition(trigger.getChildByName(XMLUtil.XML_CONDITION).getChild(0));
}
s_onPickUpAction = Action.getAction(trigger.getChildByName(XMLUtil.XML_ACTION));
}
}
Element conditionElement = root.getChildByName(XML_EQUIP_CONDITION);
if (conditionElement != null&& conditionElement.getChildCount() == 1) {
s_equipCondition = Condition.getCondition(conditionElement.getChild(0));
}
if (properties != null) {
String slots = properties.get(XML_SLOTS, null);
if (slots != null) {
String[] slotNames = slots.split(",");
s_allowedSlots = new ItemSlot[slotNames.length];
for (int i = 0; i < slotNames.length; ++i) {
s_allowedSlots[i] = ItemSlot.valueOf(slotNames[i].trim().toUpperCase(Locale.ENGLISH));
}
}
}
}