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


Java Element.getText方法代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.XmlReader.Element.getText方法的典型用法代码示例。如果您正苦于以下问题:Java Element.getText方法的具体用法?Java Element.getText怎么用?Java Element.getText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.utils.XmlReader.Element的用法示例。


在下文中一共展示了Element.getText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadAtlas

import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
/** May return null. */
protected FileHandle loadAtlas(Element root, FileHandle tmxFile) throws IOException {
	Element e = root.getChildByName("properties");

	if (e != null) {
		for (Element property : e.getChildrenByName("property")) {
			String name = property.getAttribute("name", null);
			String value = property.getAttribute("value", null);
			if (name.equals("atlas")) {
				if (value == null) {
					value = property.getText();
				}

				if (value == null || value.length() == 0) {
					// keep trying until there are no more atlas properties
					continue;
				}
				return Gdx.files.internal(value);
			}
		}
	}
	FileHandle atlasFile = tmxFile.sibling(tmxFile.nameWithoutExtension() + ".atlas");
	return atlasFile.exists() ? atlasFile : null;
}
 
开发者ID:kyperbelt,项目名称:KyperBox,代码行数:25,代码来源:KyperMapLoader.java

示例2: GameOptions

import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
private GameOptions(final FileHandle file) throws IOException {
	final XmlReader xmlReader = new XmlReader();
	final Element root = xmlReader.parse(file);
	XMLUtil.readPrimitiveMembers(this, root);
	Element keyBindingsElement = root.getChildByName(XML_KEY_BINDINGS);
	if (keyBindingsElement != null) {
		for (int i = 0; i < keyBindingsElement.getChildCount(); ++i) {
			Element bindingElement = keyBindingsElement.getChild(i);
			KeyBindings binding = KeyBindings.valueOf(bindingElement.getName().toUpperCase(Locale.ENGLISH));
			binding.getKeys().clear();
			Array<Integer> newKeys = new Array<Integer>();
			if (bindingElement.getText() != null) {
				for (String key : bindingElement.getText().split(",")) {
					newKeys.add(Integer.valueOf(key));
				}
			}
			binding.getKeys().addAll(newKeys);
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:21,代码来源:Configuration.java

示例3: loadFromXML

import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
public void loadFromXML(Element root) throws IOException {
	super.loadFromXML(root);	
	
	if (s_model != null) {
		try {
			animations = new CharacterAnimationMap(s_model, s_audioProfile, getSpeed());
		} catch (IOException e) {
			throw new GdxRuntimeException("Problem loading animation for character "+getInternalId(),e);
		}
	}
	
	characterCircle.setColor(ColorUtil.WHITE_FIFTY);
	destinationIndicator.setColor(ColorUtil.WHITE_FIFTY);
	
	brain.loadFromXML(root);
	
	getFaction().addMember(this);
	
	Element tempHostilityElement = root.getChildByName(XML_TEMPORARY_HOSTILITY);
	if (tempHostilityElement != null) {
		for(int i = 0; i < tempHostilityElement.getChildCount(); ++i) {
			Element hostilityElement = tempHostilityElement.getChild(i);
			Integer duration = Integer.parseInt(hostilityElement.get(XML_DURATION));
			GameCalendarDate start = new GameCalendarDate(gameState.getCalendar());
			start.readFromXML(hostilityElement.getChildByName(XML_START));
			temporaryHostility.put(Faction.getFaction(hostilityElement.getName()), new Pair<GameCalendarDate, Integer>(start, duration));
		}
	}
	
	resetCharacterCircleColor();
	
	Element visited = root.getChildByName(XML_VISITED);
	if (visited != null) {
		String visitedLocations = visited.getText();
		String[] locations = visitedLocations.split(",");
		for (String location : locations) {
			this.visitedLocations.add(location.trim());
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:41,代码来源:AbstractGameCharacter.java

示例4: loadFromXML

import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void loadFromXML(Element root) throws IOException {
	super.loadFromXML(root);
	Element fogOfWarElement = root.getChildByName(XML_FOG_OF_WAR);
	if (fogOfWarElement != null) {
		String text = fogOfWarElement.getText();
		String[] tokens = text.split(" ");
		
		fogOfWar = new int[Integer.parseInt(tokens[0].trim())];
		for (int i =0; i <fogOfWar.length; ++i) {
			fogOfWar[i] = 0;
		}
		
		for (int i = 1; i < tokens.length; ++i) {
			int index = -1;
			try {
				index = Integer.parseInt(tokens[i].trim());
				fogOfWar[index] = 1;
			} catch (NumberFormatException e) {
				continue;
			}
			
		}
	}
	Element locksElement = root.getChildByName(XML_TRANSITION_LOCKS);
	if (locksElement != null) {
		for (int i = 0; i < locksElement.getChildCount(); ++i) {
			Element lockElement = locksElement.getChild(i);
			transitionLocks.add(new TransitionLock(lockElement));
		}
	}
	Element trapsElement = root.getChildByName(XML_TRANSITION_TRAPS);
	if (trapsElement != null) {
		for (int i = 0; i < trapsElement.getChildCount(); ++i) {
			Element trapElement = trapsElement.getChild(i);
			transitionTraps.add(new TransitionTrap(trapElement));
		}
	}
	Element weatherModifiersElement = root.getChildByName(XML_WEATHER_MODIFIERS);
	if (weatherModifiersElement != null) {
		String[] profiles = weatherModifiersElement.getText().split(",");
		for (String profileId : profiles) {
			WeatherProfile profile = WeatherProfile.getWeatherProfile(profileId.trim());
			if (profile.isModifier()) {
				weatherProfileModifiers.add(profile);
			} else {
				throw new GdxRuntimeException("Weather Profile "+profile.getId()+" is not a modifier and cannot be set for map "+getId());
			}
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:52,代码来源:GameMap.java


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