Java Code Examples for com.watabou.utils.Bundle#getStringArray()

The following examples show how to use com.watabou.utils.Bundle#getStringArray() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Badges.java    From shattered-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
public static HashSet<Badge> restore( Bundle bundle ) {
	HashSet<Badge> badges = new HashSet<>();
	if (bundle == null) return badges;
	
	String[] names = bundle.getStringArray( BADGES );
	for (int i=0; i < names.length; i++) {
		try {
			if (renamedBadges.containsKey(names[i])){
				names[i] = renamedBadges.get(names[i]);
			}
			if (!removedBadges.contains(names[i])){
				badges.add( Badge.valueOf( names[i] ) );
			}
		} catch (Exception e) {
			ShatteredPixelDungeon.reportException(e);
		}
	}

	return badges;
}
 
Example 2
Source File: Badges.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 6 votes vote down vote up
public static HashSet<Badge> restore( Bundle bundle ) {
	HashSet<Badge> badges = new HashSet<>();
	if (bundle == null) return badges;
	
	String[] names = bundle.getStringArray( BADGES );
	if (names == null) {
		return badges;
	}
	for (int i=0; i < names.length; i++) {
		try {
			if (renamedBadges.containsKey(names[i])){
				names[i] = renamedBadges.get(names[i]);
			}
			if (!removedBadges.contains(names[i])){
				badges.add( Badge.valueOf( names[i] ) );
			}
		} catch (Exception e) {
			ShatteredPixelDungeon.reportException(e);
		}
	}

	return badges;
}
 
Example 3
Source File: Badges.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
private static HashSet<Badge> restore( Bundle bundle ) {
	HashSet<Badge> badges = new HashSet<Badge>();
	
	String[] names = bundle.getStringArray( BADGES );
	for (int i=0; i < names.length; i++) {
		try {
			badges.add( Badge.valueOf( names[i] ) );
		} catch (Exception e) {
		}
	}

	return badges;
}
 
Example 4
Source File: Room.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void restoreRoomsFromBundle( Bundle bundle ) {
	if (bundle.contains( ROOMS )) {
		SPECIALS.clear();
		for (String type : bundle.getStringArray( ROOMS )) {
			SPECIALS.add( Type.valueOf( type ));
		}
	} else {
		shuffleTypes();
	}
}
 
Example 5
Source File: Badges.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private static HashSet<Badge> restore( Bundle bundle ) {
	HashSet<Badge> badges = new HashSet<>();
	
	String[] names = bundle.getStringArray( BADGES );
	for (int i=0; i < names.length; i++) {
		try {
			badges.add( Badge.valueOf( names[i] ) );
		} catch (Exception e) {
		}
	}

	return badges;
}
 
Example 6
Source File: Room.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void restoreRoomsFromBundle( Bundle bundle ) {
	if (bundle.contains( ROOMS )) {
		SPECIALS.clear();
		for (String type : bundle.getStringArray( ROOMS )) {
			SPECIALS.add( Type.valueOf( type ));
		}
	} else {
		shuffleTypes();
	}
}
 
Example 7
Source File: Badges.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private static HashSet<Badge> restore( Bundle bundle ) {
	HashSet<Badge> badges = new HashSet<Badge>();
	
	String[] names = bundle.getStringArray( BADGES );
	for (int i=0; i < names.length; i++) {
		try {
			badges.add( Badge.valueOf( names[i] ) );
		} catch (Exception e) {
		}
	}

	return badges;
}
 
Example 8
Source File: Room.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void restoreRoomsFromBundle( Bundle bundle ) {
	if (bundle.contains( ROOMS )) {
		SPECIALS.clear();
		for (String type : bundle.getStringArray( ROOMS )) {
			SPECIALS.add( Type.valueOf( type ));
		}
	} else {
		shuffleTypes();
	}
}
 
Example 9
Source File: Badges.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private static HashSet<Badge> restore(Bundle bundle) {
	HashSet<Badge> badges = new HashSet<>();

	String[] names = bundle.getStringArray(BADGES);

	for (String name : names) {
           badges.add(Badge.valueOf(name));
       }
	return badges;
}
 
Example 10
Source File: QuickSlot.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void restore(Bundle bundle) {
    qsStorage.clear();
    String[] classes = bundle.getStringArray(QUICKSLOT);
    for (int i = 0; i < classes.length; i++) {
        if (!classes[i].isEmpty()) {
            if (SpellFactory.hasSpellForName(classes[i])) {
                Spell spell = SpellFactory.getSpellByName(classes[i]);
                selectItem(spell.itemForSlot(), i);
                continue;
            }
            selectItem(ItemFactory.itemByName(classes[i]).quickSlotContent(), i);
        }
    }
    refresh();
}
 
Example 11
Source File: Room.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void restoreRoomsFromBundle( Bundle bundle ) {
	if (bundle.contains( ROOMS )) {
		SPECIALS.clear();
		for (String type : bundle.getStringArray( ROOMS )) {
			SPECIALS.add( Type.valueOf( type ));
		}
	} else {
		shuffleTypes();
	}
}