当前位置: 首页>>代码示例>>Java>>正文


Java Window类代码示例

本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.ui.Window的典型用法代码示例。如果您正苦于以下问题:Java Window类的具体用法?Java Window怎么用?Java Window使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Window类属于com.shatteredpixel.shatteredpixeldungeon.ui包,在下文中一共展示了Window类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: WndChanges

import com.shatteredpixel.shatteredpixeldungeon.ui.Window; //导入依赖的package包/类
public WndChanges() {
    super();
    resize( WIDTH, HEIGHT );

    txtTitle = PixelScene.createText(TXT_TITLE, 9);
    txtTitle.hardlight( Window.SHPX_COLOR );
    txtTitle.measure();
    txtTitle.x = PixelScene.align( PixelScene.uiCamera, (WIDTH - txtTitle.width()) / 2 );
    add( txtTitle );

    BitmapTextMultiline txtChanges = PixelScene.createMultiline(TXT_CHANGES, 9);

    Component content = new Component();

    content.add(txtChanges);

    text = new ScrollPane( content ) {

    };
    add( text );
    text.setRect( 0, txtTitle.height(), WIDTH, HEIGHT - txtTitle.height() );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:23,代码来源:WndChanges.java

示例2: WndInfoBuff

import com.shatteredpixel.shatteredpixeldungeon.ui.Window; //导入依赖的package包/类
public WndInfoBuff(Buff buff){
	super();

	IconTitle titlebar = new IconTitle();

	icons = TextureCache.get( Assets.BUFFS_LARGE );
	film = new TextureFilm( icons, 16, 16 );

	Image buffIcon = new Image( icons );
	buffIcon.frame( film.get(buff.icon()) );
	buff.tintIcon(buffIcon);

	titlebar.icon( buffIcon );
	titlebar.label( Messages.titleCase(buff.toString()), Window.TITLE_COLOR );
	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );

	RenderedTextMultiline txtInfo = PixelScene.renderMultiline(buff.desc(), 6);
	txtInfo.maxWidth(WIDTH);
	txtInfo.setPos(titlebar.left(), titlebar.bottom() + GAP);
	add( txtInfo );

	resize( WIDTH, (int)(txtInfo.top() + txtInfo.height()) );
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:25,代码来源:WndInfoBuff.java

示例3: createChildren

import com.shatteredpixel.shatteredpixeldungeon.ui.Window; //导入依赖的package包/类
@Override
protected void createChildren() {
	imIcon = new Image();
	add( imIcon );
	
	tfLabel = PixelScene.createMultiline( FONT_SIZE );
	tfLabel.hardlight( Window.TITLE_COLOR );
	add( tfLabel );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:10,代码来源:IconTitle.java

示例4: WndJournal

import com.shatteredpixel.shatteredpixeldungeon.ui.Window; //导入依赖的package包/类
public WndJournal() {
	
	super();
	resize( WIDTH, HEIGHT );
	
	txtTitle = PixelScene.createText( TXT_TITLE, 9 );
	txtTitle.hardlight( Window.TITLE_COLOR );
	txtTitle.measure();
	txtTitle.x = PixelScene.align( PixelScene.uiCamera, (WIDTH - txtTitle.width()) / 2 );
	add( txtTitle );
	
	Component content = new Component();
	
	Collections.sort( Journal.records );
	
	float pos = 0;
	for (Journal.Record rec : Journal.records) {
		ListItem item = new ListItem( rec.feature, rec.depth );
		item.setRect( 0, pos, WIDTH, ITEM_HEIGHT );
		content.add( item );
		
		pos += item.height();
	}
	
	content.setSize( WIDTH, pos );
	
	list = new ScrollPane( content );
	add( list );
	
	list.setRect( 0, txtTitle.height(), WIDTH, HEIGHT - txtTitle.height() );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:32,代码来源:WndJournal.java

示例5: createChildren

import com.shatteredpixel.shatteredpixeldungeon.ui.Window; //导入依赖的package包/类
@Override
protected void createChildren() {
	imIcon = new Image();
	add( imIcon );

	tfLabel = PixelScene.renderMultiline( (int)FONT_SIZE );
	tfLabel.hardlight( Window.TITLE_COLOR );
	add( tfLabel );

	health = new HealthBar();
	add( health );
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:13,代码来源:IconTitle.java

示例6: StatsTab

import com.shatteredpixel.shatteredpixeldungeon.ui.Window; //导入依赖的package包/类
public StatsTab() {
	
	Hero hero = Dungeon.hero;

	IconTitle title = new IconTitle();
	title.icon( HeroSprite.avatar(hero.heroClass, hero.tier()) );
	if (hero.givenName().equals(hero.className()))
		title.label( Messages.get(this, "title", hero.lvl, hero.className() ).toUpperCase( Locale.ENGLISH ) );
	else
		title.label((hero.givenName() + "\n" + Messages.get(this, "title", hero.lvl, hero.className())).toUpperCase(Locale.ENGLISH));
	title.color(Window.SHPX_COLOR);
	title.setRect( 0, 0, WIDTH, 0 );
	add(title);

	pos = title.bottom() + 2*GAP;

	statSlot( Messages.get(this, "str"), hero.STR() );
	if (hero.SHLD > 0) statSlot( Messages.get(this, "health"), hero.HP + "+" + hero.SHLD + "/" + hero.HT );
	else statSlot( Messages.get(this, "health"), (hero.HP) + "/" + hero.HT );
	statSlot( Messages.get(this, "exp"), hero.exp + "/" + hero.maxExp() );

	pos += GAP;

	statSlot( Messages.get(this, "gold"), Statistics.goldCollected );
	statSlot( Messages.get(this, "depth"), Statistics.deepestFloor );

	pos += GAP;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:29,代码来源:WndHero.java

示例7: create

import com.shatteredpixel.shatteredpixeldungeon.ui.Window; //导入依赖的package包/类
@Override
public void create() {
	
	super.create();
	
	Music.INSTANCE.play( Assets.THEME, true );
	Music.INSTANCE.volume( 1f );
	
	uiCamera.visible = false;
	
	int w = Camera.main.width;
	int h = Camera.main.height;
	
	archs = new Archs();
	archs.setSize( w, h );
	add( archs );
	
	Rankings.INSTANCE.load();

	BitmapText title = PixelScene.createText(TXT_TITLE, 9);
	title.hardlight(Window.SHPX_COLOR);
	title.measure();
	title.x = align((w - title.width()) / 2);
	title.y = align( GAP );
	add(title);
	
	if (Rankings.INSTANCE.records.size() > 0) {
		
		float left = (w - Math.min( 160, w )) / 2 + GAP;
		float top = align( (h - ROW_HEIGHT  * Rankings.INSTANCE.records.size()) / 2 );
		
		int pos = 0;
		
		for (Rankings.Record rec : Rankings.INSTANCE.records) {
			Record row = new Record( pos, pos == Rankings.INSTANCE.lastRecord, rec );
			row.setRect( left, top + pos * ROW_HEIGHT, w - left * 2, ROW_HEIGHT );
			add( row );
			
			pos++;
		}
		
		if (Rankings.INSTANCE.totalNumber >= Rankings.TABLE_SIZE) {
			BitmapText total = PixelScene.createText( Utils.format( TXT_TOTAL, Rankings.INSTANCE.totalNumber ), 8 );
			total.hardlight( Window.TITLE_COLOR );
			total.measure();
			total.x = align( (w - total.width()) / 2 );
			total.y = align( top + pos * ROW_HEIGHT + GAP );
			add( total );
		}
		
	} else {

		BitmapText noRec = PixelScene.createText(TXT_NO_GAMES, 8);
		noRec.hardlight(Window.TITLE_COLOR);
		noRec.measure();
		noRec.x = align((w - noRec.width()) / 2);
		noRec.y = align((h - noRec.height()) / 2);
		add(noRec);
		
	}

       ExitButton btnExit = new ExitButton();
       btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
       add( btnExit );

	fadeIn();
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:68,代码来源:RankingsScene.java

示例8: show

import com.shatteredpixel.shatteredpixeldungeon.ui.Window; //导入依赖的package包/类
public static void show( Window wnd ) {
	cancelCellSelector();
	scene.add( wnd );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:5,代码来源:GameScene.java

示例9: create

import com.shatteredpixel.shatteredpixeldungeon.ui.Window; //导入依赖的package包/类
@Override
public void create() {
	
	super.create();
	
	Music.INSTANCE.play( Assets.THEME, true );
	Music.INSTANCE.volume( 1f );
	
	uiCamera.visible = false;
	
	int w = Camera.main.width;
	int h = Camera.main.height;
	
	Archs archs = new Archs();
	archs.setSize( w, h );
	add( archs );
	
	int pw = Math.min( 160, w - 6 );
	int ph = h - 30;
	
	NinePatch panel = Chrome.get( Chrome.Type.WINDOW );
	panel.size( pw, ph );
	panel.x = (w - pw) / 2;
	panel.y = (h - ph) / 2;
	add( panel );
	
	BitmapText title = PixelScene.createText( TXT_TITLE, 9 );
	title.hardlight( Window.TITLE_COLOR );
	title.measure();
	title.x = align( (w - title.width()) / 2 );
	title.y = align( (panel.y - title.baseLine()) / 2 );
	add( title );
	
	Badges.loadGlobal();
	
	ScrollPane list = new BadgesList( true );
	add( list );
	
	list.setRect( 
		panel.x + panel.marginLeft(), 
		panel.y + panel.marginTop(), 
		panel.innerWidth(), 
		panel.innerHeight() );

       ExitButton btnExit = new ExitButton();
       btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
       add( btnExit );
	
	fadeIn();
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:51,代码来源:BadgesScene.java

示例10: StatsTab

import com.shatteredpixel.shatteredpixeldungeon.ui.Window; //导入依赖的package包/类
public StatsTab() {
	super();
	
	String heroClass = Dungeon.hero.className();
	
	IconTitle title = new IconTitle();
	title.icon( HeroSprite.avatar( Dungeon.hero.heroClass, Dungeon.hero.tier() ) );
	title.label( Utils.format( TXT_TITLE, Dungeon.hero.lvl, heroClass ).toUpperCase( Locale.ENGLISH ) );
          title.color(Window.SHPX_COLOR);
	title.setRect( 0, 0, WIDTH, 0 );
	add( title );
	
	float pos = title.bottom();

          if (Dungeon.challenges > 0) {
              RedButton btnCatalogus = new RedButton( TXT_CHALLENGES ) {
                  @Override
                  protected void onClick() {
                      Game.scene().add( new WndChallenges( Dungeon.challenges, false ) );
                  }
              };
              btnCatalogus.setRect( 0, pos + GAP, btnCatalogus.reqWidth() + 2, btnCatalogus.reqHeight() + 2 );
              add( btnCatalogus );

              pos = btnCatalogus.bottom();
          }

          pos += GAP + GAP;
	
	pos = statSlot( this, TXT_STR, Integer.toString( Dungeon.hero.STR ), pos );
	pos = statSlot( this, TXT_HEALTH, Integer.toString( Dungeon.hero.HT ), pos );
	
	pos += GAP;
	
	pos = statSlot( this, TXT_DURATION, Integer.toString( (int)Statistics.duration ), pos );
	
	pos += GAP;
	
	pos = statSlot( this, TXT_DEPTH, Integer.toString( Statistics.deepestFloor ), pos );
	pos = statSlot( this, TXT_ENEMIES, Integer.toString( Statistics.enemiesSlain ), pos );
	pos = statSlot( this, TXT_GOLD, Integer.toString( Statistics.goldCollected ), pos );
	
	pos += GAP;
	
	pos = statSlot( this, TXT_FOOD, Integer.toString( Statistics.foodEaten ), pos );
	pos = statSlot( this, TXT_ALCHEMY, Integer.toString( Statistics.potionsCooked ), pos );
	pos = statSlot( this, TXT_ANKHS, Integer.toString( Statistics.ankhsUsed ), pos );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:49,代码来源:WndRanking.java

示例11: StatsTab

import com.shatteredpixel.shatteredpixeldungeon.ui.Window; //导入依赖的package包/类
public StatsTab() {
	
	Hero hero = Dungeon.hero;

          IconTitle title = new IconTitle();
          title.icon( HeroSprite.avatar(hero.heroClass, hero.tier()) );
          title.label(Utils.format( TXT_TITLE, hero.lvl, hero.className() ).toUpperCase( Locale.ENGLISH ), 9);
          title.color(Window.SHPX_COLOR);
          title.setRect( 0, 0, WIDTH, 0 );
	add(title);

	RedButton btnCatalogus = new RedButton( TXT_CATALOGUS ) {
		@Override
		protected void onClick() {
			hide();
			GameScene.show( new WndCatalogus() );
		}
	};
	btnCatalogus.setRect( 0, title.height(), btnCatalogus.reqWidth() + 2, btnCatalogus.reqHeight() + 2 );
	add( btnCatalogus );

	RedButton btnJournal = new RedButton( TXT_JOURNAL ) {
		@Override
		protected void onClick() {
			hide();
			GameScene.show( new WndJournal() );
		}
	};
	btnJournal.setRect(
		btnCatalogus.right() + 1, btnCatalogus.top(),
		btnJournal.reqWidth() + 2, btnJournal.reqHeight() + 2 );
	add( btnJournal );

	pos = btnCatalogus.bottom() + GAP;

	statSlot( TXT_STR, hero.STR() );
	statSlot( TXT_HEALTH, hero.HP + "/" + hero.HT );
	statSlot( TXT_EXP, hero.exp + "/" + hero.maxExp() );

	pos += GAP;

	statSlot( TXT_GOLD, Statistics.goldCollected );
	statSlot( TXT_DEPTH, Statistics.deepestFloor );

	pos += GAP;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:47,代码来源:WndHero.java

示例12: show

import com.shatteredpixel.shatteredpixeldungeon.ui.Window; //导入依赖的package包/类
public static void show( Window wnd ) {
	if (scene != null) {
		cancelCellSelector();
		scene.addToFront(wnd);
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:7,代码来源:GameScene.java

示例13: create

import com.shatteredpixel.shatteredpixeldungeon.ui.Window; //导入依赖的package包/类
@Override
public void create() {

	super.create();

	Music.INSTANCE.play( Assets.THEME, true );

	uiCamera.visible = false;

	int w = Camera.main.width;
	int h = Camera.main.height;

	Archs archs = new Archs();
	archs.setSize( w, h );
	add( archs );

	float left = 5;
	float top = 15;

	RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9 );
	title.hardlight(Window.TITLE_COLOR);
	title.x = (w - title.width()) / 2 ;
	title.y = (top - title.baseLine()) / 2 ;
	align(title);
	add(title);

	Badges.loadGlobal();

	List<Badges.Badge> badges = Badges.filtered( true );

	int blankBadges = 34;
	blankBadges -= badges.size();
	if (badges.contains(Badges.Badge.ALL_ITEMS_IDENTIFIED))	blankBadges -= 6;
	if (badges.contains(Badges.Badge.YASD)) 				blankBadges -= 5;
	blankBadges = Math.max(0, blankBadges);

	//guarantees a max of 5 rows in landscape, and 8 in portrait, assuming a max of 40 buttons
	int nCols = ShatteredPixelDungeon.landscape() ? 7 : 4;
	if (badges.size() + blankBadges > 32 && !ShatteredPixelDungeon.landscape())	nCols++;

	int nRows = 1 + (blankBadges + badges.size())/nCols;

	float badgeWidth = (w - 2*left)/nCols;
	float badgeHeight = (h - 2*top)/nRows;

	for (int i = 0; i < badges.size() + blankBadges; i++){
		int row = i / nCols;
		int col = i % nCols;
		Badges.Badge b = i < badges.size() ? badges.get( i ) : null;
		BadgeButton button = new BadgeButton( b );
		button.setPos(
				left + col * badgeWidth + (badgeWidth - button.width()) / 2,
				top + row * badgeHeight + (badgeHeight - button.height()) / 2);
		align(button);
		add( button );
	}

	ExitButton btnExit = new ExitButton();
	btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
	add( btnExit );

	fadeIn();

	Badges.loadingListener = new Callback() {
		@Override
		public void call() {
			if (Game.scene() == BadgesScene.this) {
				ShatteredPixelDungeon.switchNoFade( BadgesScene.class );
			}
		}
	};
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:73,代码来源:BadgesScene.java

示例14: StatsTab

import com.shatteredpixel.shatteredpixeldungeon.ui.Window; //导入依赖的package包/类
public StatsTab() {
	super();

	if (Dungeon.challenges > 0) GAP--;
	
	String heroClass = Dungeon.hero.className();
	
	IconTitle title = new IconTitle();
	title.icon( HeroSprite.avatar( Dungeon.hero.heroClass, Dungeon.hero.tier() ) );
	title.label( Messages.get(this, "title", Dungeon.hero.lvl, heroClass ).toUpperCase( Locale.ENGLISH ) );
	title.color(Window.SHPX_COLOR);
	title.setRect( 0, 0, WIDTH, 0 );
	add( title );
	
	float pos = title.bottom();

	if (Dungeon.challenges > 0) {
		RedButton btnCatalogus = new RedButton( Messages.get(this, "challenges") ) {
			@Override
			protected void onClick() {
				Game.scene().add( new WndChallenges( Dungeon.challenges, false ) );
			}
		};
		btnCatalogus.setRect( 0, pos, btnCatalogus.reqWidth() + 2, btnCatalogus.reqHeight() + 2 );
		add( btnCatalogus );

		pos = btnCatalogus.bottom();
	}

	pos += GAP + GAP;
	
	pos = statSlot( this, Messages.get(this, "str"), Integer.toString( Dungeon.hero.STR ), pos );
	pos = statSlot( this, Messages.get(this, "health"), Integer.toString( Dungeon.hero.HT ), pos );
	
	pos += GAP;
	
	pos = statSlot( this, Messages.get(this, "duration"), Integer.toString( (int)Statistics.duration ), pos );
	
	pos += GAP;
	
	pos = statSlot( this, Messages.get(this, "depth"), Integer.toString( Statistics.deepestFloor ), pos );
	pos = statSlot( this, Messages.get(this, "enemies"), Integer.toString( Statistics.enemiesSlain ), pos );
	pos = statSlot( this, Messages.get(this, "gold"), Integer.toString( Statistics.goldCollected ), pos );
	
	pos += GAP;
	
	pos = statSlot( this, Messages.get(this, "food"), Integer.toString( Statistics.foodEaten ), pos );
	pos = statSlot( this, Messages.get(this, "alchemy"), Integer.toString( Statistics.potionsCooked ), pos );
	pos = statSlot( this, Messages.get(this, "ankhs"), Integer.toString( Statistics.ankhsUsed ), pos );
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:51,代码来源:WndRanking.java

示例15: StatsTab

import com.shatteredpixel.shatteredpixeldungeon.ui.Window; //导入依赖的package包/类
public StatsTab() {
	super();
	
	if (Dungeon.challenges > 0) GAP--;
	
	String heroClass = Dungeon.hero.className();
	
	IconTitle title = new IconTitle();
	title.icon( HeroSprite.avatar( Dungeon.hero.heroClass, Dungeon.hero.tier() ) );
	title.label( Messages.get(this, "title", Dungeon.hero.lvl, heroClass ).toUpperCase( Locale.ENGLISH ) );
	title.color(Window.SHPX_COLOR);
	title.setRect( 0, 0, WIDTH, 0 );
	add( title );
	
	float pos = title.bottom();

	if (Dungeon.challenges > 0) {
		RedButton btnCatalogus = new RedButton( Messages.get(this, "challenges") ) {
			@Override
			protected void onClick() {
				Game.scene().add( new WndChallenges( Dungeon.challenges, false ) );
			}
		};
		btnCatalogus.setRect( 0, pos, btnCatalogus.reqWidth() + 2, btnCatalogus.reqHeight() + 2 );
		add( btnCatalogus );

		pos = btnCatalogus.bottom();
	}

	pos += GAP + GAP;
	
	pos = statSlot( this, Messages.get(this, "str"), Integer.toString( Dungeon.hero.STR ), pos );
	pos = statSlot( this, Messages.get(this, "health"), Integer.toString( Dungeon.hero.HT ), pos );
	
	pos += GAP;
	
	pos = statSlot( this, Messages.get(this, "duration"), Integer.toString( (int)Statistics.duration ), pos );
	
	pos += GAP;
	
	pos = statSlot( this, Messages.get(this, "depth"), Integer.toString( Statistics.deepestFloor ), pos );
	pos = statSlot( this, Messages.get(this, "enemies"), Integer.toString( Statistics.enemiesSlain ), pos );
	pos = statSlot( this, Messages.get(this, "gold"), Integer.toString( Statistics.goldCollected ), pos );
	
	pos += GAP;
	
	pos = statSlot( this, Messages.get(this, "food"), Integer.toString( Statistics.foodEaten ), pos );
	pos = statSlot( this, Messages.get(this, "alchemy"), Integer.toString( Statistics.potionsCooked ), pos );
	pos = statSlot( this, Messages.get(this, "ankhs"), Integer.toString( Statistics.ankhsUsed ), pos );
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon-gdx,代码行数:51,代码来源:WndRanking.java


注:本文中的com.shatteredpixel.shatteredpixeldungeon.ui.Window类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。