@Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle(bundle); scrolls.clear(); Collections.addAll(scrolls, bundle.getClassArray(SCROLLS)); }
@Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle(bundle); scrolls.clear(); Collections.addAll(scrolls, bundle.getClassArray(SCROLLS)); }
public static void restoreRoomsFromBundle( Bundle bundle ) { runSecrets.clear(); if (bundle.contains( ROOMS )) { for (Class<? extends SecretRoom> type : bundle.getClassArray(ROOMS)) { if (type != null) runSecrets.add(type); } regionSecretsThisRun = bundle.getIntArray(REGIONS); } else { initForRun(); ShatteredPixelDungeon.reportException(new Exception("secrets array didn't exist!")); } }
public static void restoreRoomsFromBundle( Bundle bundle ) { runSecrets.clear(); if (bundle.contains( ROOMS )) { for (Class<? extends SecretRoom> type : bundle.getClassArray(ROOMS)) { if (type != null) runSecrets.add(type); } regionSecretsThisRun = bundle.getIntArray(REGIONS); } else { initForRun(); ShatteredPixelDungeon.reportException(new Exception("secrets array didn't exist!")); } }
public static void restoreRoomsFromBundle( Bundle bundle ) { runSpecials.clear(); if (bundle.contains( ROOMS )) { for (Class<? extends Room> type : bundle.getClassArray(ROOMS)) { //pre-0.7.0 saves if (type != null && type != LaboratoryRoom.class) { runSpecials.add(type); } } } else { initForRun(); ShatteredPixelDungeon.reportException(new Exception("specials array didn't exist!")); } pitNeededDepth = bundle.getInt(PIT); }
public static void restoreRoomsFromBundle( Bundle bundle ) { runSpecials.clear(); if (bundle.contains( ROOMS )) { for (Class<? extends Room> type : bundle.getClassArray(ROOMS)) { //pre-0.7.0 saves if (type != null && type != LaboratoryRoom.class) { runSpecials.add(type); } } } else { initForRun(); ShatteredPixelDungeon.reportException(new Exception("specials array didn't exist!")); } pitNeededDepth = bundle.getInt(PIT); }
@SuppressWarnings("unchecked") @Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle( bundle ); rooms = new ArrayList<>( (Collection<Room>) ((Collection<?>) bundle.getCollection( "rooms" )) ); for (Room r : rooms) { r.onLevelLoad( this ); if (r instanceof EntranceRoom ){ roomEntrance = r; } else if (r instanceof ExitRoom ){ roomExit = r; } } if (bundle.contains( "mobs_to_spawn" )) { for (Class<? extends Mob> mob : bundle.getClassArray("mobs_to_spawn")) { if (mob != null) mobsToSpawn.add(mob); } } }
@SuppressWarnings("unchecked") @Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle( bundle ); rooms = new ArrayList<>( (Collection<Room>) ((Collection<?>) bundle.getCollection( "rooms" )) ); for (Room r : rooms) { r.onLevelLoad( this ); if (r instanceof EntranceRoom ){ roomEntrance = r; } else if (r instanceof ExitRoom ){ roomExit = r; } } if (bundle.contains( "mobs_to_spawn" )) { for (Class<? extends Mob> mob : bundle.getClassArray("mobs_to_spawn")) { if (mob != null) mobsToSpawn.add(mob); } } }
@Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle(bundle); if (level() > 0) name = Messages.get(this, "name_" + level()); if (bundle.contains(SEEDS)) Collections.addAll(seeds , bundle.getClassArray(SEEDS)); if (level() == 1) image = ItemSpriteSheet.ARTIFACT_SHOES; else if (level() == 2) image = ItemSpriteSheet.ARTIFACT_BOOTS; else if (level() >= 3) image = ItemSpriteSheet.ARTIFACT_GREAVES; }
@Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle(bundle); if (level() > 0) name = Messages.get(this, "name_" + level()); if (bundle.contains(SEEDS)) Collections.addAll(seeds , bundle.getClassArray(SEEDS)); if (level() == 1) image = ItemSpriteSheet.ARTIFACT_SHOES; else if (level() == 2) image = ItemSpriteSheet.ARTIFACT_BOOTS; else if (level() >= 3) image = ItemSpriteSheet.ARTIFACT_GREAVES; }
public static void restoreFromBundle(Bundle bundle) { if (bundle.contains(GENERAL_PROBS)){ float[] probs = bundle.getFloatArray(GENERAL_PROBS); for (int i = 0; i < probs.length; i++){ categoryProbs.put(Category.values()[i], probs[i]); } } else { reset(); } initArtifacts(); if (bundle.contains(SPAWNED_ARTIFACTS)){ for ( Class<?extends Artifact> artifact : bundle.getClassArray(SPAWNED_ARTIFACTS) ){ removeArtifact(artifact); } //pre-0.6.1 saves } else if (bundle.contains("artifacts")) { String[] names = bundle.getStringArray("artifacts"); Category cat = Category.ARTIFACT; for (String artifact : names) for (int i = 0; i < cat.classes.length; i++) if (cat.classes[i].getSimpleName().equals(artifact)) cat.probs[i] = 0; } } }
public static void restoreFromBundle(Bundle bundle) { if (bundle.contains(GENERAL_PROBS)){ float[] probs = bundle.getFloatArray(GENERAL_PROBS); for (int i = 0; i < probs.length; i++){ categoryProbs.put(Category.values()[i], probs[i]); } } else { reset(); } initArtifacts(); if (bundle.contains(SPAWNED_ARTIFACTS)){ for ( Class<?extends Artifact> artifact : bundle.getClassArray(SPAWNED_ARTIFACTS) ){ removeArtifact(artifact); } //pre-0.6.1 saves } else if (bundle.contains("artifacts")) { String[] names = bundle.getStringArray("artifacts"); Category cat = Category.ARTIFACT; for (String artifact : names) for (int i = 0; i < cat.classes.length; i++) if (cat.classes[i].getSimpleName().equals(artifact)) cat.probs[i] = 0; } } }