本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.Event类的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Event类属于com.badlogic.gdx.scenes.scene2d包,在下文中一共展示了Event类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSlider
import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的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;
}
示例2: ServerRunningMenu
import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
public ServerRunningMenu(Save save, int port) {
super(Localization.get("menu.general.loading"), Localization.get("menu.server.stop"));
this.save = save;
this.port = port;
addButtonListener(new EventListener() {
@Override
public boolean handle(Event event) {
if (!(event instanceof ChangeListener.ChangeEvent)) return false;
try {
Adapter.gotoMainMenu();
} catch (StopLoopException ignored) {
}
return true;
}
});
}
示例3: getActor
import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
@Override
public Actor getActor(VisualSettingManager visualSettingManager) {
final SelectBox<String> selectBox = new SelectBox<String>(visualSettingManager.getSkin());
selectBox.setItems(options);
selectBox.setSelected(selected);
selectBox.addListener(new EventListener() {
@Override
public boolean handle(Event event) {
if (!(event instanceof SettingsMenu.SaveEvent))
return false;
set(selectBox.getSelected());
return true;
}
});
return selectBox;
}
示例4: create
import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
public void create() {
stage = new Stage();
Gdx.input.setInputProcessor(stage);
//font = new BitmapFont();
//skin = new Skin();
//buttonAtlas = new TextureAtlas(Gdx.files.internal());
//skin.addRegions(buttonAtlas);
button = new Button();
button.setStyle(new Button.ButtonStyle());
button.addCaptureListener(new EventListener() {
@Override
public boolean handle(Event event) {
Gdx.app.log("LOG", "event " + event);
return false;
}
});
stage.addActor(button);
}
示例5: handle
import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
@Override
public boolean handle(Event event) {
if (event instanceof InputEvent) {
InputEvent inputEvent = (InputEvent) event;
if (Type.touchDown.equals(inputEvent.getType())) {
Inventory junkBag = GameState.getPlayerCharacterGroup().getInventory();
if (junkBag.getTotalNumberOfItems() > 0) {
int totalCost = junkBag.getTotalTradingCost(BagType.BACKPACK, getDisplayedCustomer(), displayedMerchant, false);
UIManager.displayConfirmation(
Strings.getString(UIManager.STRING_TABLE, "sellAllQuestion"),
Strings.getString(UIManager.STRING_TABLE, "sellAllConfirmation", totalCost),
callback);
}
return true;
}
}
return false;
}
示例6: handle
import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
public boolean handle(Event event) {
if (item == null) {
return false;
}
if (item.equals(UIManager.getDraggedItem())) {
UIManager.hideToolTip();
return false;
}
if (event instanceof InputEvent) {
Type inputEventType = ((InputEvent) event).getType();
if (Type.enter.equals(inputEventType)) {
getTooltip().updateText(UIManager.getDisplayedCharacter());
if (getTooltip().shouldDisplay()) {
UIManager.setToolTip(getTooltip());
}
}
if (Type.exit.equals(inputEventType)) {
UIManager.hideToolTip();
}
}
return false;
}
示例7: handle
import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的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;
}
示例8: handle
import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的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;
}
示例9: handle
import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
@Override
public boolean handle(Event event) {
// disable the combat path in case any UI element is being hovered
if (event instanceof InputEvent) {
InputEvent inputEvent = (InputEvent) event;
if (Type.enter.equals(inputEvent.getType())) {
overUIElement = true;
if (UIManager.isThisTooltipSet(combatTooltip)) {
UIManager.hideToolTip();
}
}
if (Type.exit.equals(inputEvent.getType())) {
overUIElement = false;
overCharacterPortrait = false;
}
if (Type.mouseMoved.equals(inputEvent.getType())) {
Actor hitActor = UIManager.getStage().hit(inputEvent.getStageX(), inputEvent.getStageY(), true);
overUIElement = hitActor != null;
overCharacterPortrait = UIManager.isPCPortrait(hitActor);
}
}
return false;
}
示例10: fire
import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
@Override
public boolean fire(Event event) {
if (event instanceof ChangeListener.ChangeEvent) {
if (changeConditions.isSatisfied()) {
for (Invokable invokeEffect_: invokeEffects) {
invokeEffect_.invoke();
}
return super.fire(event);
} else return false;
}
else {
return super.fire(event);
}
}
示例11: FlopsyScreen
import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
public FlopsyScreen(FlopsyDroidGame game, OnGlobalListener listener) {
mStage = new Stage();
mGlobalListener = listener;
game.getAssetManager().load("flopsy.sprites", TextureAtlas.class);
game.getAssetManager().finishLoading();
mTextureAtlas = game.getAssetManager().get("flopsy.sprites", TextureAtlas.class);
mLabelStyle = new Label.LabelStyle();
mLabelStyle.font = new BitmapFont(Gdx.files.internal("flappyfont.fnt"),
Gdx.files.internal("flappyfont.png"), false);
mStage.addListener(new EventListener() {
@Override
public boolean handle(Event event) {
if(event.getTarget().equals(mAndy)) {
mGround.onDroidCollision();
return true;
}
return false;
}
});
}
示例12: getActors
import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的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 };
}
示例13: initialize
import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
private void initialize() {
if (cursorLocation == null) {
cursor = GlobalResources.linkCursor;
} else {
cursor = new Pixmap(Gdx.files.internal(cursorLocation));
}
listeners = new DelayedRemovalArray<EventListener>();
this.addListener(new EventListener() {
@Override
public boolean handle(Event event) {
if (event instanceof InputEvent) {
Type type = ((InputEvent) event).getType();
if (type == Type.enter) {
if (!me.isDisabled())
Gdx.graphics.setCursor(Gdx.graphics.newCursor(cursor, 4, 0));
return true;
} else if (type == Type.exit) {
Gdx.graphics.setSystemCursor(SystemCursor.Arrow);
return true;
}
}
return false;
}
});
}
示例14: initialize
import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
private void initialize() {
this.addListener(new EventListener() {
@Override
public boolean handle(Event event) {
if (event instanceof InputEvent) {
Type type = ((InputEvent) event).getType();
if (type == Type.enter) {
if (!me.isDisabled())
Gdx.graphics.setCursor(Gdx.graphics.newCursor(cursor != null ? cursor : GlobalResources.linkCursor, 4, 0));
return true;
} else if (type == Type.exit) {
Gdx.graphics.setSystemCursor(SystemCursor.Arrow);
return true;
}
}
return false;
}
});
}
示例15: initialize
import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
private void initialize() {
this.addListener(new EventListener() {
@Override
public boolean handle(Event event) {
if (event instanceof InputEvent) {
Type type = ((InputEvent) event).getType();
// Click
if (type == Type.touchUp && ((InputEvent) event).getButton() == Buttons.LEFT) {
Gdx.net.openURI(linkURL);
} else if (type == Type.enter) {
Gdx.graphics.setCursor(Gdx.graphics.newCursor(GlobalResources.linkCursor, 4, 0));
} else if (type == Type.exit) {
Gdx.graphics.setSystemCursor(SystemCursor.Arrow);
}
return true;
}
return false;
}
});
}