use of com.badlogic.gdx.scenes.scene2d.utils.ClickListener in project AnotherMonekyParadox by SantiagoMille.
the class PantallaScoresStory method crearMenu.
@Override
void crearMenu() {
super.stageMenu = new Stage(vista);
title = new Texto(1, 1, 1);
imgBackground = new Texture("logros.png");
spriteBackground = new Sprite(imgBackground);
spriteBackground.setPosition(0, 0);
// spriteBackground.setAlpha(0.7f);
Skin skin = new Skin(Gdx.files.internal("skin/comic-ui.json"));
Preferences prefs = Gdx.app.getPreferences("AnotherMonkeyPreferenceStory");
String names = prefs.getString("names", null);
if (names == null) {
// prefs.putString("names", "Astro");
names = "Astro,";
}
String scores = prefs.getString("highscores", null);
if (scores == null) {
// prefs.putString("highscores", "10000");
scores = "10000,";
}
Table table = new Table(skin);
table.defaults().pad(10f);
table.setFillParent(true);
table.setPosition(table.getX(), table.getY() + 250);
/**
* Se hace el titulo de scores
*/
// Label scoresTitle = new Label("HIGHSCORES STORY MODE", skin);
// scoresTitle.setFontScale(4f,4f);
// scoresTitle.setAlignment(Align.center);
/**
* Se crean las columnas con puntuajes
*/
Label columnName;
Label columnScore;
String[] allScores = scores.split(",");
String[] allNames = names.split(",");
int i = 0;
// table.add(scoresTitle).colspan(2).fillX().height(150);
table.row();
for (String name : allNames) {
columnName = new Label(name + ": ", skin);
columnName.setFontScale(3f, 3f);
table.add(columnName);
columnScore = new Label(allScores[i], skin);
columnScore.setFontScale(3f, 3f);
table.add(columnScore);
i++;
table.row();
}
// Boton Return
TextureRegionDrawable trdReturn = new TextureRegionDrawable(new TextureRegion(new Texture("go-back.png")));
ImageButton btnReturn = new ImageButton(trdReturn);
btnReturn.setPosition(30, ALTO - 30 - btnReturn.getHeight());
// Click en boton Return
btnReturn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
main.setScreen(new PantallaMenu(main));
}
});
stageMenu.addActor(table);
stageMenu.addActor(btnReturn);
Gdx.input.setInputProcessor(stageMenu);
}
use of com.badlogic.gdx.scenes.scene2d.utils.ClickListener in project AnotherMonekyParadox by SantiagoMille.
the class PantallaTutorial method crearMainView.
private void crearMainView() {
stageMenu = new Stage(vista);
imgBackground = new Texture("pantall_tutorial.png");
spriteBackground = new Sprite(imgBackground);
spriteBackground.setPosition(0, 0);
// spriteBackground.setAlpha(0.7f);
// Boton Return
TextureRegionDrawable trdReturn = new TextureRegionDrawable(new TextureRegion(new Texture("go-back.png")));
ImageButton btnReturn = new ImageButton(trdReturn);
btnReturn.setPosition(30, ALTO - 30 - btnReturn.getHeight());
// Click en boton Return
btnReturn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
// Gdx.app.log("ClickListener","Si se clickeoooo");
main.setScreen(new PantallaMenu(main));
}
});
stageMenu.addActor(btnReturn);
Gdx.input.setInputProcessor(stageMenu);
}
use of com.badlogic.gdx.scenes.scene2d.utils.ClickListener in project gdx-skineditor by cobolfoo.
the class WidgetsBar method initializeButtons.
/**
*/
public void initializeButtons() {
group = new ButtonGroup();
Tooltips.TooltipStyle styleTooltip = new Tooltips.TooltipStyle(game.skin.getFont("default-font"), game.skin.getDrawable("default-round"), game.skin.getColor("white"));
String[] widgets = SkinEditorGame.widgets;
for (String widget : widgets) {
ImageButtonStyle style = new ImageButtonStyle();
style.checked = game.skin.getDrawable("default-round-down");
style.down = game.skin.getDrawable("default-round-down");
style.up = game.skin.getDrawable("default-round");
style.imageUp = game.skin.getDrawable("widgets/" + widget);
ImageButton button = new ImageButton(style);
button.setUserObject(widget);
Tooltips tooltip = new Tooltips(styleTooltip, getStage());
tooltip.registerTooltip(button, (String) button.getUserObject());
button.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
game.screenMain.panePreview.refresh();
game.screenMain.paneOptions.refresh();
}
});
group.add(button);
add(button).pad(5);
}
}
use of com.badlogic.gdx.scenes.scene2d.utils.ClickListener in project bladecoder-adventure-engine by bladecoder.
the class DefaultSceneScreen method setUI.
@Override
public void setUI(final UI ui) {
this.ui = ui;
recorder = ui.getRecorder();
testerBot = ui.getTesterBot();
pie = new PieMenu(this);
textManagerUI = new TextManagerUI(ui.getSkin());
menuButton = new Button(ui.getSkin(), "menu");
dialogUI = new DialogUI(ui);
pointer = new ScenePointer(ui.getSkin());
inventoryUI = new InventoryUI(this, pointer);
inventoryButton = new InventoryButton(ui.getSkin(), inventoryUI);
uiMode = UIModes.valueOf(Config.getProperty(Config.UI_MODE, "TWO_BUTTONS").toUpperCase(Locale.ENGLISH));
if (Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen) && uiMode == UIModes.TWO_BUTTONS) {
uiMode = UIModes.PIE;
}
pie.setVisible(false);
menuButton.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
ui.setCurrentScreen(Screens.MENU_SCREEN);
}
});
retrieveAssets(ui.getUIAtlas());
stage = new Stage(viewport);
stage.addActor(textManagerUI);
stage.addActor(dialogUI);
stage.addActor(inventoryButton);
stage.addActor(menuButton);
stage.addActor(inventoryUI);
stage.addActor(pie);
}
use of com.badlogic.gdx.scenes.scene2d.utils.ClickListener in project bladecoder-adventure-engine by bladecoder.
the class VerbUI method createInventoryPanel.
private Table createInventoryPanel() {
Table inventory = new Table();
inventory.defaults().pad(MARGIN);
for (int i = 0; i < INVENTORY_COLS * INVENTORY_ROWS; i++) {
if (i % INVENTORY_COLS == 0)
inventory.row();
ImageButton.ImageButtonStyle s = new ImageButton.ImageButtonStyle(style.inventoryButtonStyle);
RendererDrawable r = new RendererDrawable();
s.imageUp = r;
ImageButton b = new ImageButton(s);
inventory.add(b).fill().expand();
b.setUserObject(i);
inventorySlots.add(b);
b.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
int i = (Integer) event.getListenerActor().getUserObject();
Inventory inv = World.getInstance().getInventory();
target = null;
if (i < inv.getNumItems()) {
InteractiveActor actor = inv.get(i);
if (currentVerb.equals("use") || currentVerb.equals("give")) {
target = actor;
} else {
sceneScreen.runVerb(actor, currentVerb, null);
}
}
}
});
b.getImageCell().pad(MARGIN).expand().fill();
}
return inventory;
}
Aggregations