Skip to content
Snippets Groups Projects
Commit bf172b71 authored by Haakon Gunleiksrud's avatar Haakon Gunleiksrud
Browse files

#64 Added background and done minor frontend fixes. Added dropdown selection...

#64 Added background and done minor frontend fixes. Added dropdown selection box and logic for choosing startDelay.
parent 61932ef2
No related branches found
No related tags found
1 merge request!61Resolve "Start delay frontend"
......@@ -11,6 +11,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Align;
import com.gameware.game.GameWare;
import com.gameware.game.QueryIntermediate;
import com.gameware.game.models.Game;
......@@ -26,12 +27,14 @@ public class CreateNewTournamentState extends State {
private Label title = new Label("Create new\ntournament", skin, "big");
private String nameText = "Name";
private TextField nameInputField;
private String timePerRoundText = "Hours to complete each round";
private String timePerRoundText = "Hours to \n complete each round";
private SelectBox timePerRoundSelectBox;
private String maxPlayersText = "Max number of players";
private SelectBox maxPlayersSelectBox;
private String roundsPerGameText = "Round per game";
private SelectBox roundsPerGameSelectBox;
private String startDelayText = "Time wait for more \n players before start";
private SelectBox startDelaySelectBox;
private Label errorLabel = new Label("", skin, "error");
......@@ -60,31 +63,42 @@ public class CreateNewTournamentState extends State {
table = new Table();
table.setFillParent(true);
table.setBackground(background);
title.setFontScale(titleFontBigScale);
table.add(title).colspan(2).spaceBottom(spacingOnBottomInputFIeld);
table.row();
table.add(makeLabel(nameText,skin));
nameInputField = new TextField("",skin);
nameInputField.setMaxLength(10);
table.add(nameInputField).size(nameFieldWidth, inputFieldHeight).spaceBottom(spacingOnBottom);
table.row();
table.add(makeLabel(timePerRoundText,skin));
timePerRoundSelectBox = new SelectBox(skin);
timePerRoundSelectBox.setItems(1,2,3,4,5);
table.add(timePerRoundSelectBox).spaceBottom(spacingOnBottom);
table.row();
table.add(makeLabel(maxPlayersText,skin));
maxPlayersSelectBox = new SelectBox(skin);
maxPlayersSelectBox.setItems(2,3,4,5);
table.add(maxPlayersSelectBox).spaceBottom(spacingOnBottom);
table.row();
table.add(makeLabel(roundsPerGameText,skin));
roundsPerGameSelectBox = new SelectBox(skin);
roundsPerGameSelectBox.setItems(1,2,3);
table.add(roundsPerGameSelectBox).spaceBottom(spacingOnBottom);
table.row();
table.add(makeLabel(startDelayText,skin)).spaceBottom(spacingOnBottom);
startDelaySelectBox = new SelectBox(skin);
startDelaySelectBox.setItems(1,2,3);
table.add(startDelaySelectBox).spaceBottom(spacingOnBottom);
table.row();
for (final Game g : games){
Label gameLabel = new Label(g.getName(),skin);
table.add(gameLabel).spaceBottom(spacingOnBottom);
......@@ -115,6 +129,7 @@ public class CreateNewTournamentState extends State {
private Label makeLabel(String text, Skin skin){
Label label = new Label(text,skin);
label.setAlignment(Align.center);
return label;
}
......@@ -187,7 +202,7 @@ public class CreateNewTournamentState extends State {
}
try {
tournament = new Tournament(GameWare.getInstance().getPlayer().getId(),chosenGames,getTournamentName(),getTimePerRound(),getMaxPlayers(),getRoundsPerGame(),1,chosenGames.size());
tournament = new Tournament(GameWare.getInstance().getPlayer().getId(),chosenGames,getTournamentName(),getTimePerRound(),getMaxPlayers(),getRoundsPerGame(),1,chosenGames.size(),getStartDelay());
round = new Round();
QueryIntermediate.createNewTournament(tournament);
} catch (IOException e) {
......@@ -212,4 +227,6 @@ public class CreateNewTournamentState extends State {
return (int) roundsPerGameSelectBox.getSelected();
}
private int getStartDelay(){ return (int) startDelaySelectBox.getSelected(); }
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment