本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton类的典型用法代码示例。如果您正苦于以下问题:Java ExitButton类的具体用法?Java ExitButton怎么用?Java ExitButton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExitButton类属于com.shatteredpixel.shatteredpixeldungeon.ui包,在下文中一共展示了ExitButton类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton; //导入依赖的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();
}
示例2: create
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton; //导入依赖的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();
}
示例3: create
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton; //导入依赖的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 );
}
}
};
}