use of com.badlogic.gdx.scenes.scene2d.InputEvent in project Eidolons by IDemiurge.
the class NewGamePanel method updateAct.
@Override
public void updateAct(float delta) {
final List<ScreenData> dataList = (List<ScreenData>) getUserObject();
dataList.forEach(data -> {
TextButton button = getMainMenuButton(data.getName());
button.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
if (choiceCallback != null) {
choiceCallback.accept(data);
}
}
});
add(button);
row();
});
addEmptyRow(0, 30);
back = getMainMenuButton("back");
if (backListener != null) {
back.addListener(backListener);
}
add(back);
}
use of com.badlogic.gdx.scenes.scene2d.InputEvent in project Eidolons by IDemiurge.
the class GridPanel method init.
public GridPanel init(DequeImpl<BattleFieldObject> units) {
this.viewMap = new HashMap<>();
emptyImage = TextureCache.getOrCreateR(getCellImagePath());
cornerRegion = TextureCache.getOrCreateR(gridCornerElementPath);
cells = new GridCellContainer[cols][rows];
int rows1 = rows - 1;
for (int x = 0; x < cols; x++) {
for (int y = 0; y < rows; y++) {
cells[x][y] = new GridCellContainer(emptyImage, x, rows1 - y);
cells[x][y].setX(x * GridMaster.CELL_W);
cells[x][y].setY(y * GridMaster.CELL_H);
addActor(cells[x][y].init());
checkAddBorder(x, y);
}
}
if (OptionsMaster.getGraphicsOptions().getBooleanValue(GRAPHIC_OPTION.SPRITE_CACHE_ON))
TextureManager.addCellsToCache(cols, rows);
addActor(new CellBorderManager());
bindEvents();
createUnitsViews(units);
setHeight(cells[0][0].getHeight() * rows);
setWidth(cells[0][0].getWidth() * cols);
addListener(new BattleClickListener() {
@Override
public boolean mouseMoved(InputEvent event, float x, float y) {
GridPanel.this.getStage().setScrollFocus(GridPanel.this);
return false;
}
@Override
public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) {
// return PhaseAnimator.getInstance().checkAnimClicked(x, y, pointer, button);
return false;
}
});
addActor(overlayManager = new OverlaysManager(this));
addActor(animMaster = AnimMaster.getInstance());
animMaster.bindEvents();
if (AnimationConstructor.isPreconstructAllOnGameInit())
units.forEach(unit -> {
if (unit instanceof Unit)
animMaster.getConstructor().preconstructAll((Unit) unit);
});
if (fpsDebug) {
fpsLabel = new Label("0", StyleHolder.getDefaultLabelStyle());
addActor(fpsLabel);
fpsLabel.setAlignment(Align.topLeft);
}
return this;
}
use of com.badlogic.gdx.scenes.scene2d.InputEvent in project Eidolons by IDemiurge.
the class UnitViewFactory method createListener.
public static ClickListener createListener(BattleFieldObject bfObj) {
return new BattleClickListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
// event.getButton() == Input.Buttons.RIGHT;
return true;
}
@Override
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
if (IntroTestLauncher.running) {
ScenarioMetaMaster m = new ScenarioMetaMaster("Pride and Treachery");
// new LinearDialogue();
GameDialogue dialogue = null;
dialogue = bfObj.getGame().getMetaMaster().getDialogueFactory().getDialogue("Interrogation");
List<DialogScenario> list = SceneFactory.getScenes(dialogue);
GuiEventManager.trigger(GuiEventType.DIALOG_SHOW, list);
}
if (event.getButton() == Input.Buttons.RIGHT) {
GuiEventManager.trigger(CREATE_RADIAL_MENU, bfObj);
event.handle();
event.stop();
} else {
if (event.getButton() == Buttons.LEFT)
if (isAlt() || isShift() || isControl())
try {
DefaultActionHandler.leftClickUnit(isShift(), isControl(), bfObj);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
GuiEventManager.trigger(RADIAL_MENU_CLOSE);
}
}
};
}
use of com.badlogic.gdx.scenes.scene2d.InputEvent in project Eidolons by IDemiurge.
the class ScrollPanel method init.
private void init() {
this.setTouchable(Touchable.enabled);
left().bottom();
setClip(true);
table = new Table();
table.setFillParent(true);
table.align(Align.left);
table.setLayoutEnabled(true);
table.pack();
innerScrollContainer = new InnerScrollContainer<>();
innerScrollContainer.left().bottom();
innerScrollContainer.setActor(table);
innerScrollContainer.setX(0);
innerScrollContainer.setY(0);
super.setActor(innerScrollContainer);
addCaptureListener(new InputListener() {
private float yy;
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
event.stop();
yy = y;
instantOffsetY = 0;
offsetY = 0;
return true;
}
@Override
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
offsetY += instantOffsetY * 6;
instantOffsetY = 0;
}
@Override
public void touchDragged(InputEvent event, float x, float y, int pointer) {
instantOffsetY += y - yy;
}
public boolean scrolled(InputEvent event, float x, float y, int amount) {
offsetY += amount * 3500;
return true;
}
@Override
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
getStage().setScrollFocus(ScrollPanel.this);
}
@Override
public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) {
getStage().setScrollFocus(null);
}
});
}
use of com.badlogic.gdx.scenes.scene2d.InputEvent in project Eidolons by IDemiurge.
the class TabbedPanel method addTab.
public void addTab(T actor, String tabName) {
TextButton b = new TextButton(tabName, getButtonStyle());
if (buttonLayout == null) {
initContainer();
}
b.addListener(new InputListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
tabSelected(tabName);
return true;
}
});
buttonGroup.add(b);
buttonLayout.add(b).left();
tabs.add(actor);
buttonGroup.setChecked(tabName);
tabsToNamesMap.put(tabName, actor);
}
Aggregations