com.watabou.noosa.Group Java Examples

The following examples show how to use com.watabou.noosa.Group. 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: WndRanking.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 6 votes vote down vote up
private void createControls() {
	
	String[] labels =
		{
                   TXT_STATS,
                   TXT_ITEMS,
                   TXT_BADGES,
           };
	Group[] pages =
		{
                   new StatsTab(),
                   new ItemsTab(),
                   new BadgesTab(),
           };

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

		add( pages[i] );

		Tab tab = new RankingTab( labels[i], pages[i] );
		tab.setSize( TAB_WIDTH, tabHeight() );
		add( tab );
	}

	select( 0 );
}
 
Example #2
Source File: WndDonate.java    From remixed-dungeon with GNU General Public License v3.0 6 votes vote down vote up
public WndDonate() {
	EventCollector.logScene(getClass().getCanonicalName());

	resize(WndHelper.getFullscreenWidth(), WndHelper.getFullscreenHeight() - tabHeight() - 2*GAP);

	String[] labels = {
			Game.getVar(R.string.WndDonate_silver),
			Game.getVar(R.string.WndDonate_gold),
			Game.getVar(R.string.WndDonate_ruby),
			Game.getVar(R.string.WndDonate_royal)
	};
	Group[] pages = { new DonateTab(1), new DonateTab(2), new DonateTab(3), new DonateTab(4) };

	for (int i = 0; i < pages.length; i++) {
		add(pages[i]);

		Tab tab = new RankingTab(this, labels[i], pages[i]);
		tab.setSize(width/pages.length, tabHeight());
		add(tab);
	}

	select(2);
}
 
Example #3
Source File: QuickRecipe.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onClick() {
	super.onClick();
	
	//find the window this is inside of and close it
	Group parent = this.parent;
	while (parent != null){
		if (parent instanceof Window){
			((Window) parent).hide();
			break;
		} else {
			parent = parent.parent;
		}
	}
	
	((AlchemyScene)ShatteredPixelDungeon.scene()).populate(ingredients, Dungeon.hero.belongings);
}
 
Example #4
Source File: WndRanking.java    From pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
private void createControls() {
	
	String[] labels = 
		{TXT_STATS, TXT_ITEMS, TXT_BADGES};
	Group[] pages = 
		{new StatsTab(), new ItemsTab(), new BadgesTab()};
	
	for (int i=0; i < pages.length; i++) {
		
		add( pages[i] );
		
		Tab tab = new RankingTab( labels[i], pages[i] );
		tab.setSize( TAB_WIDTH, tabHeight() );
		add( tab );
	}
	
	select( 0 );
}
 
Example #5
Source File: Wound.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void hit( int pos, float angle ) {
	Group parent = Dungeon.hero.sprite.parent;
	Wound w = (Wound)parent.recycle( Wound.class );
	parent.bringToFront( w );
	w.reset( pos );
	w.angle = angle;
}
 
Example #6
Source File: CircleArc.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
public CircleArc show(Group parent, PointF pos, float duration ) {
	point( pos );
	parent.add( this );
	
	lifespan = this.duration = duration;
	
	return this;
}
 
Example #7
Source File: Surprise.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void hit(int pos, float angle) {
	Group parent = Dungeon.hero.sprite.parent;
	Surprise s = (Surprise) parent.recycle(Surprise.class);
	parent.bringToFront(s);
	s.reset(pos);
	s.angle = angle;
}
 
Example #8
Source File: Flare.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
public Flare show( Group parent, PointF pos, float duration ) {
	point( pos );
	parent.add( this );

	lifespan = this.duration = duration;
	if (lifespan > 0) scale.set( 0 );

	return this;
}
 
Example #9
Source File: Wound.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void hit( int pos, float angle ) {
	Group parent = Dungeon.hero.sprite.parent;
	Wound w = (Wound)parent.recycle( Wound.class );
	parent.bringToFront( w );
	w.reset( pos );
	w.angle = angle;
}
 
Example #10
Source File: WndRanking.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private float statSlot( Group parent, String label, String value, float pos ) {
	
	BitmapText txt = PixelScene.createText( label, 7 );
	txt.y = pos;
	parent.add( txt );
	
	txt = PixelScene.createText( value, 7 );
	txt.measure();
	txt.x = PixelScene.align( WIDTH * 0.65f );
	txt.y = pos;
	parent.add( txt );
	
	return pos + GAP + txt.baseLine();
}
 
Example #11
Source File: Wound.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
public static void hit( int pos, float angle ) {
	Group parent = Dungeon.hero.sprite.parent;
	Wound w = (Wound)parent.recycle( Wound.class );
	parent.bringToFront( w );
	w.reset( pos );
	w.angle = angle;
}
 
Example #12
Source File: CavesLevel.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
public static void addCavesVisuals( Level level, Group group ) {
	for (int i=0; i < level.length(); i++) {
		if (level.map[i] == Terrain.WALL_DECO) {
			group.add( new Vein( i ) );
		}
	}
}
 
Example #13
Source File: Window.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public void hide() {
	Group parent = getParent();
	if(parent!=null) {
		parent.remove(this);
	}
	destroy();
}
 
Example #14
Source File: HallsLevel.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
public static void addHallsVisuals( Level level, Group group ) {
	for (int i=0; i < level.length(); i++) {
		if (level.map[i] == Terrain.WATER) {
			group.add( new Stream( i ) );
		}
	}
}
 
Example #15
Source File: Surprise.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
public static void hit(int pos, float angle) {
	Group parent = Dungeon.hero.sprite.parent;
	Surprise s = (Surprise) parent.recycle(Surprise.class);
	parent.bringToFront(s);
	s.reset(pos);
	s.angle = angle;
}
 
Example #16
Source File: Surprise.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void hit(int pos, float angle) {
	Group parent = Dungeon.hero.sprite.parent;
	Wound w = (Wound) parent.recycle(Wound.class);
	parent.bringToFront(w);
	w.reset(pos);
	w.angle = angle;
}
 
Example #17
Source File: WndRanking.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private float statSlot( Group parent, String label, String value, float pos ) {
	
	BitmapText txt = PixelScene.createText( label, 7 );
	txt.y = pos;
	parent.add( txt );
	
	txt = PixelScene.createText( value, 7 );
	txt.measure();
	txt.x = PixelScene.align( WIDTH * 0.65f );
	txt.y = pos;
	parent.add( txt );
	
	return pos + GAP + txt.baseLine();
}
 
Example #18
Source File: PrisonLevel.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
public static void addPrisonVisuals(Level level, Group group){
	for (int i=0; i < level.length(); i++) {
		if (level.map[i] == Terrain.WALL_DECO) {
			group.add( new Torch( i ) );
		}
	}
}
 
Example #19
Source File: CircleArc.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public CircleArc show(Group parent, PointF pos, float duration ) {
	point( pos );
	parent.add( this );
	
	lifespan = this.duration = duration;
	
	return this;
}
 
Example #20
Source File: Wound.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void hit( int pos, float angle ) {
	Group parent = Dungeon.hero.sprite.parent;
	Wound w = (Wound)parent.recycle( Wound.class );
	parent.bringToFront( w );
	w.reset( pos );
	w.angle = angle;
}
 
Example #21
Source File: Flare.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public Flare show( Group parent, PointF pos, float duration ) {
	point( pos );
	parent.add( this );

	lifespan = this.duration = duration;
	if (lifespan > 0) scale.set( 0 );

	return this;
}
 
Example #22
Source File: SewerBossLevel.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Group addVisuals() {
	super.addVisuals();
	if (map[exit-1] != Terrain.WALL_DECO) visuals.add(new PrisonLevel.Torch(exit-1));
	if (map[exit+1] != Terrain.WALL_DECO) visuals.add(new PrisonLevel.Torch(exit+1));
	return visuals;
}
 
Example #23
Source File: ZapEffect.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
static public void play(Group parent, int pos, String effect) {
    Level level = Dungeon.level;
    if (effect != null && level.cellValid(pos)) {

        if (!Dungeon.visible[pos]) {
            return;
        }

        if (EffectsFactory.isValidEffectName(effect)) {
            GameScene.clipEffect(pos, 1, effect);
            return;
        }

        val emitter = CellEmitter.get(pos);

        if (effect.equals("Bones")) {
            emitter.burst( Speck.factory( Speck.BONE ), 6 );
        }

        if(effect.equals("Succubus")) {
            emitter.burst( Speck.factory( Speck.HEART ), 6 );
            emitter.burst( ShadowParticle.UP, 8 );
        }

        if(effect.equals("Golem")) {
            emitter.burst( ElmoParticle.FACTORY, 4 );
        }
    }
}
 
Example #24
Source File: WndRanking.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
private float statSlot( Group parent, String label, String value, float pos ) {
	
	RenderedTextBlock txt = PixelScene.renderTextBlock( label, 7 );
	txt.setPos(0, pos);
	parent.add( txt );
	
	txt = PixelScene.renderTextBlock( value, 7 );
	txt.setPos(WIDTH * 0.7f, pos);
	PixelScene.align(txt);
	parent.add( txt );
	
	return pos + GAP + txt.height();
}
 
Example #25
Source File: SewerLevel.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void addSewerVisuals( Level level, Group group ) {
	for (int i=0; i < level.length(); i++) {
		if (level.map[i] == Terrain.WALL_DECO) {
			group.add( new Sink( i ) );
		}
	}
}
 
Example #26
Source File: MagicMissile.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 4 votes vote down vote up
public static void blast( Group group, int from, int to, Callback callback ) {
	MagicMissile missile = ((MagicMissile)group.recycle( MagicMissile.class ));
	missile.reset( from, to, callback );
	missile.size( 2 );
	missile.pour( Speck.factory( Speck.BLAST ), 0.02f );
}
 
Example #27
Source File: CityLevel.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Group addVisuals() {
	super.addVisuals();
	addCityVisuals( this, visuals );
	return visuals;
}
 
Example #28
Source File: MagicMissile.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 4 votes vote down vote up
public static void purpleLight( Group group, int from, int to, Callback callback ) {
	MagicMissile missile = ((MagicMissile)group.recycle( MagicMissile.class ));
	missile.reset( from, to, callback );
	missile.size( 2 );
	missile.pour( PurpleParticle.MISSILE, 0.01f );
}
 
Example #29
Source File: AboutScene.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
private void addLine( float y, Group content ){
	ColorBlock line = new ColorBlock(Camera.main.width, 1, 0xFF333333);
	line.y = y;
	content.add(line);
}
 
Example #30
Source File: WndClass.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
public RankingTab( String label, Group page ) {
	super( label );
	this.page = page;
}