use of com.badlogic.gdx.scenes.scene2d.InputEvent in project Eidolons by IDemiurge.
the class BaseView method init.
public void init(TextureRegion portraitTexture, String path) {
portrait = initPortrait(portraitTexture, path);
addActor(portrait);
addListener(new BattleClickListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
return true;
}
@Override
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
if (button == Input.Buttons.LEFT) {
event.handle();
if (isAlt())
try {
if (DefaultActionHandler.leftClickActor(event, getX(), getY()))
return;
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
GuiEventManager.trigger(CALL_BLUE_BORDER_ACTION, BaseView.this);
}
}
});
}
use of com.badlogic.gdx.scenes.scene2d.InputEvent in project Eidolons by IDemiurge.
the class ContainerPanel method initListeners.
private void initListeners() {
clear();
TextureRegion textureRegion = new TextureRegion(getOrCreateR("UI/components/inventory_background.png"));
TextureRegionDrawable drawable = new TextureRegionDrawable(textureRegion);
setBackground(drawable);
inventorySlotsPanel = new InventorySlotsPanel();
containerSlotsPanel = new InventorySlotsPanel();
portrait = new Image();
portrait.setSize(GridMaster.CELL_W, GridMaster.CELL_H);
addElement(portrait).top().height(GridMaster.CELL_H).width(GridMaster.CELL_W);
row();
addElement(inventorySlotsPanel).height(340).pad(20, 20, 0, 20).top().expand(1, 0);
row();
addElement(containerSlotsPanel).height(340).pad(20, 30, 0, 20).top().expand(1, 0);
// initListeners();
final TablePanel<Actor> lower = new TablePanel<>();
addElement(lower).pad(0, 30, 20, 20);
takeAllButton = lower.addElement(new TextButton("Take All", StyleHolder.getDefaultTextButtonStyle())).fill(false).expand(0, 0).right().pad(20, 10, 20, 10).size(50, 50);
GuiEventManager.bind(SHOW_LOOT_PANEL, (obj) -> {
final Pair<InventoryDataSource, ContainerDataSource> param = (Pair<InventoryDataSource, ContainerDataSource>) obj.get();
if (param == null) {
close();
} else {
open();
inventorySlotsPanel.setUserObject(param.getKey());
containerSlotsPanel.setUserObject(param.getValue());
if (containerSlotsPanel.getListeners().size > 0)
inventorySlotsPanel.addListener(containerSlotsPanel.getListeners().first());
TextButton button = (TextButton) takeAllButton.getActor();
button.getListeners().clear();
final ContainerDataSource source = param.getValue();
button.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
source.getHandler().takeAllClicked();
}
});
portrait.setDrawable(TextureCache.getOrCreateTextureRegionDrawable(StringMaster.getAppendedImageFile(source.getHandler().getContainer().getImagePath(), ContainerMaster.OPEN)));
}
});
addListener(new InputListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
event.stop();
return true;
}
@Override
public boolean mouseMoved(InputEvent event, float x, float y) {
event.stop();
return true;
}
});
}
use of com.badlogic.gdx.scenes.scene2d.InputEvent in project Eidolons by IDemiurge.
the class OverlayTextPanel method initScrollPanel.
@Override
protected void initScrollPanel() {
super.initScrollPanel();
scrollPanel.addListener(new ClickListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
return super.touchDown(event, x, y, pointer, button);
}
});
}
use of com.badlogic.gdx.scenes.scene2d.InputEvent in project Eidolons by IDemiurge.
the class OutcomePanel method handle.
@Override
public boolean handle(Event e) {
if (!(e instanceof InputEvent))
return true;
InputEvent event = ((InputEvent) e);
if (event.getType() != Type.touchDown)
return true;
if (getActions().size > 0)
return true;
Actor actor = event.getTarget();
if (actor instanceof Label) {
if (actor.getParent() instanceof TextButton) {
ActorMaster.addMoveToAction(this, getX(), GdxMaster.getHeight(), 1.5f);
// ActorMaster.addRemoveAfter(this);
final Boolean exit_continue_next = doneButton.getActor().getLabel() == actor ? null : exitButton.getActor().getLabel() == actor;
// public boolean act(float delta) {
if (exit_continue_next == null) {
if (!ExplorationMaster.isExplorationOn())
Eidolons.getGame().getMaster().nextLevel();
if (!BooleanMaster.isTrue(outcome))
Eidolons.getGame().getMetaMaster().getBattleMaster().getOutcomeManager().restart();
else
Eidolons.getGame().getMetaMaster().getBattleMaster().getOutcomeManager().next();
} else if (exit_continue_next) {
// if (DialogMaster.confirm("Must you really go?.."))
if (CoreEngine.isMacro()) {
GuiEventManager.trigger(GuiEventType.BATTLE_FINISHED);
} else {
Gdx.app.exit();
}
// else DialogMaster.inform("Glad you're still with us! :)");
} else {
WaitMaster.receiveInput(WAIT_OPERATIONS.GAME_FINISHED, false);
// DialogMaster.inform("Feel free to roam around, until next round...))");
}
remove();
return true;
// }
// });
}
}
return false;
}
use of com.badlogic.gdx.scenes.scene2d.InputEvent in project skin-composer by raeleus.
the class DialogDrawables method refreshDrawableDisplay.
private void refreshDrawableDisplay() {
contentGroup.clear();
if (drawables.size == 0) {
Label label = new Label("No drawables have been added!", getSkin());
contentGroup.addActor(label);
}
for (DrawableData drawable : drawables) {
Button drawableButton;
if (property != null || customProperty != null) {
drawableButton = new Button(getSkin(), "color-base");
drawableButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
result(drawable);
hide();
}
});
drawableButton.addListener(main.getHandListener());
} else {
drawableButton = new Button(getSkin(), "color-base-static");
}
contentGroup.addActor(drawableButton);
Table table = new Table();
drawableButton.add(table).width(sizes[MathUtils.floor(zoomSlider.getValue())]).height(sizes[MathUtils.floor(zoomSlider.getValue())]);
ClickListener fixDuplicateTouchListener = new ClickListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
event.setBubbles(false);
return super.touchDown(event, x, y, pointer, button);
}
};
// color wheel
if (!drawable.customized && !drawable.tiled) {
Button button = new Button(getSkin(), "colorwheel");
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
newTintedDrawable(drawable);
event.setBubbles(false);
}
});
button.addListener(fixDuplicateTouchListener);
if (property == null && customProperty == null) {
button.addListener(main.getHandListener());
}
table.add(button);
TextTooltip toolTip = new TextTooltip("New Tinted Drawable", main.getTooltipManager(), getSkin());
button.addListener(toolTip);
} else {
table.add();
}
// swatches
if (!drawable.customized && !drawable.tiled) {
Button button = new Button(getSkin(), "swatches");
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
colorSwatchesDialog(drawable);
event.setBubbles(false);
}
});
button.addListener(fixDuplicateTouchListener);
if (property == null && customProperty == null) {
button.addListener(main.getHandListener());
}
table.add(button);
TextTooltip toolTip = new TextTooltip("Tinted Drawable from Colors", main.getTooltipManager(), getSkin());
button.addListener(toolTip);
} else {
table.add();
}
// tiles button (NOT FOR TINTS OR CUSTOM DRAWABLES)
if (!drawable.customized && drawable.tint == null && drawable.tintName == null) {
;
Button button = new Button(getSkin(), "tiles");
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
tiledDrawableDialog(drawable);
event.setBubbles(false);
}
});
button.addListener(fixDuplicateTouchListener);
if (property == null && customProperty == null) {
button.addListener(main.getHandListener());
}
table.add(button);
TextTooltip toolTip = new TextTooltip("Tiled Drawable", main.getTooltipManager(), getSkin());
button.addListener(toolTip);
} else {
table.add();
}
// tiled settings
if (drawable.tiled) {
Button button = new Button(getSkin(), "settings-small");
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
tiledDrawableSettingsDialog(drawable);
event.setBubbles(false);
}
});
button.addListener(fixDuplicateTouchListener);
if (property == null && customProperty == null) {
button.addListener(main.getHandListener());
}
table.add(button);
TextTooltip toolTip = new TextTooltip("Tiled Drawable Settings", main.getTooltipManager(), getSkin());
button.addListener(toolTip);
} else // rename (ONLY FOR TINTS)
if (drawable.tint != null || drawable.tintName != null) {
Button button = new Button(getSkin(), "settings-small");
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
renameDrawableDialog(drawable);
event.setBubbles(false);
}
});
button.addListener(fixDuplicateTouchListener);
if (property == null && customProperty == null) {
button.addListener(main.getHandListener());
}
table.add(button);
TextTooltip toolTip = new TextTooltip("Rename Tinted Drawable", main.getTooltipManager(), getSkin());
button.addListener(toolTip);
} else // settings for custom drawables
if (drawable.customized) {
Button button = new Button(getSkin(), "settings-small");
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
renameCustomDrawableDialog(drawable);
event.setBubbles(false);
}
});
button.addListener(fixDuplicateTouchListener);
if (property == null && customProperty == null) {
button.addListener(main.getHandListener());
}
table.add(button);
TextTooltip toolTip = new TextTooltip("Rename Custom Drawable", main.getTooltipManager(), getSkin());
button.addListener(toolTip);
} else {
table.add();
}
// delete
Button button = new Button(getSkin(), "delete-small");
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
deleteDrawable(drawable);
event.setBubbles(false);
}
});
button.addListener(fixDuplicateTouchListener);
if (property == null && customProperty == null) {
button.addListener(main.getHandListener());
}
table.add(button).expandX().right();
TextTooltip toolTip = new TextTooltip("Delete Drawable", main.getTooltipManager(), getSkin());
button.addListener(toolTip);
// preview
table.row();
Container bg = new Container();
bg.setClip(true);
bg.setBackground(getSkin().getDrawable("white"));
bg.setColor(drawable.bgColor);
Image image = new Image(drawablePairs.get(drawable));
if (MathUtils.isZero(zoomSlider.getValue())) {
image.setScaling(Scaling.fit);
bg.fill(false);
} else {
image.setScaling(Scaling.stretch);
bg.fill();
}
bg.setActor(image);
table.add(bg).colspan(5).grow();
// name
table.row();
Label label = new Label(drawable.name, getSkin());
label.setEllipsis("...");
label.setEllipsis(true);
label.setAlignment(Align.center);
table.add(label).colspan(5).growX().width(sizes[MathUtils.floor(zoomSlider.getValue())]);
// Tooltip
toolTip = new TextTooltip(drawable.name, main.getTooltipManager(), getSkin());
label.addListener(toolTip);
}
}
Aggregations