本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.utils.ChangeListener类的典型用法代码示例。如果您正苦于以下问题:Java ChangeListener类的具体用法?Java ChangeListener怎么用?Java ChangeListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChangeListener类属于com.badlogic.gdx.scenes.scene2d.utils包,在下文中一共展示了ChangeListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addAlbedoRSlider
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; //导入依赖的package包/类
private void addAlbedoRSlider(float w, float h, float scale) {
lblAR=new Label("Albedo-R:" , skin);
lblAR.setFontScale(2.5f*scale);
Table tbRes = new Table();
tbRes.add(lblAR).height(60*scale);
tbRes.setPosition(115*scale, h - 140*scale);
stage.addActor(tbRes);
albedoRS = new Slider(0, 1, 0.05f, false, skin);
albedoRS.setValue(pbrShader.albedoColor.x);
albedoRS.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
pbrShader.albedoColor.x=albedoRS.getValue();
}
});
tbRes = new Table();
tbRes.add(albedoRS).width((w-150*scale)/3f).height(60*scale);
tbRes.setPosition(800/3*scale, h - 170*scale);
stage.addActor(tbRes);
}
示例2: build
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; //导入依赖的package包/类
public void build(FileItem fileItem) {
clearChildren();
if (fileItem == null) {
addItem(new MenuItem("New Scene", new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
}
}));
}
}
示例3: createSlider
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; //导入依赖的package包/类
public VisSlider createSlider(String label, float minimum, float maximum, float[] snapValues, float threshold, float initialValue, ChangeListener changeListener) {
if(!label.isEmpty()) {
add(new VisLabel(label)).left().padRight(10).padTop(20);
}
add(new VisLabel((int)minimum + "")).padRight(5).padTop(20);
VisSlider slider = new VisSlider(minimum, maximum, 1, false);
slider.setSnapToValues(snapValues, threshold);
slider.setValue(initialValue);
slider.addListener(new EventListener() {
@Override
public boolean handle(Event event) {
event.stop();
return false;
}
});
slider.addListener(changeListener);
add(slider).expandX().fill().padRight(5).padTop(20);
add(new VisLabel("" + (int)maximum)).padTop(20).row();
return slider;
}
示例4: TradeOfferItem
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; //导入依赖的package包/类
TradeOfferItem(String player, ResourceMap offer, Skin skin) {
this.skin = skin;
resources = new ArrayList<>(offer.size());
counts = new ArrayList<>(offer.size());
label = new Label(player, skin);
accept = new TextButton("Accept", skin);
accept.setWidth(accept.getWidth() + 40);
accept.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (acceptListener != null) {
acceptListener.onAcceptClicked(getOwner(), TradeOfferItem.this.offer);
}
}
});
setOffer(offer);
if (resources.isEmpty())
return;
addActor(label);
addActor(accept);
}
示例5: addItems
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; //导入依赖的package包/类
@Override
void addItems() {
getList().clearItems();
config.load();
for (final String item[] : buttonItems) {
if (item[1].contains("JOYSTICK")) // Not implemented
continue;
addItem(String.format("%s - [%s]", item[0],
StageConfigInput.getInputDisplayName(StageConfigInput.KEYBOARD, config, item[1])),
new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
Client.setStage(new StageConfigInput(StageConfigInput.KEYBOARD, config, item[1], item[0]));
}
});
}
// Back
addStageChangeItem("Back", StageSettings.class);
}
示例6: addTab
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; //导入依赖的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());
}
示例7: GameDialog
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; //导入依赖的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... ");
}
示例8: SingleplayerSaveDeleteMenu
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; //导入依赖的package包/类
public SingleplayerSaveDeleteMenu(final Save save) {
title = new Label(Localization.get("menu.singleplayer.delete.title"),
skin.get("title", Label.LabelStyle.class));
text = new Label(Localization.get("menu.singleplayer.delete.text", save.name), skin);
delete = new TextButton(Localization.get("menu.singleplayer.delete.delete", save.name), skin);
back = MenuTools.getBackButton(this);
text.setAlignment(Align.center);
delete.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
ClientSaveManager.deleteSave(save);
Menu prev = MenuManager.getPrevious(SingleplayerSaveDeleteMenu.this);
if (!(prev instanceof SingleplayerSavesMenu))
return;
((SingleplayerSavesMenu) prev).updateSavesList();
Adapter.setMenu(prev);
}
});
stage.addActor(title);
stage.addActor(text);
stage.addActor(delete);
stage.addActor(back);
}
示例9: MultiplayerConnectMenu
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; //导入依赖的package包/类
public MultiplayerConnectMenu() {
super();
title = new Label(Localization.get("menu.multiplayer.title"), skin.get("title", Label.LabelStyle.class));
address = new TextField("", skin);
address.setMessageText(Localization.get("menu.multiplayer.address"));
port = new TextField("", skin);
port.setMessageText(Localization.get("menu.multiplayer.port", 24842)); //Not "Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)" because the port is set on the server
port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
connect = new TextButton(Localization.get("menu.multiplayer.connect"), skin);
back = MenuTools.getBackButton(this);
connect.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
Adapter.setMenu(new MultiplayerLoadingMenu(address.getText().isEmpty() ? "localhost" : address.getText(), port.getText().isEmpty() ? 24842 : Integer.parseInt(port.getText())));
}
});
stage.addActor(title);
stage.addActor(address);
stage.addActor(port);
stage.addActor(connect);
stage.addActor(back);
}
示例10: setUpPlayButton
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; //导入依赖的package包/类
public void setUpPlayButton() {
playButton = new GameButton(Constants.RECTANGLE_BUTTON_WIDTH, Constants.RECTANGLE_BUTTON_HEIGHT, "playbtn", false);
playButton.setPosition(Constants.WIDTH / 4 - playButton.getWidth() * 2 / 5,
Constants.HEIGHT / 2 - playButton.getHeight() * 2.5f -2);
playButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
//FlappySpinner.gameManager.hideAd();
float delay = 0.3f;
setUpFadeOut();
Timer.schedule(new Timer.Task() {
@Override
public void run() {
game.setScreen(new GameScreen(game, 0, false));
}
}, delay);
}
});
stage.addActor(playButton);
}
示例11: setUpMarketButton
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; //导入依赖的package包/类
public void setUpMarketButton() {
marketButton = new GameButton(Constants.RECTANGLE_BUTTON_WIDTH, Constants.RECTANGLE_BUTTON_HEIGHT, "market", false);
marketButton.setPosition(Constants.WIDTH * 3 / 4 - marketButton.getWidth() * 3 / 5,
Constants.HEIGHT / 2 - marketButton.getHeight() * 2.5f - 2);
marketButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
float delay = 0.3f;
setUpFadeOut();
Timer.schedule(new Timer.Task() {
@Override
public void run() {
game.setScreen(new MarketScreen(game));
}
}, delay);
}
});
stage.addActor(marketButton);
}
示例12: setUpNextButton
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; //导入依赖的package包/类
public void setUpNextButton() {
nextButton = new GameButton(Constants.RECTANGLE_BUTTON_WIDTH, Constants.RECTANGLE_BUTTON_HEIGHT, "playbtn", false);
nextButton.setPosition(Constants.WIDTH * 3 / 4 - nextButton.getWidth() * 3 / 5,
Constants.HEIGHT / 2 - nextButton.getHeight() * 3.5f);
nextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (position == Constants.SKIN_COUNT - 1) {
position = 0;
} else {
position++;
}
changeShownSkin();
}
});
stage.addActor(nextButton);
}
示例13: setUpPreviousButton
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; //导入依赖的package包/类
public void setUpPreviousButton() {
previousButton = new GameButton(Constants.RECTANGLE_BUTTON_WIDTH, Constants.RECTANGLE_BUTTON_HEIGHT, "previous", false);
previousButton.setPosition(Constants.WIDTH / 4 - previousButton.getWidth() * 2 / 5,
Constants.HEIGHT / 2 - previousButton.getHeight() * 3.5f);
previousButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (position == 0) {
position = Constants.SKIN_COUNT - 1;
} else {
position--;
}
changeShownSkin();
}
});
stage.addActor(previousButton);
}
示例14: setUpBuyButton
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; //导入依赖的package包/类
public void setUpBuyButton() {
buyBottom = new GameButton(Constants.RECTANGLE_BUTTON_WIDTH, Constants.RECTANGLE_BUTTON_HEIGHT, "market", false);
buyBottom.setPosition(Constants.WIDTH * 2 / 3 - buyBottom.getWidth() / 2,
skinImage.getY() - buyBottom.getHeight() - 2f);
buyBottom.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (preferences.getUserMoney() >= skins.get(position).getPrice()) {
preferences.setUserMoney(preferences.getUserMoney() - skins.get(position).getPrice());
preferences.setSkinBought(skins.get(position).getName());
audioManager.playSound(audioManager.getMarketSound());
updateShownSkin();
} else {
audioManager.playSound(audioManager.getGameoverSound());
}
}
});
buyBottom.setVisible(false);
stage.addActor(buyBottom);
}
示例15: setUpVideoButton
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; //导入依赖的package包/类
public void setUpVideoButton() {
videoButton = new GameButton(Constants.RECTANGLE_BUTTON_WIDTH, Constants.RECTANGLE_BUTTON_HEIGHT, "video", false);
videoButton.setPosition(Constants.WIDTH / 4 - videoButton.getWidth() * 2 / 5, Constants.HEIGHT / 2 - videoButton.getHeight() * 1.65f);
videoButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
FlappySpinner.gameManager.displayVungle(new VungleCallBackListener() {
@Override
public void vungleCallBack() {
Gdx.app.postRunnable(new Runnable() {
@Override
public void run() {
aGame.setScreen(new GameScreen(aGame, SCORE, true));
}
});
}
});
//aGame.setScreen(new GameScreen(aGame, SCORE, true));
}
});
videoButton.setVisible(false);
stage.addActor(videoButton);
}