本文整理汇总了Java中com.badlogic.gdx.utils.XmlReader.Element.getChildCount方法的典型用法代码示例。如果您正苦于以下问题:Java Element.getChildCount方法的具体用法?Java Element.getChildCount怎么用?Java Element.getChildCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.XmlReader.Element
的用法示例。
在下文中一共展示了Element.getChildCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readEffect
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
/**
* Read the Effects information from the suppled XML element and loads them
* into the supplied EffectContainer.
*
* The XML element should contain children in the following format:
*
* <pre>
* <effectId effectParameter1 = "value1" effectParameter2 = "value2" ... />
* </pre>
*
* @param ec
* @param effectsElement
*/
public static void readEffect(EffectContainer ec, Element effectsElement) {
if (effectsElement == null) {
return;
}
for (int i = 0; i < effectsElement.getChildCount(); ++i) {
Element effectElement = effectsElement.getChild(i);
String effectId = effectElement.getName();
Effect effect = Effect.getEffect(effectId);
if (effect == null) {
throw new GdxRuntimeException("Effect " + effectId + " does not exist, but is required for "
+ ec.getId());
}
ec.addEffect(effect, readEffectParameters(ec, effectElement, effect));
}
}
示例2: loadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void loadFromXML(Element root) throws IOException {
super.loadFromXML(root);
story = new Array<QuestState>();
storyTimes = new Array<GameCalendarDate>();
if (isFinished()) {
finishedQuests.add(this);
} else if (isStarted()) {
activeQuests.add(this);
}
variables = new Variables();
variables.loadFromXML(root);
Element storyElement = root.getChildByName(XML_STORY);
if (storyElement != null) {
for (int i = 0; i < storyElement.getChildCount(); ++i) {
Element storyStateElement = storyElement.getChild(i);
story.add(getStateForId(storyStateElement.getAttribute(XMLUtil.XML_ATTRIBUTE_ID)));
GameCalendarDate date = new GameCalendarDate(GameState.getCurrentGameDate().getCalendar());
date.readFromXML(storyStateElement.getChildByName(XML_TIME));
storyTimes.add(date);
}
}
}
示例3: 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));
}
示例4: readTracks
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
protected static void readTracks(AudioContainer ac, Element tracksRoot, Class<? extends AudioTrack<?>> trackType) {
if (tracksRoot != null) {
try {
for (int i = 0; i < tracksRoot.getChildCount(); ++i) {
Element typeElement = tracksRoot.getChild(i);
readTracks(typeElement, trackType, ac, typeElement.getName().toLowerCase(Locale.ENGLISH));
}
} catch (Exception e) {
throw new GdxRuntimeException(e);
}
}
}
示例5: addSoundDependency
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
private void addSoundDependency(Element soundsElement, String soundElementName, Array<AssetDescriptor> dependencies) {
Element soundElement = soundsElement.getChildByName(soundElementName);
if (soundElement != null && soundElement.getChildCount() > 0) {
for (int i = 0; i < soundElement.getChildCount(); ++i) {
dependencies.add(new AssetDescriptor<Sound>(Configuration.addModulePath(soundElement.getChild(i).get(XMLUtil.XML_FILENAME)), Sound.class));
}
}
}
示例6: loadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void loadFromXML(Element root) throws IOException {
XMLUtil.readPrimitiveMembers(this, root);
savedAt = new Date(Long.parseLong(root.get(XML_SAVED_AT)));
groupMembers = new Array<String>();
Element characters = root.getChildByName(XML_CHARACTERS);
for (int i = 0; i < characters.getChildCount(); ++i) {
groupMembers.add(characters.getChild(i).getText());
}
}
示例7: loadFromXMLNoInit
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void loadFromXMLNoInit(FileHandle file) throws IOException {
XmlReader xmlReader = new XmlReader();
Element root = xmlReader.parse(file);
XMLUtil.handleImports(this, file, root);
XMLUtil.readPrimitiveMembers(this, root);
Element indicatorElement = root.getChildByName(XML_INDICATOR);
if (indicatorElement != null) {
indicator = new ParticleEffectDescriptor(indicatorElement);
indicatorNoDelay = new ParticleEffectDescriptor(indicator.getEffectId(), 0, indicator.getXOffset(), indicator.getYOffset());
}
onHitScript = XMLUtil.readScript(id, root.getChildByName(XML_ON_HIT), onHitScript);
durationScript = XMLUtil.readScript(id, root.getChildByName(XML_DURATION), durationScript);
onEndScript = XMLUtil.readScript(id, root.getChildByName(XML_ON_END), onEndScript);
persistentScript = XMLUtil.readScript(id, root.getChildByName(XML_PERSISTENT), persistentScript);
conditionScript = XMLUtil.readScript(id, root.getChildByName(XML_CONDITION), conditionScript);
Element descriptionElement = root.getChildByName(XML_DESCRIPTION);
if (descriptionElement != null) {
descriptionParamsScript = XMLUtil.readScript(id, descriptionElement.getChildByName(XML_EXTRA_PARAMETERS), descriptionParamsScript);
}
Element parametersElement = root.getChildByName(XMLUtil.XML_PARAMETERS);
if (parametersElement != null) {
for (int i = 0; i < parametersElement.getChildCount(); ++i) {
Element parameterElement = parametersElement.getChild(i);
parameters.add(EffectParameterDefinition.readFromXML(parameterElement));
}
}
Element typesElement = root.getChildByName(XML_TYPE);
if (typesElement != null && !typesElement.getText().isEmpty()) {
String[] types = typesElement.getText().split(",");
for (String type : types) {
this.types.add(type.trim().toUpperCase(Locale.ENGLISH));
}
}
}
示例8: validateAndLoadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void validateAndLoadFromXML(Element conditionElement) {
if (conditionElement.getChildCount() != 1) {
throw new GdxRuntimeException("Not condition can only contain one subcondition! Error found in element: \n\n "+conditionElement);
}
negatedCondition = Condition.getCondition(conditionElement.getChild(0));
}
示例9: readMonthInfos
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
private void readMonthInfos(Element sunInfosElement) {
for (int i = 0; i < sunInfosElement.getChildCount(); ++i) {
Element monthElement = sunInfosElement.getChild(i);
int month = monthElement.getIntAttribute(XMLUtil.XML_ATTRIBUTE_ID)-1;
months.put(month, new Month(monthElement));
}
}
示例10: readYearNames
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
private void readYearNames(Element element) {
if (element != null) {
for (int i = 0; i < element.getChildCount(); ++i ){
Element yearElement = element.getChild(i);
yearNames.put(yearElement.getInt(XMLUtil.XML_ATTRIBUTE_ID), yearElement.getText().trim());
}
}
}
示例11: loadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void loadFromXML(Element root) {
s_canBeCast = true;
super.loadFromXML(root);
foci = new ObjectMap<String, Boolean>();
Element fociElement = root.getChildByName(XML_FOCI);
if (fociElement != null) {
for (int i = 0; i < fociElement.getChildCount(); ++i) {
Element focusElement = fociElement.getChild(i);
String itemID = focusElement.getAttribute(XMLUtil.XML_ATTRIBUTE_ID);
boolean consumed = focusElement.getBooleanAttribute(XML_ATTRIBUTE_CONSUMED, false);
foci.put(itemID, consumed);
}
}
}
示例12: readBrainFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
protected void readBrainFromXML(Element brainElement) throws IOException {
XMLUtil.readPrimitiveMembers(this, brainElement);
Element currentAIActionElement = brainElement.getChildByName(XML_CURRENT_AI_ACTION);
if (currentAIActionElement != null && currentAIActionElement.getChildCount() > 0) {
currentAIAction = Action.readFromXML(currentAIActionElement.getChild(0), go);
go.addAction(currentAIAction, false);
}
Element aiBackup = brainElement.getChildByName(XML_AI_BACKUP);
if (aiBackup != null) {
aiScriptBackUp = new AIScriptPackage(aiBackup);
} else {
aiScriptBackUp = aiScript;
}
}
示例13: loadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void loadFromXML(Element root) {
xmlData = root;
XMLUtil.readPrimitiveMembers(this,
root.getChildByName(XMLUtil.XML_PROPERTIES));
disposition.clear();
Element dispositionElement = root.getChildByName(XML_DISPOSITION);
for (int i = 0; i < dispositionElement.getChildCount(); ++i) {
Element factionElement = dispositionElement.getChild(i);
disposition.put(factionElement.getName().toLowerCase(Locale.ENGLISH), Integer.parseInt(factionElement.getText()));
}
}
示例14: validateAndLoadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void validateAndLoadFromXML(Element conditionElement) {
for (int i = 0; i < conditionElement.getChildCount(); ++i) {
Element childConditionElement = conditionElement.getChild(i);
conditions.add(Condition.getCondition(childConditionElement));
}
}
示例15: loadFromXML
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
public void loadFromXML(Element root) throws IOException {
XMLUtil.readPrimitiveMembers(this, root.getChildByName(XMLUtil.XML_PROPERTIES));
variables.loadFromXML(root);
position.loadFromXML(root);
XMLUtil.readActions(this, root.getChildByName(XMLUtil.XML_ACTIONS));
Element forbiddenActionsElement = root.getChildByName(XML_FORBIDDEN_ACTIONS);
if (forbiddenActionsElement != null) {
for (int i = 0; i < forbiddenActionsElement.getChildCount(); ++i) {
Element forbiddenByElement = forbiddenActionsElement.getChild(i);
String forbiddenBy = forbiddenByElement.getAttribute(XMLUtil.XML_ATTRIBUTE_ID);
Array<String> forbidden = new Array<String>();
for (int j = 0; j < forbiddenByElement.getChildCount(); ++j) {
forbidden.add(StringUtil.capitalizeFirstLetter(forbiddenByElement.getChild(j).getName()));
}
forbiddenActions.put(forbiddenBy, forbidden);
}
}
if (isGlobal()) {
gameState.addGameObject(this);
}
if (map == null) {
gameState.addUnassignedGameObject(this);
}
}