use of com.janfic.games.computercombat.actors.DeckActor in project computercombat by janfic.
the class QueueScreen method populateDecks.
public void populateDecks() {
game.getCurrentProfile().getDecks().clear();
game.getCurrentProfile().getDecks().addAll(SQLAPI.getSingleton().getPlayerDecks(game.getCurrentProfile().getUID()));
decks.clearChildren();
for (Deck deck : game.getCurrentProfile().getDecks()) {
DeckActor d = new DeckActor(deck, skin);
d.setColor(Color.LIGHT_GRAY);
d.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
if (selectedDeck != null) {
selectedDeck.unselect();
}
if (d.getDeck().getCardCount(-1) != 8) {
Window window = new Window("Invalid Deck", skin);
window.setSize(stage.getWidth() / 2f, stage.getHeight() / 2f);
window.setPosition(stage.getWidth() / 4f, stage.getHeight() / 4f);
Label info = new Label("This is an invalid deck and cannot be played with: Invalid amount of cards.", skin);
info.setWrap(true);
info.setAlignment(Align.center);
TextButton okay = new TextButton("Okay", skin);
okay.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
window.remove();
}
});
window.add(info).grow().row();
window.add(okay).growX().row();
stage.addActor(window);
} else {
selectedDeck = d;
selectedDeck.select();
}
}
});
decks.add(d).row();
}
}
Aggregations