Java Code Examples for com.watabou.noosa.Game#getVars()

The following examples show how to use com.watabou.noosa.Game#getVars() . 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: Utils.java    From remixed-dungeon with GNU General Public License v3.0 6 votes vote down vote up
@SneakyThrows
public static String[] getClassParams(String className, String paramName, String[] defaultValues, boolean warnIfAbsent) {

    if (className.length() == 0) { // isEmpty() require api level 9
        return defaultValues;
    }

    try {
        return Game.getVars(stringArrays.getField(className + "_" + paramName).getInt(null));
    } catch (NoSuchFieldException e) {
        if (warnIfAbsent) {
            GLog.w("no definition for  %s_%s :(", className, paramName);
        }
    }

    return defaultValues;
}
 
Example 2
Source File: Dungeon.java    From remixed-dungeon with GNU General Public License v3.0 6 votes vote down vote up
public static String tip(Level _level) {
    if (_level instanceof DeadEndLevel) {

        return Game.getVar(R.string.Dungeon_DeadEnd);

    } else {
        String[] tips = Game.getVars(R.array.Dungeon_Tips);
        int index = depth - 1;

        if (index == -1) {
            return "Welcome to test level";
        }

        if (index < tips.length) {
            return tips[index];
        } else {
            return Game.getVar(R.string.Dungeon_NoTips);
        }
    }
}
 
Example 3
Source File: WndChallenges.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public WndChallenges( int checked, boolean editable ) {
	
	super();
	
	this.editable = editable;
	
	Text title = PixelScene.createText( Game.getVar(R.string.WndChallenges_Title), GuiProperties.titleFontSize() );
	title.hardlight( TITLE_COLOR );
	title.x = PixelScene.align( camera, (WIDTH - title.width()) / 2 );
	add( title );
	
	boxes = new ArrayList<>();
	
	float pos = title.height() + GAP;
	final String[] challenges = Game.getVars(R.array.Challenges_Names);

	for (int i=0; i < Challenges.MASKS.length; i++) {

		CheckBox cb = new CheckBox( challenges[i] );
		cb.checked( (checked & Challenges.MASKS[i]) != 0 );
		cb.active = editable;

		if (i > 0) {
			pos += GAP;
		}
		cb.setRect( 0, pos, WIDTH, BUTTON_HEIGHT );
		pos = cb.bottom();
		
		add( cb );
		boxes.add( cb );
	}
	
	resize( WIDTH, (int)pos );
}
 
Example 4
Source File: Codex.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private int getCodexId()
{
	int maxId = Game.getVars(R.array.Codex_Story).length;
	if(codexId < 0) {
		codexId = Random.Int(maxId);
	}

	if(codexId > maxId-1) {
		codexId = 0;
	}

	return codexId;
}
 
Example 5
Source File: Scroll.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public Scroll() {
	stackable     = true;
	setDefaultAction(CommonActions.AC_READ);
	
	if (this instanceof BlankScroll){
		return;
	}

	image = handler.index( this );
	rune  = Game.getVars(R.array.Scroll_Runes)[ItemStatusHandler.indexByImage(image,images)];
}
 
Example 6
Source File: Wand.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public Wand() {
	setDefaultAction(AC_ZAP);
	animation_class = WAND_ATTACK;
	
	try {
		image = handler.index(this);
		wood = Game.getVars(R.array.Wand_Wood_Types)[ItemStatusHandler.indexByImage(image,images)];

	} catch (Exception e) {
		// Wand of Magic Missile or Wand of Icebolt
	}
}
 
Example 7
Source File: Char.java    From remixed-dungeon with GNU General Public License v3.0 4 votes vote down vote up
public String defenseVerb() {
	if (defenceVerb != null) {
		return defenceVerb;
	}
	return Game.getVars(R.array.Char_StaDodged)[gender];
}
 
Example 8
Source File: Ring.java    From remixed-dungeon with GNU General Public License v3.0 4 votes vote down vote up
public void syncGem() {
	image = handler.index( this );
	gem   = Game.getVars(R.array.Ring_Gems)[ItemStatusHandler.indexByImage(image,images)];
}
 
Example 9
Source File: Potion.java    From remixed-dungeon with GNU General Public License v3.0 4 votes vote down vote up
public Potion() {
	image = handler.index( this );
	color = Game.getVars(R.array.Potion_Colors)[ItemStatusHandler.indexByImage(image,images)];
}