本文整理汇总了Java中com.watabou.utils.Bundle.write方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.write方法的具体用法?Java Bundle.write怎么用?Java Bundle.write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.watabou.utils.Bundle
的用法示例。
在下文中一共展示了Bundle.write方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveGlobal
import com.watabou.utils.Bundle; //导入方法依赖的package包/类
public static void saveGlobal() {
if (saveNeeded) {
Bundle bundle = new Bundle();
store(bundle, global);
try {
OutputStream output = Game.instance.openFileOutput(BADGES_FILE,
Context.MODE_PRIVATE);
Bundle.write(bundle, output);
File file = new File(TextureCache.context.getExternalFilesDir(null), BADGES_FILE);
Bundle.writeext(bundle, file);
output.close();
saveNeeded = false;
} catch (IOException e) {
}
}
}
示例2: saveGlobal
import com.watabou.utils.Bundle; //导入方法依赖的package包/类
public static void saveGlobal() {
if (saveNeeded) {
Bundle bundle = new Bundle();
store( bundle, global );
try {
OutputStream output = Game.instance.openFileOutput( BADGES_FILE, Game.MODE_PRIVATE );
Bundle.write( bundle, output );
output.close();
saveNeeded = false;
} catch (IOException e) {
UNISTPixelDungeon.reportException(e);
}
}
}
示例3: leave
import com.watabou.utils.Bundle; //导入方法依赖的package包/类
public static void leave() {
depth = Dungeon.depth;
//heroes which have won the game, who die far above their farthest depth, or who are challenged drop no bones.
if (Statistics.amuletObtained || (Statistics.deepestFloor - 5) >= depth || Dungeon.challenges > 0) {
depth = -1;
return;
}
item = pickItem(Dungeon.hero);
Bundle bundle = new Bundle();
bundle.put( LEVEL, depth );
bundle.put( ITEM, item );
try {
OutputStream output = Game.instance.openFileOutput( BONES_FILE, Game.MODE_PRIVATE );
Bundle.write( bundle, output );
output.close();
} catch (IOException e) {
UNISTPixelDungeon.reportException(e);
}
}
示例4: saveLevel
import com.watabou.utils.Bundle; //导入方法依赖的package包/类
public static void saveLevel() throws IOException {
Bundle bundle = new Bundle();
bundle.put(LEVEL, level);
OutputStream output = Game.instance.openFileOutput(
Utils.format(depthFile(hero.heroClass), depth),
Context.MODE_PRIVATE);
Bundle.write(bundle, output);
File file = new File(TextureCache.context.getExternalFilesDir(null), Utils.format(depthFile(hero.heroClass), depth));
Bundle.writeext(bundle, file);
output.close();
}
示例5: leave
import com.watabou.utils.Bundle; //导入方法依赖的package包/类
public static void leave() {
depth = Dungeon.depth;
// heroes which have won the game, who die far above their farthest
// depth, or who are challenged drop no bones.
if (Statistics.amuletObtained || (Statistics.deepestFloor - 5) >= depth
|| Dungeon.challenges > 0) {
depth = -1;
return;
}
item = pickItem(Dungeon.hero);
Bundle bundle = new Bundle();
bundle.put(LEVEL, depth);
bundle.put(ITEM, item);
try {
OutputStream output = Game.instance.openFileOutput(BONES_FILE,
Context.MODE_PRIVATE);
Bundle.write(bundle, output);
File file = new File(TextureCache.context.getExternalFilesDir(null), BONES_FILE);
Bundle.writeext(bundle, file);
output.close();
} catch (IOException e) {
}
}
示例6: saveLevel
import com.watabou.utils.Bundle; //导入方法依赖的package包/类
public static void saveLevel() throws IOException {
Bundle bundle = new Bundle();
bundle.put( LEVEL, level );
OutputStream output = Game.instance.openFileOutput(
Messages.format( depthFile( hero.heroClass ), depth ), Game.MODE_PRIVATE );
Bundle.write( bundle, output );
output.close();
}
示例7: saveLevel
import com.watabou.utils.Bundle; //导入方法依赖的package包/类
public static void saveLevel() throws IOException {
Bundle bundle = new Bundle();
bundle.put( LEVEL, level );
OutputStream output = Game.instance.openFileOutput( Utils.format( depthFile( hero.heroClass ), depth ));
Bundle.write( bundle, output );
output.close();
}
示例8: saveGame
import com.watabou.utils.Bundle; //导入方法依赖的package包/类
public static void saveGame( String fileName ) throws IOException {
try {
Bundle bundle = new Bundle();
bundle.put( VERSION, Game.version );
bundle.put( CHALLENGES, challenges );
bundle.put( HERO, hero );
bundle.put( GOLD, gold );
bundle.put( DEPTH, depth );
for (int d : droppedItems.keyArray()) {
bundle.put( Utils.format( DROPPED, d ), droppedItems.get( d ) );
}
bundle.put( POS, potionOfStrength );
bundle.put( SOU, scrollsOfUpgrade );
bundle.put( SOE, scrollsOfEnchantment );
bundle.put( DV, dewVial );
int count = 0;
int ids[] = new int[chapters.size()];
for (Integer id : chapters) {
ids[count++] = id;
}
bundle.put( CHAPTERS, ids );
Bundle quests = new Bundle();
Ghost .Quest.storeInBundle( quests );
Wandmaker .Quest.storeInBundle( quests );
Blacksmith .Quest.storeInBundle( quests );
Imp .Quest.storeInBundle( quests );
bundle.put( QUESTS, quests );
Room.storeRoomsInBundle( bundle );
Statistics.storeInBundle( bundle );
Journal.storeInBundle( bundle );
QuickSlot.save( bundle );
Scroll.save( bundle );
Potion.save( bundle );
Wand.save( bundle );
Ring.save( bundle );
Bundle badges = new Bundle();
Badges.saveLocal( badges );
bundle.put( BADGES, badges );
OutputStream output = Game.instance.openFileOutput( fileName);
Bundle.write( bundle, output );
output.close();
} catch (Exception e) {
GamesInProgress.setUnknown( hero.heroClass );
}
}