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


Java Element.getName方法代码示例

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


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

import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
/**
 * Read the actions from the suppled XML element and loads them into the
 * supplied ActionsContainer.
 * 
 * The XML element should contain children in the following format:
 * 
 * <pre>
 * &lt;actionClassName parameter1Name="parameter1Value" parameter2Name="parameter2Value" ... /&gt;
 * </pre>
 * 
 * @param ac
 * @param actionsElement
 */
@SuppressWarnings({ "unchecked" })
public static void readActions(ActionsContainer ac, Element actionsElement) {
	if (actionsElement != null) {
		for (int i = 0; i < actionsElement.getChildCount(); ++i) {
			Element actionElement = actionsElement.getChild(i);
			String implementationClassName = actionElement.getName();
			implementationClassName = Action.class.getPackage().getName() + "."
					+ StringUtil.capitalizeFirstLetter(implementationClassName);
			try {
				Class<? extends Action> actionClass = (Class<? extends Action>) ClassReflection
						.forName(implementationClassName);
				Action newAction = ac.addAction(actionClass);
				if (newAction != null) {
					newAction.loadFromXML(actionElement);
				}

			} catch (ReflectionException e) {
				throw new GdxRuntimeException(e);
			}
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:36,代码来源:XMLUtil.java

示例3: loadFromXML

import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
private void loadFromXML(Element screensElement) {
	XMLUtil.readPrimitiveMembers(this, screensElement);
	for (int i = 0; i < screensElement.getChildCount(); ++i) {
		Element child = screensElement.getChild(i);
		String childName = child.getName();
		if (XML_SCREEN.equals(childName)) {
			addImage(Configuration.addModulePath(child.get(XML_IMAGE)));
		} else {
			for (int j = 0; j < child.getChildCount(); ++j) {
				addImage(childName, Configuration.addModulePath(child.getChild(j).get(XML_IMAGE)));
			}
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:15,代码来源:LoadingScreens.java

示例4: load

import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public InventoryItem load (AssetManager assetManager, String fileName, FileHandle itemFile, InventoryItemParameter parameter) {
	try {
		XmlReader xmlReader = new XmlReader();
		Element root = xmlReader.parse(itemFile);
		InventoryItem newItem = null;
		
		Element properties = root.getChildByName(XMLUtil.XML_PROPERTIES);
		if (properties != null) {
			
			String groupNames = properties.getAttribute(Inventory.XML_ATTRIBUTE_GROUPS, "");
			
			String[] groups = groupNames.split(",");
			for (String group : groups) {
				group = group.trim();
				ItemGroup existingGroup = ItemGroup.get(group);
				if (existingGroup != null) {
					existingGroup.add(itemFile.nameWithoutExtension());
				} else {
					ItemGroup.add(group, new ItemGroup(group, itemFile.nameWithoutExtension()));
				}
			}
		}
		
		String implementationClassName = root.getName();
		implementationClassName = InventoryItem.class.getPackage().getName()+"."+StringUtil.capitalizeFirstLetter(implementationClassName);
	
		Class<? extends InventoryItem> itemClass = (Class<? extends InventoryItem>) Class.forName(implementationClassName);
		newItem =  itemClass.getConstructor(FileHandle.class).newInstance(resolve(fileName));
		return newItem;
	} catch (Exception e) {
		throw new GdxRuntimeException(e);
	} 
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:36,代码来源:InventoryItemLoader.java

示例5: loadMap

import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
protected TiledMap loadMap(Element root, FileHandle tmxFile, AtlasResolver resolver) {
	TiledMap map = new TiledMap();

	String mapOrientation = root.getAttribute("orientation", null);
	int mapWidth = root.getIntAttribute("width", 0);
	int mapHeight = root.getIntAttribute("height", 0);
	int tileWidth = root.getIntAttribute("tilewidth", 0);
	int tileHeight = root.getIntAttribute("tileheight", 0);
	String mapBackgroundColor = root.getAttribute("backgroundcolor", null);

	MapProperties mapProperties = map.getProperties();
	if (mapOrientation != null) {
		mapProperties.put("orientation", mapOrientation);
	}
	mapProperties.put("width", mapWidth);
	mapProperties.put("height", mapHeight);
	mapProperties.put("tilewidth", tileWidth);
	mapProperties.put("tileheight", tileHeight);
	if (mapBackgroundColor != null) {
		mapProperties.put("backgroundcolor", mapBackgroundColor);
	}

	mapTileWidth = tileWidth;
	mapTileHeight = tileHeight;
	mapWidthInPixels = mapWidth * tileWidth;
	mapHeightInPixels = mapHeight * tileHeight;

	if (mapOrientation != null) {
		if ("staggered".equals(mapOrientation)) {
			if (mapHeight > 1) {
				mapWidthInPixels += tileWidth / 2;
				mapHeightInPixels = mapHeightInPixels / 2 + tileHeight / 2;
			}
		}
	}

	for (int i = 0, j = root.getChildCount(); i < j; i++) {
		Element element = root.getChild(i);
		String elementName = element.getName();
		if (elementName.equals("properties")) {
			loadProperties(map.getProperties(), element);
			String types_path = "kyperbox_types.xml";
			if (types == null) {
				types = new TiledObjectTypes(types_path);
				templates = new TiledTemplates(types, "");
			}
		} else if (elementName.equals("tileset")) {
			loadTileset(map, element, tmxFile, resolver);
		} else if (elementName.equals("layer")) {
			loadTileLayer(map, map.getLayers(), element);
		} else if (elementName.equals("objectgroup")) {
			loadObjectGroup(map, map.getLayers(), element);
		}
	}
	return map;
}
 
开发者ID:kyperbelt,项目名称:KyperBox,代码行数:57,代码来源:KyperMapLoader.java

示例6: loadFromXML

import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
@Override
public void loadFromXML(Element root) throws IOException {
	this.name = root.getName();
	XMLUtil.readPrimitiveMembers(this, root);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:6,代码来源:EffectParameter.java

示例7: readFromXML

import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
public static EffectParameterDefinition readFromXML(Element parameterElement) {
	EffectParameterDefinition returnValue = new EffectParameterDefinition();
	XMLUtil.readPrimitiveMembers(returnValue, parameterElement);
	returnValue.name = parameterElement.getName();
	return returnValue;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:7,代码来源:Effect.java


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