本文整理匯總了Java中com.shatteredpixel.shatteredpixeldungeon.ui.CheckBox類的典型用法代碼示例。如果您正苦於以下問題:Java CheckBox類的具體用法?Java CheckBox怎麽用?Java CheckBox使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CheckBox類屬於com.shatteredpixel.shatteredpixeldungeon.ui包,在下文中一共展示了CheckBox類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: WndChallenges
import com.shatteredpixel.shatteredpixeldungeon.ui.CheckBox; //導入依賴的package包/類
public WndChallenges( int checked, boolean editable ) {
super();
this.editable = editable;
BitmapText title = PixelScene.createText( TITLE, 9 );
title.hardlight( TITLE_COLOR );
title.measure();
title.x = PixelScene.align( camera, (WIDTH - title.width()) / 2 );
add( title );
boxes = new ArrayList<CheckBox>();
float pos = title.height() + GAP;
for (int i=0; i < Challenges.NAMES.length; i++) {
CheckBox cb = new CheckBox( Challenges.NAMES[i] );
cb.checked( (checked & Challenges.MASKS[i]) != 0 );
cb.active = editable;
if (i > 0) {
pos += GAP;
}
cb.setRect( 0, pos, WIDTH, BTN_HEIGHT );
pos = cb.bottom();
add( cb );
boxes.add( cb );
}
resize( WIDTH, (int)pos );
}
示例2: WndChallenges
import com.shatteredpixel.shatteredpixeldungeon.ui.CheckBox; //導入依賴的package包/類
public WndChallenges( int checked, boolean editable ) {
super();
this.editable = editable;
RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9 );
title.hardlight( TITLE_COLOR );
title.x = (WIDTH - title.width()) / 2;
title.y = (TTL_HEIGHT - title.height()) / 2;
PixelScene.align(title);
add( title );
boxes = new ArrayList<>();
float pos = TTL_HEIGHT;
for (int i=0; i < Challenges.NAME_IDS.length; i++) {
CheckBox cb = new CheckBox( Messages.get(Challenges.class, Challenges.NAME_IDS[i]) );
cb.checked( (checked & Challenges.MASKS[i]) != 0 );
cb.active = editable;
if (i > 0) {
pos += GAP;
}
cb.setRect( 0, pos, WIDTH, BTN_HEIGHT );
pos = cb.bottom();
add( cb );
boxes.add( cb );
}
resize( WIDTH, (int)pos );
}
示例3: AudioTab
import com.shatteredpixel.shatteredpixeldungeon.ui.CheckBox; //導入依賴的package包/類
public AudioTab() {
OptionSlider musicVol = new OptionSlider(Messages.get(this, "music_vol"), "0", "10", 0, 10) {
@Override
protected void onChange() {
Music.INSTANCE.volume(getSelectedValue()/10f);
ShatteredPixelDungeon.musicVol(getSelectedValue());
}
};
musicVol.setSelectedValue(ShatteredPixelDungeon.musicVol());
musicVol.setRect(0, 0, WIDTH, SLIDER_HEIGHT);
add(musicVol);
CheckBox musicMute = new CheckBox(Messages.get(this, "music_mute")){
@Override
protected void onClick() {
super.onClick();
ShatteredPixelDungeon.music(!checked());
}
};
musicMute.setRect(0, musicVol.bottom() + GAP_TINY, WIDTH, BTN_HEIGHT);
musicMute.checked(!ShatteredPixelDungeon.music());
add(musicMute);
OptionSlider SFXVol = new OptionSlider(Messages.get(this, "sfx_vol"), "0", "10", 0, 10) {
@Override
protected void onChange() {
Sample.INSTANCE.volume(getSelectedValue()/10f);
ShatteredPixelDungeon.SFXVol(getSelectedValue());
}
};
SFXVol.setSelectedValue(ShatteredPixelDungeon.SFXVol());
SFXVol.setRect(0, musicMute.bottom() + GAP_LRG, WIDTH, SLIDER_HEIGHT);
add(SFXVol);
CheckBox btnSound = new CheckBox( Messages.get(this, "sfx_mute") ) {
@Override
protected void onClick() {
super.onClick();
ShatteredPixelDungeon.soundFx(!checked());
Sample.INSTANCE.play( Assets.SND_CLICK );
}
};
btnSound.setRect(0, SFXVol.bottom() + GAP_TINY, WIDTH, BTN_HEIGHT);
btnSound.checked(!ShatteredPixelDungeon.soundFx());
add( btnSound );
resize( WIDTH, (int)btnSound.bottom());
}