本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.ui.RedButton.enable方法的典型用法代码示例。如果您正苦于以下问题:Java RedButton.enable方法的具体用法?Java RedButton.enable怎么用?Java RedButton.enable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.shatteredpixel.shatteredpixeldungeon.ui.RedButton
的用法示例。
在下文中一共展示了RedButton.enable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WndHardNotification
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入方法依赖的package包/类
public WndHardNotification(Component titlebar, String message, String btnMessage, int time) {
super(titlebar, message);
timeLeft = time;
this.btnMessage = btnMessage;
btnOkay = new RedButton(btnMessage + " (" + time +")"){
@Override
protected void onClick() {
hide();
}
};
btnOkay.setRect(0, height + GAP, width, 16);
btnOkay.enable(false);
add(btnOkay);
resize(width, (int) btnOkay.bottom());
}
示例2: WndBlacksmith
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入方法依赖的package包/类
public WndBlacksmith( Blacksmith troll, Hero hero ) {
super();
IconTitle titlebar = new IconTitle();
titlebar.icon( troll.sprite() );
titlebar.label( Utils.capitalize( troll.name ) );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
BitmapTextMultiline message = PixelScene.createMultiline( TXT_PROMPT, 6 );
message.maxWidth = WIDTH;
message.measure();
message.y = titlebar.bottom() + GAP;
add( message );
btnItem1 = new ItemButton() {
@Override
protected void onClick() {
btnPressed = btnItem1;
GameScene.selectItem( itemSelector, WndBag.Mode.UPGRADEABLE, TXT_SELECT );
}
};
btnItem1.setRect( (WIDTH - BTN_GAP) / 2 - BTN_SIZE, message.y + message.height() + BTN_GAP, BTN_SIZE, BTN_SIZE );
add( btnItem1 );
btnItem2 = new ItemButton() {
@Override
protected void onClick() {
btnPressed = btnItem2;
GameScene.selectItem( itemSelector, WndBag.Mode.UPGRADEABLE, TXT_SELECT );
}
};
btnItem2.setRect( btnItem1.right() + BTN_GAP, btnItem1.top(), BTN_SIZE, BTN_SIZE );
add( btnItem2 );
btnReforge = new RedButton( TXT_REFORGE ) {
@Override
protected void onClick() {
Blacksmith.upgrade( btnItem1.item, btnItem2.item );
hide();
}
};
btnReforge.enable( false );
btnReforge.setRect( 0, btnItem1.bottom() + BTN_GAP, WIDTH, 20 );
add( btnReforge );
resize( WIDTH, (int)btnReforge.bottom() );
}
示例3: WndBlacksmith
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入方法依赖的package包/类
public WndBlacksmith( Blacksmith troll, Hero hero ) {
super();
IconTitle titlebar = new IconTitle();
titlebar.icon( troll.sprite() );
titlebar.label( Messages.titleCase( troll.name ) );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
RenderedTextMultiline message = PixelScene.renderMultiline( Messages.get(this, "prompt"), 6 );
message.maxWidth( WIDTH);
message.setPos(0, titlebar.bottom() + GAP);
add( message );
btnItem1 = new ItemButton() {
@Override
protected void onClick() {
btnPressed = btnItem1;
GameScene.selectItem( itemSelector, WndBag.Mode.UPGRADEABLE, Messages.get(WndBlacksmith.class, "select") );
}
};
btnItem1.setRect( (WIDTH - BTN_GAP) / 2 - BTN_SIZE, message.top() + message.height() + BTN_GAP, BTN_SIZE, BTN_SIZE );
add( btnItem1 );
btnItem2 = new ItemButton() {
@Override
protected void onClick() {
btnPressed = btnItem2;
GameScene.selectItem( itemSelector, WndBag.Mode.UPGRADEABLE, Messages.get(WndBlacksmith.class, "select") );
}
};
btnItem2.setRect( btnItem1.right() + BTN_GAP, btnItem1.top(), BTN_SIZE, BTN_SIZE );
add( btnItem2 );
btnReforge = new RedButton( Messages.get(this, "reforge") ) {
@Override
protected void onClick() {
Blacksmith.upgrade( btnItem1.item, btnItem2.item );
hide();
}
};
btnReforge.enable( false );
btnReforge.setRect( 0, btnItem1.bottom() + BTN_GAP, WIDTH, 20 );
add( btnReforge );
resize( WIDTH, (int)btnReforge.bottom() );
}
示例4: DisplayTab
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; //导入方法依赖的package包/类
public DisplayTab() {
super();
OptionSlider scale = new OptionSlider(Messages.get(this, "scale"),
(int)Math.ceil(2* Game.density)+ "X",
PixelScene.maxDefaultZoom + "X",
(int)Math.ceil(2* Game.density),
PixelScene.maxDefaultZoom ) {
@Override
protected void onChange() {
if (getSelectedValue() != ShatteredPixelDungeon.scale()) {
ShatteredPixelDungeon.scale(getSelectedValue());
ShatteredPixelDungeon.switchNoFade((Class<? extends PixelScene>) ShatteredPixelDungeon.scene().getClass(), new Game.SceneChangeCallback() {
@Override
public void beforeCreate() {
//do nothing
}
@Override
public void afterCreate() {
Game.scene().add(new WndSettings());
}
});
}
}
};
if ((int)Math.ceil(2* Game.density) < PixelScene.maxDefaultZoom) {
scale.setSelectedValue(PixelScene.defaultZoom);
scale.setRect(0, 0, WIDTH, SLIDER_HEIGHT);
add(scale);
}
RedButton btnResolution = new RedButton(Gdx.graphics.isFullscreen() ? TXT_SWITCH_WIN : TXT_SWITCH_FULL ) {
@Override
protected void onClick() {
ShatteredPixelDungeon.fullscreen(!ShatteredPixelDungeon.fullscreen());
}
};
btnResolution.enable(ShatteredPixelDungeon.instance.getPlatformSupport().isFullscreenEnabled() );
btnResolution.setRect(0, scale.bottom() + GAP_TINY, WIDTH, BTN_HEIGHT);
add(btnResolution);
OptionSlider brightness = new OptionSlider(Messages.get(this, "brightness"),
Messages.get(this, "dark"), Messages.get(this, "bright"), -2, 2) {
@Override
protected void onChange() {
ShatteredPixelDungeon.brightness(getSelectedValue());
}
};
brightness.setSelectedValue(ShatteredPixelDungeon.brightness());
brightness.setRect(0, btnResolution.bottom() + GAP_LRG, WIDTH, SLIDER_HEIGHT);
add(brightness);
OptionSlider tileGrid = new OptionSlider(Messages.get(this, "visual_grid"),
Messages.get(this, "off"), Messages.get(this, "high"), -1, 3) {
@Override
protected void onChange() {
ShatteredPixelDungeon.visualGrid(getSelectedValue());
}
};
tileGrid.setSelectedValue(ShatteredPixelDungeon.visualGrid());
tileGrid.setRect(0, brightness.bottom() + GAP_TINY, WIDTH, SLIDER_HEIGHT);
add(tileGrid);
}