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


Java XmlWriter.attribute方法代码示例

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


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

示例1: writeToXML

import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
@Override
public void writeToXML(XmlWriter writer) throws IOException {
	super.writeToXML(writer);
	
	variables.writeToXML(writer);
	
	writer.element(XML_STORY);
	int i = 0;
	for (QuestState state : story) {
		writer.element(XML_STATE);
		writer.attribute(XMLUtil.XML_ATTRIBUTE_ID, state.getId());
		writer.element(XML_TIME);
		storyTimes.get(i).writeToXML(writer);
		writer.pop();
		writer.pop();
		++i;
	}
	writer.pop();
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:20,代码来源:Quest.java

示例2: writeGlobalToXML

import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
private static void writeGlobalToXML(GameState gameState, XmlWriter writer) throws IOException {
	writer.element(XML_GLOBAL);
	writer.element(XMLUtil.XML_PROPERTIES);
	GameMap currentMap = gameState.getCurrentMap();
	
	if (currentMap != null) {
		writer.attribute(XML_ATTRIBUTE_CURRENT_MAP, currentMap.getId());
		Vector2 tempVector = MathUtil.getVector2().set(currentMap.getCamera().position.x, currentMap.getCamera().position.y);
		currentMap.projectToTiles(tempVector);
		writer.attribute(XML_ATTRIBUTE_CAMERA_POSITION_X, tempVector.x);
		writer.attribute(XML_ATTRIBUTE_CAMERA_POSITION_Y, tempVector.y);
		MathUtil.freeVector2(tempVector);
	} 
	
	writer.attribute(XML_ATTRIBUTE_GOID, gameState.getCurrentId());
	writer.pop();
	
	writer.element(XML_ATTRIBUTE_GAME_TIME);
	GameState.getCurrentGameDate().writeToXML(writer);
	writer.pop();
	
	gameState.variables().writeToXML(writer);
	writer.pop();
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:25,代码来源:GameSaver.java

示例3: writeTargetToXml

import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
@Override
protected void writeTargetToXml(XmlWriter writer) throws IOException {
	InventoryItem item = getCrimeTarget();
	writer.attribute(XMLUtil.XML_ATTRIBUTE_ID, item.getId())
			.attribute(Inventory.XML_ATTRIBUTE_STACK_SIZE,
					item.getStackSize());
	ItemOwner itemOwner = item.getOwner();
	String ownerId =itemOwner.getOwnerCharacterId();
	if (ownerId != null) {
		writer.attribute(Inventory.XML_ATTRIBUTE_OWNER_CHARACTER, ownerId);
	}
	Faction faction = itemOwner.getOwnerFaction();
	if (faction != null) {
		writer.attribute(Inventory.XML_ATTRIBUTE_OWNER_FACTION, faction);
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:17,代码来源:Theft.java

示例4: writeGenAttr

import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
public static void writeGenAttr(XmlWriter writer,Actor actor) throws IOException {
    writer.attribute("width",actor.getWidth())
            .attribute("height",actor.getHeight())
            .attribute("x",actor.getX())
            .attribute("y",actor.getY())
            .attribute("originX",actor.getOriginX())
            .attribute("originY",actor.getOriginY())
            .attribute("visible",String.valueOf(actor.isVisible()));
    if (actor.getName()!=null&&!actor.getName().isEmpty()){
        writer.attribute("name",actor.getName());
    }
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:13,代码来源:FileUtils.java

示例5: writeUqAttr

import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
public static void writeUqAttr(XmlWriter xmlWriter,Actor actor) throws IOException {
    Object userobject = actor.getUserObject();
    if (userobject!=null&&userobject instanceof HashMap){
        HashMap<String,String> attrMap = (HashMap<String,String>)userobject;
        for (String key : attrMap.keySet()){
            xmlWriter.attribute(key,attrMap.get(key));
        }
    }
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:10,代码来源:FileUtils.java

示例6: writeParametersToXML

import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
@Override
public void writeParametersToXML(XmlWriter writer) throws IOException {
	if (targetId != null) {
		writer.attribute(XML_ATTRIBUTE_TARGET, targetId);
	}
	if (currentAction != null) {
		currentAction.writeToXML(writer);
	}
	if (actions.size() > 0) {
		for (Action action : actions) {
			action.writeToXML(writer);
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:15,代码来源:ChainAction.java

示例7: writeParametersToXML

import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
@Override
public void writeParametersToXML(XmlWriter writer) throws IOException {
	writer.attribute(XMLUtil.XML_ATTRIBUTE_ID, perkId);
	if (effectTarget != null) {
		writer.attribute(XML_ATTRIBUTE_X, effectTarget.getTargetX());
		writer.attribute(XML_ATTRIBUTE_Y, effectTarget.getTargetY());
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:9,代码来源:UsePerkAction.java

示例8: writeParametersToXML

import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
@Override
public void writeParametersToXML(XmlWriter writer) throws IOException {
	writer.attribute(XMLUtil.XML_ATTRIBUTE_ID, itemId);
	if (effectTarget != null) {
		writer.attribute(XML_ATTRIBUTE_X, effectTarget.getTargetX());
		writer.attribute(XML_ATTRIBUTE_Y, effectTarget.getTargetY());
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:9,代码来源:UseInventoryItemAction.java

示例9: writePrimitives

import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
/**
 * This will write out using the supplied writer all class members from the
 * supplied Object that have their name "s_".
 * 
 * They will not be written out if they are null.
 * 
 * @param object
 *            - the object from which to read the members
 * @param writer
 *            - the XmlWriter which to use to write the members
 */
public static void writePrimitives(Object object, XmlWriter writer, boolean asElements) throws IOException {
	try {
		Class<?> objectClass = object.getClass();
		while (objectClass != null && objectClass != Object.class) {
			Field[] fields = objectClass.getDeclaredFields();

			for (Field field : fields) {
				if (!field.getName().startsWith("s_")) {
					continue;
				}
				field.setAccessible(true);
				Object fieldValue = field.get(object);
				field.setAccessible(false);
				if (fieldValue != null) {
					if (asElements) {
						writer.element(field.getName().replaceFirst("s_", ""), fieldValue.toString());
					} else {
						writer.attribute(field.getName().replaceFirst("s_", ""), fieldValue.toString());
					}
				}
			}
			objectClass = objectClass.getSuperclass();
		}
	} catch (IllegalAccessException e) {
		throw new GdxRuntimeException(e);
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:39,代码来源:XMLUtil.java

示例10: writeToXML

import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
@Override
public void writeToXML(XmlWriter writer) throws IOException {
	writer.element(XML_FORMATION);
	writer.attribute(XML_FORMATION_ORIENTATION, orientation);
	for(Entry<Integer, Tile> entry : formation.entries()) {
		writer.element(CharacterGroup.XML_MEMBER).attribute(XML_ATTRIBUTE_INDEX, entry.key.toString()).attribute(XML_ATTRIBUTE_XOFFSET, entry.value.getX()).attribute(XML_ATTRIBUTE_YOFFSET, entry.value.getY()).pop();
	}
	writer.pop();
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:10,代码来源:Formation.java

示例11: writeToXML

import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
@Override
public void writeToXML(XmlWriter writer) throws IOException {
	/*
	 * We only save the current state of the quest.
	 * 
	 * Since state machines are master data, they are loaded during
	 * game startup. When a game is loaded, they are then 
	 * set to their current states.
	 */
	if (currentState != null) {
		writer.attribute(XML_CURRENT_STATE, currentState.getId());
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:14,代码来源:StateMachine.java

示例12: writeParametersToXML

import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
@Override
public void writeParametersToXML(XmlWriter writer) throws IOException {
	writer.attribute(XML_ATTRIBUTE_TARGET, targetId);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:5,代码来源:PickUpAction.java

示例13: writeParametersToXML

import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
@Override
public void writeParametersToXML(XmlWriter writer) throws IOException {
	writer.attribute(XML_ATTRIBUTE_X, targetX);
	writer.attribute(XML_ATTRIBUTE_Y, targetY);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:6,代码来源:LockpickAction.java

示例14: writeParametersToXML

import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
@Override
public void writeParametersToXML(XmlWriter writer) throws IOException {
	writer.attribute(XML_ATTRIBUTE_SPELL, perkId);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:5,代码来源:CastSpellAction.java

示例15: writeParametersToXML

import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
@Override
public void writeParametersToXML(XmlWriter writer) throws IOException {
	writer.attribute(XML_ATTRIBUTE_DURATION, duration);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:5,代码来源:WaitAction.java


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