本文整理汇总了Java中com.watabou.pixeldungeon.ui.RedButton类的典型用法代码示例。如果您正苦于以下问题:Java RedButton类的具体用法?Java RedButton怎么用?Java RedButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RedButton类属于com.watabou.pixeldungeon.ui包,在下文中一共展示了RedButton类的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createAssetsSelector
点赞 3
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
private void createAssetsSelector(final String assetKind, final String assetName) {
RedButton btn = new RedButton(assetName) {
@Override
protected void onClick() {
PixelDungeon.scene().add(
new WndOptions(assetName, "", STD, SILVER,
GOLD, RUBY) {
@Override
protected void onSelect(int index) {
if (PixelDungeon.donated() >= index) {
Assets.use(assetKind, index);
PixelDungeon.scene().add(
new WndMessage("ok!"));
} else {
PixelDungeon.scene().add(
new WndMessage(NOT_AVALIABLE));
}
}
});
}
};
btn.setRect(0, curBottom, WIDTH, BUTTON_HEIGHT);
add(btn);
curBottom += BUTTON_HEIGHT + GAP;
}
开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:27,
代码来源:WndPremiumSettings.java
示例2: WndImp
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndImp( final Imp imp, final DwarfToken tokens ) {
super();
IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite( tokens.image(), null ) );
titlebar.label( Utils.capitalize( tokens.name() ) );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
BitmapTextMultiline message = PixelScene.createMultiline( TXT_MESSAGE, 6 );
message.maxWidth = WIDTH;
message.measure();
message.y = titlebar.bottom() + GAP;
add( message );
RedButton btnReward = new RedButton( TXT_REWARD ) {
@Override
protected void onClick() {
takeReward( imp, tokens, Imp.Quest.reward );
}
};
btnReward.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT );
add( btnReward );
resize( WIDTH, (int)btnReward.bottom() );
}
开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:28,
代码来源:WndImp.java
示例3: addButtons
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
private void addButtons( RedButton btn1, RedButton btn2 ) {
add( btn1 );
btn1.setRect( 0, pos > 0 ? pos += GAP : 0, (WIDTH - GAP) / 2, BTN_HEIGHT );
add( btn2 );
btn2.setRect( btn1.right() + GAP, btn1.top(), WIDTH - btn1.right() - GAP, BTN_HEIGHT );
pos += BTN_HEIGHT;
}
开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:8,
代码来源:WndGame.java
示例4: WndTradeItem
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndTradeItem( final Heap heap, boolean canBuy ) {
super();
Item item = heap.peek();
float pos = createDescription( item, true );
int price = price( item );
if (canBuy) {
RedButton btnBuy = new RedButton( Utils.format( TXT_BUY, price ) ) {
@Override
protected void onClick() {
hide();
buy( heap );
}
};
btnBuy.setRect( 0, pos + GAP, WIDTH, BTN_HEIGHT );
btnBuy.enable( price <= Dungeon.gold );
add( btnBuy );
RedButton btnCancel = new RedButton( TXT_CANCEL ) {
@Override
protected void onClick() {
hide();
}
};
btnCancel.setRect( 0, btnBuy.bottom() + GAP, WIDTH, BTN_HEIGHT );
add( btnCancel );
resize( WIDTH, (int)btnCancel.bottom() );
} else {
resize( WIDTH, (int)pos );
}
}
开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:41,
代码来源:WndTradeItem.java
示例5: WndOptions
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndOptions( String title, String message, String... options ) {
super();
BitmapTextMultiline tfTitle = PixelScene.createMultiline( title, 9 );
tfTitle.hardlight( TITLE_COLOR );
tfTitle.x = tfTitle.y = MARGIN;
tfTitle.maxWidth = WIDTH - MARGIN * 2;
tfTitle.measure();
add( tfTitle );
BitmapTextMultiline tfMesage = PixelScene.createMultiline( message, 8 );
tfMesage.maxWidth = WIDTH - MARGIN * 2;
tfMesage.measure();
tfMesage.x = MARGIN;
tfMesage.y = tfTitle.y + tfTitle.height() + MARGIN;
add( tfMesage );
float pos = tfMesage.y + tfMesage.height() + MARGIN;
for (int i=0; i < options.length; i++) {
final int index = i;
RedButton btn = new RedButton( options[i] ) {
@Override
protected void onClick() {
hide();
onSelect( index );
}
};
btn.setRect( MARGIN, pos, WIDTH - MARGIN * 2, BUTTON_HEIGHT );
add( btn );
pos += BUTTON_HEIGHT + MARGIN;
}
resize( WIDTH, (int)pos );
}
开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:37,
代码来源:WndOptions.java
示例6: WndChooseWay
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndChooseWay( final TomeOfMastery tome, final HeroSubClass way1, final HeroSubClass way2 ) {
super();
final String TXT_MASTERY = "Which way will you follow?";
final String TXT_CANCEL = "I'll decide later";
float bottom = createCommonStuff( tome, way1.desc() + "\n\n" + way2.desc() + "\n\n" + TXT_MASTERY );
RedButton btnWay1 = new RedButton( Utils.capitalize( way1.title() ) ) {
@Override
protected void onClick() {
hide();
tome.choose( way1 );
}
};
btnWay1.setRect( 0, bottom + GAP, (WIDTH - GAP) / 2, BTN_HEIGHT );
add( btnWay1 );
RedButton btnWay2 = new RedButton( Utils.capitalize( way2.title() ) ) {
@Override
protected void onClick() {
hide();
tome.choose( way2 );
}
};
btnWay2.setRect( btnWay1.right() + GAP, btnWay1.top(), btnWay1.width(), BTN_HEIGHT );
add( btnWay2 );
RedButton btnCancel = new RedButton( TXT_CANCEL ) {
@Override
protected void onClick() {
hide();
}
};
btnCancel.setRect( 0, btnWay2.bottom() + GAP, WIDTH, BTN_HEIGHT );
add( btnCancel );
resize( WIDTH, (int)btnCancel.bottom() );
}
开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:41,
代码来源:WndChooseWay.java
示例7: WndWandmaker
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndWandmaker( final Wandmaker wandmaker, final Item item ) {
super();
IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite( item.image(), null ) );
titlebar.label( Utils.capitalize( item.name() ) );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
BitmapTextMultiline message = PixelScene.createMultiline( TXT_MESSAGE, 6 );
message.maxWidth = WIDTH;
message.measure();
message.y = titlebar.bottom() + GAP;
add( message );
RedButton btnBattle = new RedButton( TXT_BATTLE ) {
@Override
protected void onClick() {
selectReward( wandmaker, item, Wandmaker.Quest.wand1 );
}
};
btnBattle.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT );
add( btnBattle );
RedButton btnNonBattle = new RedButton( TXT_NON_BATTLE ) {
@Override
protected void onClick() {
selectReward( wandmaker, item, Wandmaker.Quest.wand2 );
}
};
btnNonBattle.setRect( 0, btnBattle.bottom() + GAP, WIDTH, BTN_HEIGHT );
add( btnNonBattle );
resize( WIDTH, (int)btnNonBattle.bottom() );
}
开发者ID:skynet67,
项目名称:pixel-dungeon-rebirth,
代码行数:37,
代码来源:WndWandmaker.java
示例8: WndSadGhost
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndSadGhost( final Ghost ghost, final Item item ) {
super();
IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite( item.image(), null ) );
titlebar.label( Utils.capitalize( item.name() ) );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
BitmapTextMultiline message = PixelScene.createMultiline( item instanceof DriedRose ? TXT_ROSE : TXT_RAT, 6 );
message.maxWidth = WIDTH;
message.measure();
message.y = titlebar.bottom() + GAP;
add( message );
RedButton btnWeapon = new RedButton( TXT_WEAPON ) {
@Override
protected void onClick() {
selectReward( ghost, item, Ghost.Quest.weapon );
}
};
btnWeapon.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT );
add( btnWeapon );
RedButton btnArmor = new RedButton( TXT_ARMOR ) {
@Override
protected void onClick() {
selectReward( ghost, item, Ghost.Quest.armor );
}
};
btnArmor.setRect( 0, btnWeapon.bottom() + GAP, WIDTH, BTN_HEIGHT );
add( btnArmor );
resize( WIDTH, (int)btnArmor.bottom() );
}
开发者ID:skynet67,
项目名称:pixel-dungeon-rebirth,
代码行数:37,
代码来源:WndSadGhost.java
示例9: WndKeymap
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndKeymap() {
int ww = Math.min( 160, PixelScene.uiCamera.width - 16 );
int wh = PixelScene.uiCamera.height - 24;
resize( ww, wh );
RedButton btnReset = new RedButton( "Reset To Defaults" ) {
@Override
protected void onClick() {
resetToDefaults();
populateList();
}
};
btnReset.setRect( 0, height - BTN_HEIGHT, width, BTN_HEIGHT );
add( btnReset );
listContent = new Component();
final ScrollPane list = new ScrollPane(listContent) {
@Override
public void onClick( float x, float y ) {
for (ListItem item : items.values()) {
if (item.onClick( x, y )) {
break;
}
}
}
};
populateList();
add(list);
list.setRect(0, 0, width, btnReset.top() );
}
开发者ID:skynet67,
项目名称:pixel-dungeon-rebirth,
代码行数:36,
代码来源:WndKeymap.java
示例10: WndSpellInfo
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndSpellInfo(final Hero hero, final Spell spell ) {
super();
//Title text
Text tfTitle = PixelScene.createMultiline(spell.name(), GuiProperties.mediumTitleFontSize());
tfTitle.hardlight(TITLE_COLOR);
tfTitle.maxWidth(WIDTH - GAP);
tfTitle.measure();
tfTitle.x = (WIDTH - tfTitle.width())/2;
tfTitle.y = GAP;
add(tfTitle);
//Info text
Text info = PixelScene.createMultiline(spell.desc(), GuiProperties.regularFontSize() );
info.maxWidth(WIDTH);
info.measure();
info.y = tfTitle.bottom()+ GAP;
add( info );
int buttonY = (int) info.bottom()+ GAP;
//Back Button
TextButton btnBack = new RedButton(BTN_BACK) {
@Override
protected void onClick() {
super.onClick();
hide();
}
};
btnBack.setRect(0, info.bottom() + GAP, WIDTH, BTN_HEIGHT);
add(btnBack);
resize( WIDTH, (int) btnBack.bottom() + BTN_HEIGHT / 2);
}
开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:36,
代码来源:WndSpellInfo.java
示例11: WndLibraryEntry
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndLibraryEntry(String entry) {
super();
final Window context = this;
//Title text
Text tfTitle = PixelScene.createMultiline(entry, GuiProperties.mediumTitleFontSize());
tfTitle.hardlight(TITLE_COLOR);
tfTitle.maxWidth(WIDTH - GAP);
tfTitle.measure();
tfTitle.x = (WIDTH - tfTitle.width())/2;
tfTitle.y = GAP;
add(tfTitle);
//Entry text
Text message = PixelScene.createMultiline( entry, GuiProperties.regularFontSize() );
message.maxWidth(WIDTH);
message.measure();
message.y = tfTitle.bottom()+ GAP;
add( message );
int buttonY = (int) message.bottom()+ GAP;
//Back Button
TextButton back = new RedButton(Game.getVar(R.string.Wnd_Button_Back)) {
@Override
protected void onClick() {
super.onClick();
context.hide();
}
};
back.setRect((WIDTH / 2) - (BTN_WIDTH / 2) , BTN_HEIGHT / 2 + GAP * 2 + buttonY, BTN_WIDTH, BTN_HEIGHT);
add(back);
resize( WIDTH, (int) back.bottom() + BTN_HEIGHT / 2);
}
开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:37,
代码来源:WndLibraryEntry.java
示例12: WndSadGhostNecro
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndSadGhostNecro() {
super();
IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite( new BlackSkull()) );
titlebar.label( Utils.capitalize( Game.getVar(R.string.Necromancy_Title) ) );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
Text message = PixelScene.createMultiline( TXT_TEXT, GuiProperties.regularFontSize() );
message.maxWidth(WIDTH);
message.measure();
message.y = titlebar.bottom() + GAP;
add( message );
RedButton btnWeapon = new RedButton( TXT_YES ) {
@Override
protected void onClick() {
GLog.w( TXT_PERSUADED );
persuade = true;
hide();
}
};
btnWeapon.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT );
add( btnWeapon );
RedButton btnArmor = new RedButton( TXT_NO ) {
@Override
protected void onClick() {
persuade = false;
hide();
}
};
btnArmor.setRect( 0, btnWeapon.bottom() + GAP, WIDTH, BTN_HEIGHT );
add( btnArmor );
resize( WIDTH, (int)btnArmor.bottom() );
}
开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:40,
代码来源:WndSadGhostNecro.java
示例13: add
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public float add(float y,String text, final PlusMinusDefault actions) {
int w = height;
btnPlus = new RedButton(TXT_PLUS) {
@Override
protected void onClick() {
actions.onPlus();
}
};
parent.add(btnPlus.setRect(width - w, y, w, height));
btnMinus = new RedButton(TXT_MINUS) {
@Override
protected void onClick() {
actions.onMinus();
}
};
parent.add(btnMinus.setRect(0, y, w, height));
btnDefault = new RedButton(text) {
@Override
protected void onClick() {
actions.onDefault();
}
};
btnDefault.setRect(btnMinus.right(), y, width - btnPlus.width()
- btnMinus.width(), height);
parent.add(btnDefault);
return btnMinus.bottom();
}
开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:32,
代码来源:Selector.java
示例14: WndWandmaker
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndWandmaker( final WandMaker wandmaker, final Item item ) {
super();
IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite( item ) );
titlebar.label( Utils.capitalize( item.name() ) );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
Text message = PixelScene.createMultiline( TXT_MESSAGE, GuiProperties.regularFontSize() );
message.maxWidth(WIDTH);
message.measure();
message.y = titlebar.bottom() + GAP;
add( message );
RedButton btnBattle = new RedButton( TXT_BATTLE ) {
@Override
protected void onClick() {
selectReward( wandmaker, item, WandMaker.makeBattleWand() );
}
};
btnBattle.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT );
add( btnBattle );
RedButton btnNonBattle = new RedButton( TXT_NON_BATTLE ) {
@Override
protected void onClick() {
selectReward( wandmaker, item, WandMaker.makeNonBattleWand() );
}
};
btnNonBattle.setRect( 0, btnBattle.bottom() + GAP, WIDTH, BTN_HEIGHT );
add( btnNonBattle );
resize( WIDTH, (int)btnNonBattle.bottom() );
}
开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:37,
代码来源:WndWandmaker.java
示例15: WndSadGhost
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndSadGhost( final Ghost ghost, final Item item ) {
super();
IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite( item ) );
titlebar.label( Utils.capitalize( item.name() ) );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
Text message = PixelScene.createMultiline( item instanceof DriedRose ? TXT_ROSE : TXT_RAT, GuiProperties.regularFontSize() );
message.maxWidth(WIDTH);
message.measure();
message.y = titlebar.bottom() + GAP;
add( message );
RedButton btnWeapon = new RedButton( TXT_WEAPON ) {
@Override
protected void onClick() {
selectReward( ghost, item, Ghost.Quest.weapon );
}
};
btnWeapon.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT );
add( btnWeapon );
RedButton btnArmor = new RedButton( TXT_ARMOR ) {
@Override
protected void onClick() {
selectReward( ghost, item, Ghost.Quest.armor );
}
};
btnArmor.setRect( 0, btnWeapon.bottom() + GAP, WIDTH, BTN_HEIGHT );
add( btnArmor );
resize( WIDTH, (int)btnArmor.bottom() );
}
开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:37,
代码来源:WndSadGhost.java
示例16: WndImp
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndImp( final Imp imp, final DwarfToken tokens ) {
super();
IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite( tokens ) );
titlebar.label( Utils.capitalize( tokens.name() ) );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
Text message = PixelScene.createMultiline( TXT_MESSAGE, GuiProperties.regularFontSize() );
message.maxWidth(WIDTH);
message.measure();
message.y = titlebar.bottom() + GAP;
add( message );
RedButton btnReward = new RedButton( TXT_REWARD ) {
@Override
protected void onClick() {
takeReward( imp, tokens, Imp.Quest.reward );
}
};
btnReward.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT );
add( btnReward );
resize( WIDTH, (int)btnReward.bottom() );
}
开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:28,
代码来源:WndImp.java
示例17: WndTradeItem
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndTradeItem( final Heap heap, boolean canBuy ) {
super();
Item item = heap.peek();
float pos = createDescription( item, true );
int price = price( item );
if (canBuy) {
RedButton btnBuy = new RedButton( Utils.format( TXT_BUY, price ) ) {
@Override
protected void onClick() {
hide();
buy( heap );
}
};
btnBuy.setRect( 0, pos + GAP, WIDTH, BTN_HEIGHT );
btnBuy.enable( price <= Dungeon.gold());
add( btnBuy );
RedButton btnCancel = new RedButton( TXT_CANCEL ) {
@Override
protected void onClick() {
hide();
}
};
btnCancel.setRect( 0, btnBuy.bottom() + GAP, WIDTH, BTN_HEIGHT );
add( btnCancel );
resize( WIDTH, (int)btnCancel.bottom() );
} else {
resize( WIDTH, (int)pos );
}
}
开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:41,
代码来源:WndTradeItem.java
示例18: WndOptions
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndOptions( String title, String message, String... options ) {
super();
Text tfTitle = PixelScene.createMultiline( title, GuiProperties.titleFontSize() );
tfTitle.hardlight( TITLE_COLOR );
tfTitle.x = tfTitle.y = GAP;
tfTitle.maxWidth(WIDTH - GAP * 2);
tfTitle.measure();
add( tfTitle );
Text tfMesage = PixelScene.createMultiline( message, GuiProperties.regularFontSize() );
tfMesage.maxWidth(WIDTH - GAP * 2);
tfMesage.measure();
tfMesage.x = GAP;
tfMesage.y = tfTitle.y + tfTitle.height() + GAP;
add( tfMesage );
float pos = tfMesage.y + tfMesage.height() + GAP;
for (int i=0; i < options.length; i++) {
final int index = i;
RedButton btn = new RedButton( options[i] ) {
@Override
protected void onClick() {
hide();
onSelect( index );
}
};
btn.setRect(GAP, pos, WIDTH - GAP * 2, BUTTON_HEIGHT );
add( btn );
pos += BUTTON_HEIGHT + GAP;
}
resize( WIDTH, (int)pos );
}
开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:38,
代码来源:WndOptions.java
示例19: btnBreakSpell
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
private void btnBreakSpell(RedButton btnWay1){
RedButton btnWay2 = new RedButton( Utils.capitalize( TXT_BREAK_SPELL_BTN ) ) {
@Override
protected void onClick() {
hide();
Hero hero = Dungeon.hero;
Item a = hero.belongings.getItem( BlackSkullOfMastery.class );
a.removeItemFrom(hero);
Item b = new BlackSkull();
Dungeon.level.drop( b, hero.getPos() ).sprite.drop();
}
};
btnWay2.setRect( btnWay1.right() + GAP, btnWay1.top(), btnWay1.width(), BTN_HEIGHT );
add( btnWay2 );
}
开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:16,
代码来源:WndChooseWay.java
示例20: create
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
@Override
public void create() {
super.create();
BitmapTextMultiline text = null;
if (!noText) {
text = createMultiline( TXT, 8 );
text.maxWidth = WIDTH;
text.measure();
add( text );
}
amulet = new Image( Assets.AMULET );
add( amulet );
RedButton btnExit = new RedButton( TXT_EXIT ) {
@Override
protected void onClick() {
Dungeon.win( ResultDescriptions.WIN );
Dungeon.deleteGame( Dungeon.hero.heroClass, true );
Game.switchScene( noText ? TitleScene.class : RankingsScene.class );
}
};
btnExit.setSize( WIDTH, BTN_HEIGHT );
add( btnExit );
RedButton btnStay = new RedButton( TXT_STAY ) {
@Override
protected void onClick() {
onBackPressed();
}
};
btnStay.setSize( WIDTH, BTN_HEIGHT );
add( btnStay );
float height;
if (noText) {
height = amulet.height + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();
amulet.x = align( (Camera.main.width - amulet.width) / 2 );
amulet.y = align( (Camera.main.height - height) / 2 );
btnExit.setPos( (Camera.main.width - btnExit.width()) / 2, amulet.y + amulet.height + LARGE_GAP );
btnStay.setPos( btnExit.left(), btnExit.bottom() + SMALL_GAP );
} else {
height = amulet.height + LARGE_GAP + text.height() + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();
amulet.x = align( (Camera.main.width - amulet.width) / 2 );
amulet.y = align( (Camera.main.height - height) / 2 );
text.x = align( (Camera.main.width - text.width()) / 2 );
text.y = amulet.y + amulet.height + LARGE_GAP;
btnExit.setPos( (Camera.main.width - btnExit.width()) / 2, text.y + text.height() + LARGE_GAP );
btnStay.setPos( btnExit.left(), btnExit.bottom() + SMALL_GAP );
}
new Flare( 8, 48 ).color( 0xFFDDBB, true ).show( amulet, 0 ).angularSpeed = +30;
fadeIn();
}
开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:63,
代码来源:AmuletScene.java
示例21: WndResurrect
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndResurrect( final Ankh ankh, Object causeOfDeath ) {
super();
instance = this;
WndResurrect.causeOfDeath = causeOfDeath;
IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite( ankh.image(), null ) );
titlebar.label( ankh.name() );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
BitmapTextMultiline message = PixelScene.createMultiline( TXT_MESSAGE, 6 );
message.maxWidth = WIDTH;
message.measure();
message.y = titlebar.bottom() + GAP;
add( message );
RedButton btnYes = new RedButton( TXT_YES ) {
@Override
protected void onClick() {
hide();
Statistics.ankhsUsed++;
InterlevelScene.mode = InterlevelScene.Mode.RESURRECT;
Game.switchScene( InterlevelScene.class );
}
};
btnYes.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT );
add( btnYes );
RedButton btnNo = new RedButton( TXT_NO ) {
@Override
protected void onClick() {
hide();
Rankings.INSTANCE.submit( false );
Hero.reallyDie( WndResurrect.causeOfDeath );
}
};
btnNo.setRect( 0, btnYes.bottom() + GAP, WIDTH, BTN_HEIGHT );
add( btnNo );
resize( WIDTH, (int)btnNo.bottom() );
}
开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:48,
代码来源:WndResurrect.java
示例22: WndGame
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
public WndGame() {
super();
addButton( new RedButton( TXT_SETTINGS ) {
@Override
protected void onClick() {
hide();
GameScene.show( new WndSettings( true ) );
}
} );
if (Dungeon.challenges > 0) {
addButton( new RedButton( TXT_CHALLEGES ) {
@Override
protected void onClick() {
hide();
GameScene.show( new WndChallenges( Dungeon.challenges, false ) );
}
} );
}
if (!Dungeon.hero.isAlive()) {
RedButton btnStart;
addButton( btnStart = new RedButton( TXT_START ) {
@Override
protected void onClick() {
Dungeon.hero = null;
PixelDungeon.challenges( Dungeon.challenges );
InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
InterlevelScene.noStory = true;
Game.switchScene( InterlevelScene.class );
}
} );
btnStart.icon( Icons.get( Dungeon.hero.heroClass ) );
addButton( new RedButton( TXT_RANKINGS ) {
@Override
protected void onClick() {
InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
Game.switchScene( RankingsScene.class );
}
} );
}
addButtons(
new RedButton( TXT_MENU ) {
@Override
protected void onClick() {
try {
Dungeon.saveAll();
} catch (IOException e) {
// Do nothing
}
Game.switchScene( TitleScene.class );
}
}, new RedButton( TXT_EXIT ) {
@Override
protected void onClick() {
Game.instance.finish();
}
}
);
addButton( new RedButton( TXT_RETURN ) {
@Override
protected void onClick() {
hide();
}
} );
resize( WIDTH, pos );
}
开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:75,
代码来源:WndGame.java
示例23: addButton
点赞 2
import com.watabou.pixeldungeon.ui.RedButton; //导入依赖的package包/类
private void addButton( RedButton btn ) {
add( btn );
btn.setRect( 0, pos > 0 ? pos += GAP : 0, WIDTH, BTN_HEIGHT );
pos += BTN_HEIGHT;
}
开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:6,
代码来源:WndGame.java