本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent类的典型用法代码示例。如果您正苦于以下问题:Java ChangeEvent类的具体用法?Java ChangeEvent怎么用?Java ChangeEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChangeEvent类属于com.badlogic.gdx.scenes.scene2d.utils.ChangeListener包,在下文中一共展示了ChangeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addTab
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
public void addTab(String tabTitle, final ITabContent tabContent,
Skin skin) {
TextButton button = new TextButton(tabTitle, skin);
button.align(Align.left);
//button.setFillParent(true);
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
tabContent.setContent(content);
content.pack();
setWidth(preferedContentWidth);
setHeight(preferedContentHeight);
}
});
tabHeaders.add(button);
contents.add(tabContent);
preferedContentWidth = Math.max(preferedContentWidth, tabContent.getWidth());
preferedContentHeight = Math.max(preferedContentHeight, tabContent.getHeight() + tabHeaders.get(0).getHeight());
}
示例2: GameDialog
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
public GameDialog(Skin skin) {
super("", skin);
waveLevel = new Label("", skin);
monsHP = new Label("", skin);
monsBonus = new Label("", skin);
monsSpeed = new Label("", skin);
monsNumber = new Label("", skin);
btnOK = new TextButton("Okay, Let them come!", skin);
btnOK.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
// TODO Auto-generated method stub
setVisible(false);
}
});
setTitle(" There are more monsters are coming to you... ");
}
示例3: handle
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
@Override
public boolean handle(Event event) {
if (event instanceof ChangeEvent) {
Actor target = event.getTarget();
boolean isDecrease = target.equals(decreaseButton);
int skillIncreases = stats.getSkillIncreasesThisLevel(skill);
if (isDecrease && increases > 0) {
--increases;
stats.decrementSkillIncreasesThisLevel(skill);
stats.setSkillPoints(stats.getSkillPoints()+1);
stats.skills().decreaseSkillRank(skill);
return true;
} else if (!isDecrease && skillIncreases < Configuration.getSkillIncreasesPerLevel()) {
++increases;
stats.incrementSkillIncreasesThisLevel(skill);
stats.setSkillPoints(stats.getSkillPoints()-1);
stats.skills().increaseSkillRank(skill);
return true;
}
}
return false;
}
示例4: changed
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
public boolean changed (ChangeEvent event, Actor actor) {
if (endTurnButton.equals(actor) && GameState.isPlayersTurn()) {
UIManager.hideToolTip();
gameState.unpauseGame();
gameState.switchToNextSide();
endTurnButton.setDisabled(true);
ignoreEvent = true;
endTurnButton.setChecked(true);
ignoreEvent = false;
return true;
} else if (endCombatButton.equals(actor)) {
if (GameState.canPlayerEndCombat()) {
gameState.endCombat();
}
}
return false;
}
示例5: handle
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
@Override
public boolean handle(Event event) {
if (event instanceof ChangeEvent) {
if ("EXIT".equals(event.getTarget().getName())) {
dispose();
Gdx.app.exit();
} else if ("OK".equals(event.getTarget().getName())) {
SelectOption<String> selected = moduleSelectBox.getSelected();
if (selected != null) {
FileHandle currentModuleFile = Gdx.files.local(Configuration.FILE_LAST_MODULE);
currentModuleFile.writeString(selected.value, false);
dispose();
game.reloadGame();
}
}
return true;
}
return false;
}
示例6: setValue
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
/**
* Sets the progress bar position, rounded to the nearest step size and clamped to the minumum and maximim values.
* {@link #clamp(float)} can be overidden to allow values outside of the progress bars min/max range.
*
* @return false if the value was not changed because the progress bar already had the value or it was canceled by a listener.
*/
public boolean setValue(float value) {
value = snap(clamp(Math.round(value / stepSize) * stepSize));
float oldValue = this.value;
if (value == oldValue) {
return false;
}
float oldVisualValue = getVisualValue();
this.value = value;
ChangeEvent changeEvent = Pools.obtain(ChangeEvent.class);
boolean cancelled = fire(changeEvent);
if (cancelled) {
this.value = oldValue;
} else if (animateDuration > 0) {
animateFromValue = oldVisualValue;
animateTime = animateDuration;
}
Pools.free(changeEvent);
return !cancelled;
}
示例7: setValue
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
/** Sets the progress bar position, rounded to the nearest step size and clamped to the minimum and maximum values.
* {@link #clamp(float)} can be overridden to allow values outside of the progress bar's min/max range.
* @return false if the value was not changed because the progress bar already had the value or it was canceled by a listener. */
public boolean setValue (float value) {
value = clamp(Math.round(value / stepSize) * stepSize);
if (!shiftIgnoresSnap || (!Gdx.input.isKeyPressed(Keys.SHIFT_LEFT) && !Gdx.input.isKeyPressed(Keys.SHIFT_RIGHT)))
value = snap(value);
float oldValue = this.value;
if (value == oldValue) return false;
float oldVisualValue = getVisualValue();
this.value = value;
ChangeEvent changeEvent = Pools.obtain(ChangeEvent.class);
boolean cancelled = fire(changeEvent);
if (cancelled)
this.value = oldValue;
else if (animateDuration > 0) {
animateFromValue = oldVisualValue;
animateTime = animateDuration;
}
Pools.free(changeEvent);
return !cancelled;
}
示例8: getActors
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
@Override
public Actor[] getActors(Skin skin) {
ImageButton musicTooltip = new OwnImageButton(skin, "tooltip");
musicTooltip.addListener(new TextTooltip(
I18n.bundle.format("gui.tooltip.music", SysUtilsFactory.getSysUtils().getDefaultMusicDir()), skin));
ImageButton reloadMusic = new OwnImageButton(skin, "reload");
reloadMusic.setName("reload music");
reloadMusic.addListener(new EventListener() {
@Override
public boolean handle(Event event) {
if (event instanceof ChangeEvent) {
EventManager.instance.post(Events.MUSIC_RELOAD_CMD);
return true;
}
return false;
}
});
reloadMusic.addListener(new TextTooltip(I18n.bundle.get("gui.music.reload"), skin));
return new Actor[] { musicTooltip, reloadMusic };
}
示例9: ok
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
/**
* Override to append all animations if selected.
*/
@Override
protected void ok() {
@SuppressWarnings("unchecked")
SelectBox<String> cb = (SelectBox<String>) id.getField();
if (e == null && cb.getSelectedIndex() == 0) {
for (int i = 1; i < cb.getItems().size; i++) {
cb.setSelectedIndex(i);
inputsToModel(true);
// doc.setId(e, cb.getItems().get(i));
if (listener != null)
listener.changed(new ChangeEvent(), this);
}
} else {
super.ok();
}
}
示例10: ok
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
@Override
protected void ok() {
Message.showMsg(getStage(), "Creating resolution...", true);
Timer.schedule(new Task() {
@Override
public void run() {
createResolution();
String msg = scaleImages();
if(listener != null)
listener.changed(new ChangeEvent(), CreateResolutionDialog.this);
Message.hideMsg();
if(msg != null)
Message.showMsgDialog(getStage(), "Error creating resolution", msg);
}
},1);
}
示例11: handle
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
@Override
public boolean handle(Event event) {
if (event instanceof ChangeEvent) {
currentState = State.PLAYBACK;
final InputPlayer player = new InputPlayer(writer.getReader());
player.addPlaybackListener(new PlaybackAdapter() {
@Override
public void onSyncPropertiesFinish() {
player.stopPlayback();
currentState = State.BEFORE_RECORD;
layout();
}
});
layout();
player.startPlayback();
}
return true;
}
示例12: setValue
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
public boolean setValue(float value) {
value = clamp(Math.round(value / stepSize) * stepSize);
if (!shiftIgnoresSnap || (!Gdx.input.isKeyPressed(Keys.SHIFT_LEFT) && !Gdx.input.isKeyPressed(Keys.SHIFT_RIGHT))) value = snap(value);
float oldValue = this.value;
if (value == oldValue) return false;
float oldVisualValue = getVisualValue();
this.value = value;
ChangeEvent changeEvent = Pools.obtain(ChangeEvent.class);
boolean cancelled = fire(changeEvent);
if (cancelled) this.value = oldValue;
else if (animateDuration > 0) {
animateFromValue = oldVisualValue;
animateTime = animateDuration;
}
Pools.free(changeEvent);
return !cancelled;
}
示例13: setChecked
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
public void setChecked(boolean paramBoolean)
{
if (this.isChecked == paramBoolean);
do
{
do
return;
while ((this.buttonGroup != null) && (!this.buttonGroup.canCheck(this, paramBoolean)));
this.isChecked = paramBoolean;
}
while (this.isDisabled);
ChangeListener.ChangeEvent localChangeEvent = (ChangeListener.ChangeEvent)Pools.obtain(ChangeListener.ChangeEvent.class);
if (fire(localChangeEvent))
if (paramBoolean)
break label73;
label73: for (boolean bool = true; ; bool = false)
{
this.isChecked = bool;
Pools.free(localChangeEvent);
return;
}
}
示例14: touchDown
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
public boolean touchDown(InputEvent paramInputEvent, float paramFloat1, float paramFloat2, int paramInt1, int paramInt2)
{
if ((paramInt1 == 0) && (paramInt2 != 0))
return false;
this.this$1.stageToLocalCoordinates(Vector2.tmp);
float f1 = Vector2.tmp.x;
float f2 = Vector2.tmp.y;
if ((f1 > 0.0F) && (f1 < this.this$1.getWidth()) && (f2 > 0.0F) && (f2 < this.this$1.getHeight()))
{
this.this$1.listSelectedIndex = ((int)((this.this$1.getHeight() - f2) / this.this$1.itemHeight));
this.this$1.listSelectedIndex = Math.max(0, this.this$1.listSelectedIndex);
this.this$1.listSelectedIndex = Math.min(-1 + this.this$1.this$0.items.length, this.this$1.listSelectedIndex);
this.this$1.this$0.selectedIndex = this.this$1.listSelectedIndex;
if (this.this$1.this$0.items.length > 0)
{
ChangeListener.ChangeEvent localChangeEvent = (ChangeListener.ChangeEvent)Pools.obtain(ChangeListener.ChangeEvent.class);
this.this$1.this$0.fire(localChangeEvent);
Pools.free(localChangeEvent);
}
}
return true;
}
示例15: render
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
/**------------------------RENDER------------------------**/
@Override
public void render(float f)
{
//Debug
//stage.setDebugAll(true);
//Clear Screen
Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);
//Set background image
rootTable.background(new TextureRegionDrawable(new TextureRegion(TextureManager.menuBackground)));
//Render stage
stage.act(Constants.DELTATIME);
stage.draw();
/*------------------SWITCH TO FULLSCREEN AND BACK------------------*/
super.changeToFullScreenOnF12();
/*------------------QUIT GAME------------------*/
if (Gdx.input.isKeyPressed(Input.Keys.ESCAPE))
{
game.setScreen(new MenuScreen(game, client, server));
}
/*------------------JOIN GAME WITH ENTER------------------*/
if(Gdx.input.isKeyJustPressed(Input.Keys.ENTER))
{
ChangeEvent event1 = new ChangeEvent();
joinButton.fire(event1);
}
}