当前位置: 首页>>代码示例>>Java>>正文


Java Element.getChildCount方法代码示例

本文整理汇总了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>
 * &lt;effectId effectParameter1 = "value1" effectParameter2 = "value2" ... /&gt;
 * </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));
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:29,代码来源:XMLUtil.java

示例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);
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:26,代码来源:Quest.java

示例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));
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:19,代码来源:UsableItem.java

示例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);
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:13,代码来源:XMLUtil.java

示例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));
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:10,代码来源:ProjectileTypeLoader.java

示例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());
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:11,代码来源:SaveGameDetails.java

示例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));
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:39,代码来源:Effect.java

示例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));
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:8,代码来源:Not.java

示例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));	
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:8,代码来源:GameCalendar.java

示例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());
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:9,代码来源:GameCalendar.java

示例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);
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:16,代码来源:Spell.java

示例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;
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:16,代码来源:Brain.java

示例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()));
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:14,代码来源:Faction.java

示例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));	
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:8,代码来源:And.java

示例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);
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:28,代码来源:GameObject.java


注:本文中的com.badlogic.gdx.utils.XmlReader.Element.getChildCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。