本文整理汇总了Java中com.badlogic.gdx.utils.XmlWriter.pop方法的典型用法代码示例。如果您正苦于以下问题:Java XmlWriter.pop方法的具体用法?Java XmlWriter.pop怎么用?Java XmlWriter.pop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.XmlWriter
的用法示例。
在下文中一共展示了XmlWriter.pop方法的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();
}
示例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();
}
示例3: 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();
}
}
示例4: 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);
}
}
示例5: 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
}
}
示例6: 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();
}
示例7: 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);
}
示例8: 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();
}
}
}
示例9: writeToXML
import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
/**
* Writes the Inventory into XML using the supplied XmlWriter.
*
* The output XML will look like this:
*
* <pre>
* <Inventory>
* <BagType>
* <Item id="itemId" slot="inventorySlot" />
* ...
* </BagType>
* </Inventory>
* </pre>
*/
@Override
public void writeToXML(XmlWriter writer) throws IOException {
writer.element(Inventory.XML_INVENTORY);
for (BagType bagType : BagType.values()) {
IntMap<InventoryItem> bag = getBag(bagType);
if (bag.size > 0) {
writer.element(bagType.toString().toLowerCase(Locale.ENGLISH));
Entries<InventoryItem> bagIterator = bag.entries();
while (bagIterator.hasNext) {
Entry<InventoryItem> entry = bagIterator.next();
writer.element(Inventory.XML_ITEM)
.attribute(XMLUtil.XML_ATTRIBUTE_ID, entry.value.getId())
.attribute(XML_ATTRIBUTE_SLOT, entry.key)
.attribute(XML_ATTRIBUTE_STACK_SIZE,
entry.value.getStackSize());
ItemOwner itemOwner = entry.value.getOwner();
String ownerId =itemOwner.getOwnerCharacterId();
if (ownerId != null) {
writer.attribute(XML_ATTRIBUTE_OWNER_CHARACTER, ownerId);
}
Faction faction = itemOwner.getOwnerFaction();
if (faction != null) {
writer.attribute(XML_ATTRIBUTE_OWNER_FACTION, faction);
}
writer.pop();
}
writer.pop();
}
}
writer.pop();
}
示例10: writeMembers
import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
private void writeMembers(XmlWriter writer, String elementName, Iterable<GameCharacter> iterable) throws IOException {
writer.element(elementName);
for (GameCharacter pc : iterable) {
writer.element(XML_MEMBER).attribute(XMLUtil.XML_ATTRIBUTE_ID, pc.getInternalId()).pop();
}
writer.pop();
}
示例11: 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();
}
示例12: writeToXML
import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
@Override
public void writeToXML(XmlWriter writer) throws IOException {
writer.element(XMLUtil.XML_PROPERTIES);
XMLUtil.writePrimitives(this, writer);
writer.pop();
writer.element(XML_MEMBERS);
for (GameCharacter pc : groupMembers) {
writer.element(XML_MEMBER).attribute(XMLUtil.XML_ATTRIBUTE_ID, pc.getInternalId()).attribute(XMLUtil.XML_ATTRIBUTE_TYPE, pc.getType()).pop();
}
writer.pop();
formation.writeToXML(writer);
}
示例13: writeToXML
import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
public void writeToXML(XmlWriter writer) throws IOException {
writer.element(XML_MODIFIER);
for (ModifiableStat stat : mods.keys()) {
if (!isEmpty(stat)) {
float value = getMod(stat);
writer.attribute(stat.toString(), value);
}
}
writer.element(XMLUtil.XML_PROPERTIES);
XMLUtil.writePrimitives(this, writer);
writer.pop();
writer.pop();
}
示例14: writeToXML
import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
@Override
public void writeToXML(XmlWriter writer) throws IOException {
if (aiScript != null) {
aiScript.writeToXML(writer);
}
writer.element(XML_BRAIN);
writeBrainToXML(writer);
writer.pop();
}
示例15: writeToXML
import com.badlogic.gdx.utils.XmlWriter; //导入方法依赖的package包/类
public void writeToXML(XmlWriter writer) throws IOException {
writer.element(XMLUtil.XML_PROPERTIES);
XMLUtil.writePrimitives(this, writer);
writer.pop();
position.writeToXML(writer);
variables.writeToXML(writer);
if (actions.size > 0) {
writer.element(XMLUtil.XML_ACTIONS);
for (Action action : actions) {
action.writeToXML(writer);
}
writer.pop();
}
if (forbiddenActions.size > 0) {
writer.element(XML_FORBIDDEN_ACTIONS);
for (String forbiddenBy : forbiddenActions.keys()) {
writer.element(XML_FORBIDDEN_BY);
writer.attribute(XMLUtil.XML_ATTRIBUTE_ID, forbiddenBy);
for (String actionClass : forbiddenActions.get(forbiddenBy)) {
writer.element(actionClass).pop();
}
writer.pop();
}
writer.pop();
}
}