• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java XmlWriter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



XmlWriter类属于com.badlogic.gdx.utils包,在下文中一共展示了XmlWriter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: writeToXML

import com.badlogic.gdx.utils.XmlWriter; //导入依赖的package包/类
@Override
public void writeToXML(XmlWriter writer) throws IOException {
	super.writeToXML(writer);
	stats.writeToXML(writer);
	survival.writeToXML(writer);
	
	XMLUtil.writePerks(this, writer);
	XMLUtil.writeSpells(this, writer);
	inventory.writeToXML(writer);
	
	if (effects.size > 0) {
		writer.element(Effect.XML_PERSISTENT);
		for (PersistentEffect effect : effects.values()) {
			effect.writeToXML(writer);
		}
		writer.pop();
	}
	
	if (damageQueue.size > 0) {
		writer.element(XML_DAMAGE_QUEUE);
		for (DamageInfo dinfo: damageQueue) {
			dinfo.writeToXML(writer);
		}
		writer.pop();
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:27,代码来源:GameCharacter.java


示例3: setGo

import com.badlogic.gdx.utils.XmlWriter; //导入依赖的package包/类
public void setGo(GameObject go) {
	if (go == null) {
		goName.setText("");
		goId.setText("");
		goInternalId.setText("");
		goDetails.setText("");
		return;
	}
	StringWriter stringWriter = new StringWriter();
	XmlWriter writer = new XmlWriter(stringWriter);
	String result;
	try {
		go.writeToXML(writer);
		result = stringWriter.toString();
		result = result.replace("\t", "    ");
		stringWriter.close();
	} catch (IOException e) {
		result = "Error: "+e.getMessage();
	}
	goName.setText(go.getName());
	goId.setText(" ("+go.getId()+")");
	goInternalId.setText(" ["+go.getInternalId()+"]");
	goDetails.setText(result);
	pack();
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:26,代码来源:GameObjectViewer.java


示例4: 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


示例5: writeToXML

import com.badlogic.gdx.utils.XmlWriter; //导入依赖的package包/类
@Override
public void writeToXML(XmlWriter writer) throws IOException {
	super.writeToXML(writer);
	lock.writeToXML(writer);
	if (trap != null) {
		trap.writeToXML(writer);
	}
	if (ground != null) {
		writer
			.element(XML_GROUND)
				.attribute(XMLUtil.XML_ATTRIBUTE_X, ground.getX())
				.attribute(XMLUtil.XML_ATTRIBUTE_Y, ground.getY())
			.pop();
	}
	inventory.writeToXML(writer);
	writer.element(XML_STATE_MACHINE);
	stateMachine.writeToXML(writer);
	writer.pop();
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:20,代码来源:UsableGameObject.java


示例6: 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


示例7: writeAllGameObjectsToXML

import com.badlogic.gdx.utils.XmlWriter; //导入依赖的package包/类
private void writeAllGameObjectsToXML(XmlWriter writer) throws IOException {
	for (GameLocation loc : locations.values()) {
		if (loc instanceof GameMap) {
			writer.element(XML_GAME_OBJECTS).attribute(XML_MAP, loc.getId());
			((GameMap) loc).writeAllGameObjectsToXML(writer);
			writer.pop();
		}
	}
	if (unassignedLocalGameObjects.size > 0) {
		writer.element(XML_GAME_OBJECTS);
		for (GameObject go : unassignedLocalGameObjects.values()) {
			if (!go.shouldBeSaved()) {
				 continue;
			 }
			 writer.element(go.getClass().getName());
			 go.writeToXML(writer);
			 writer.pop();
		}
		writer.pop();
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:22,代码来源:GameSaver.java


示例8: save

import com.badlogic.gdx.utils.XmlWriter; //导入依赖的package包/类
@Override
public void save(XmlWriter writer, Actor actor, LayoutParserContext context)
		throws LayoutParseException {
	try {
		TextField textField = (TextField) actor;
		writer.element(getElementName());
		ElementParserHelper.writeDefaultAttributes(writer, actor);
		
		if (!textField.getText().isEmpty()) {
			writer.text(textField.getText());
		}
		
		writer.pop();
	} catch (IOException e) {
		throw new LayoutParseException(e);
	}
}
 
开发者ID:highstreeto,项目名称:XMLLayoutParser,代码行数:18,代码来源:TextFieldParser.java


示例9: save

import com.badlogic.gdx.utils.XmlWriter; //导入依赖的package包/类
/**
 *
 * @param layoutFile
 * @param actors
 * @throws LayoutParseException
 */
public void save(FileHandle layoutFile, Collection<Actor> actors)
        throws LayoutParseException {
    try {
        XmlWriter writer = new XmlWriter(layoutFile.writer(false));
        LayoutParserContext context = new LayoutParserContext();
        context.setParsers(parsers);

        writer.element("Layout");

        for (Actor i : actors) {
            parsers.getParserByClass(i.getClass()).save(writer, i, context);
        }

        writer.pop();
        writer.close();
    } catch (IOException e) {
        throw new LayoutParseException(e); // TODO More detailed Exception
    }
}
 
开发者ID:highstreeto,项目名称:XMLLayoutParser,代码行数:26,代码来源:LayoutParser.java


示例10: createScene

import com.badlogic.gdx.utils.XmlWriter; //导入依赖的package包/类
public static void createScene(Writer writer,float width,float height,String name) throws IOException {
    XmlWriter xmlWriter= new XmlWriter(writer);
    xmlWriter.element("Stage")
                .attribute("width",width)
                .attribute("height",height)
                .attribute("name",name)
                .pop();
    xmlWriter.flush();
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:10,代码来源:FileUtils.java


示例11: writeFile

import com.badlogic.gdx.utils.XmlWriter; //导入依赖的package包/类
public static void writeFile(Group group, FileHandle fileHandle) throws IOException {
    FileWriter writer = new FileWriter(fileHandle.file());
    XmlWriter xmlWriter= new XmlWriter(writer);
    writeAttr(xmlWriter,group);
    xmlWriter.flush();
    writer.close();
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:8,代码来源:FileUtils.java


示例12: 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


示例13: 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


示例14: writeToXML

import com.badlogic.gdx.utils.XmlWriter; //导入依赖的package包/类
@Override
public void writeToXML(XmlWriter writer) throws IOException {
	XMLUtil.writePrimitives(this, writer, true);
	writer.element(XML_OFFSET);
	writer.element(XMLUtil.XML_ATTRIBUTE_X, xOffset);
	writer.element(XMLUtil.XML_ATTRIBUTE_Y, yOffset);
	writer.pop();
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:9,代码来源:ParticleEffectDescriptor.java


示例15: writeAllGameObjectsToXML

import com.badlogic.gdx.utils.XmlWriter; //导入依赖的package包/类
public void writeAllGameObjectsToXML(XmlWriter writer) throws IOException {
	 for (GameObject go : gameObjects) {
		 if (!go.shouldBeSaved()) {
			 continue;
		 }
		 writer.element(go.getClass().getName());
		 go.writeToXML(writer);
		 writer.pop();
	 }
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:11,代码来源:GameMap.java


示例16: writeAllLocationsToXML

import com.badlogic.gdx.utils.XmlWriter; //导入依赖的package包/类
public void writeAllLocationsToXML(XmlWriter writer) throws IOException {
	 for (GameLocation location: locations) {
		 writer.element(location.getClass().getName());
		 location.writeToXML(writer);
		 writer.pop();
	 }
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:8,代码来源:GameMap.java


示例17: writeToXML

import com.badlogic.gdx.utils.XmlWriter; //导入依赖的package包/类
@Override
public void writeToXML(XmlWriter writer) throws IOException {
	super.writeToXML(writer);
	writer.element(XML_FOG_OF_WAR);
	writer.text(fogOfWar.length+" ");
	for (int i = 0; i <fogOfWar.length; ++i) {
		if (fogOfWar[i] == 1) {
			writer.text(i+" ");
		}
	}
	writer.pop();
	
	writer.element(XML_TRANSITION_LOCKS);
	for (TransitionLock lock : transitionLocks) {
		writer.element(XML_TRANSITION_LOCK);
		lock.writeToXML(writer);
		writer.pop();
	}
	writer.pop();
	
	writer.element(XML_TRANSITION_TRAPS);
	for (TransitionTrap trap : transitionTraps) {
		writer.element(XML_TRANSITION_TRAP);
		trap.writeToXML(writer);
		writer.pop();
	}
	writer.pop();
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:29,代码来源:GameMap.java


示例18: writeToXML

import com.badlogic.gdx.utils.XmlWriter; //导入依赖的package包/类
@Override
public void writeToXML(XmlWriter writer) throws IOException {
	writer.element(XML_PROPERTIES);
	XMLUtil.writePrimitives(this, writer);
	writer.pop();
	variables.writeToXML(writer);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:8,代码来源:GameLocation.java


示例19: writeAllStartedQuests

import com.badlogic.gdx.utils.XmlWriter; //导入依赖的package包/类
/**
 * Writes all quests that have been started during the course of the game.
 * 
 * @param writer
 * @throws IOException
 */
public static void writeAllStartedQuests(XmlWriter writer) throws IOException {
	for (String questFile : quests.values()) {
		Quest quest = Assets.get(questFile);
		if (quest.isStarted()) {
			writer.element(quest.getId());
			quest.writeToXML(writer);
			writer.pop();
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:17,代码来源:Quest.java


示例20: writeToXML

import com.badlogic.gdx.utils.XmlWriter; //导入依赖的package包/类
public void writeToXML(XmlWriter writer) throws IOException {
	writer.attribute(XML_DAY, getDay()+1);
	writer.attribute(XML_MONTH, getMonth()+1);
	writer.attribute(XML_YEAR, getYear());
	writer.attribute(XML_HOUR, getHour());
	writer.attribute(XML_MINUTE, getMinute());
	writer.attribute(XML_SECOND, getSecond());
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:9,代码来源:GameDate.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PanelDefinitionImpl类代码示例发布时间:2022-05-22
下一篇:
Java RegisterUDP类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap