Commit e5af89e0 authored by Turid Cecilie Dahl's avatar Turid Cecilie Dahl
Browse files

Removes start delay and sets it as days per round

parent f0b38c37
......@@ -46,13 +46,11 @@ public class CreateNewTournamentState extends MenuStateTemplate {
private final Label timePerRoundLabel = new Label("Days per round", skin);
private final Label maxPlayersLabel = new Label("Max players", skin);
private final Label roundsPerGameLabel = new Label("Rounds per game", skin);
private final Label startDelayLabel = new Label("Days before start", skin);
private final Label nameLabelQuestion = new Label("Name of the tournament. This will be shown to other players", skin);
private final Label timePerRoundLabelQuestion = new Label("Number of days that players have to finish their own turn in the tournament. If they don't finish within the dealine they are kicked out of the tournament.", skin);
private final Label timePerRoundLabelQuestion = new Label("Number of days that players have to finish their own turn in the tournament. If they don't finish within the dealine they are kicked out of the tournament.\n\nEven if max number of players has not been reached, the tournament still starts after specified number of days.", skin);
private final Label maxPlayersLabelQuestion = new Label("Max number of players able to enter the tournament. If max number of players enter and play their round, then the tournament continues.", skin);
private final Label roundsPerGameLabelQuestion = new Label("Number of rounds per game. For example if you choose 2 games, and have 3 rounds per game then you will play each game 3 times.", skin);
private final Label startDelayLabelQuestion = new Label("Max days before tournament starts. Even if max number of players has not been reached, the tournament still starts after specified number of days.", skin);
// Texts
private final String backBtnText = "Back";
......@@ -69,14 +67,12 @@ public class CreateNewTournamentState extends MenuStateTemplate {
private SelectBox timePerRoundSelectBox = new SelectBox(skin);
private SelectBox maxPlayersSelectBox = new SelectBox(skin);
private SelectBox roundsPerGameSelectBox = new SelectBox(skin);
private SelectBox startDelaySelectBox = new SelectBox(skin);
// User inputs
private String nameUserInput = "";
private int timePerRoundUserInput = 1;
private int maxPlayersUserInput = 2;
private int roundsPerGameUserInput = 1;
private int startDelayUserInput = 1;
// Variables
private int page = 1;
......@@ -94,7 +90,6 @@ public class CreateNewTournamentState extends MenuStateTemplate {
private Dialog timePerRoundDialog;
private Dialog maxPlayersDialog;
private Dialog roundsPerGameDialog;
private Dialog startDelayDialog;
// Loading text
private LoadingText loadingText = new LoadingText();
......@@ -113,13 +108,11 @@ public class CreateNewTournamentState extends MenuStateTemplate {
timePerRoundSelectBox.setItems(1,2,3,4,5);
maxPlayersSelectBox.setItems(2,3,4,5);
roundsPerGameSelectBox.setItems(1,2,3);
startDelaySelectBox.setItems(1,2,3);
nameDialog = makeQuestionIconDialog(nameLabelQuestion);
timePerRoundDialog = makeQuestionIconDialog(timePerRoundLabelQuestion);
maxPlayersDialog = makeQuestionIconDialog(maxPlayersLabelQuestion);
roundsPerGameDialog = makeQuestionIconDialog(roundsPerGameLabelQuestion);
startDelayDialog = makeQuestionIconDialog(startDelayLabelQuestion);
makeStage();
}
......@@ -151,17 +144,14 @@ public class CreateNewTournamentState extends MenuStateTemplate {
innerTable.add(nameInputField).size(nameFieldWidth, inputFieldHeight);
innerTable.row();
removeKeyPadAtTouch();
innerTable.add(makeTableWithLabelAndQuestionIcon(timePerRoundLabel, timePerRoundDialog));
innerTable.add(timePerRoundSelectBox);
innerTable.row();
innerTable.add(makeTableWithLabelAndQuestionIcon(maxPlayersLabel, maxPlayersDialog));
innerTable.add(maxPlayersSelectBox);
innerTable.row();
innerTable.add(makeTableWithLabelAndQuestionIcon(roundsPerGameLabel, roundsPerGameDialog));
innerTable.add(roundsPerGameSelectBox);
innerTable.row();
innerTable.add(makeTableWithLabelAndQuestionIcon(startDelayLabel, startDelayDialog));
innerTable.add(startDelaySelectBox);
innerTable.add(makeTableWithLabelAndQuestionIcon(timePerRoundLabel, timePerRoundDialog));
innerTable.add(timePerRoundSelectBox);
rootTable.add(innerTable).colspan(2);
rootTable.row();
rootTable.add(errorLabel).colspan(2);
......@@ -264,7 +254,6 @@ public class CreateNewTournamentState extends MenuStateTemplate {
timePerRoundUserInput = getTimePerRound();
maxPlayersUserInput = getMaxPlayers();
roundsPerGameUserInput = getRoundsPerGame();
startDelayUserInput = getStartDelay();
stage.clear();
makeStage();
......@@ -339,7 +328,6 @@ public class CreateNewTournamentState extends MenuStateTemplate {
timePerRoundSelectBox.setSelected(timePerRoundUserInput);
maxPlayersSelectBox.setSelected(maxPlayersUserInput);
roundsPerGameSelectBox.setSelected(roundsPerGameUserInput);
startDelaySelectBox.setSelected(startDelayUserInput);
}
}
......@@ -350,7 +338,7 @@ public class CreateNewTournamentState extends MenuStateTemplate {
return;
}
try {
tournament = new Tournament(GameWare.getInstance().getPlayer().getId(),chosenGames,nameUserInput, timePerRoundUserInput, maxPlayersUserInput, roundsPerGameUserInput,1,chosenGames.size(),startDelayUserInput);
tournament = new Tournament(GameWare.getInstance().getPlayer().getId(),chosenGames,nameUserInput, timePerRoundUserInput, maxPlayersUserInput, roundsPerGameUserInput,1,chosenGames.size(),timePerRoundUserInput);
tournamentFromDB = QueryIntermediate.createNewTournament(tournament);
round = QueryIntermediate.getRoundFromTournament(tournamentFromDB.get_id(), GameWare.getInstance().getPlayer().getId(), tournamentFromDB.getCurrentRound());
gsm.set(new ViewTournamentState(gsm,tournamentFromDB,round));
......@@ -376,7 +364,6 @@ public class CreateNewTournamentState extends MenuStateTemplate {
return (int) roundsPerGameSelectBox.getSelected();
}
private int getStartDelay(){ return (int) startDelaySelectBox.getSelected(); }
private void removeKeyPadAtTouch(){
stage.getRoot().addCaptureListener(new InputListener() {
......@@ -404,12 +391,10 @@ public class CreateNewTournamentState extends MenuStateTemplate {
timePerRoundUserInput = 1;
maxPlayersUserInput = 2;
roundsPerGameUserInput = 1;
startDelayUserInput = 1;
timePerRoundSelectBox.setSelected(timePerRoundUserInput);
maxPlayersSelectBox.setSelected(maxPlayersUserInput);
roundsPerGameSelectBox.setSelected(roundsPerGameUserInput);
startDelaySelectBox.setSelected(startDelayUserInput);
for(CheckBox cb : checkBoxes){
cb.setChecked(false);
......
......@@ -8,7 +8,7 @@ import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.gameware.game.GameWare;
public abstract class State{
public abstract class State {
// Common variables between MenuStateTemplate and PlayStateTemplate
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment