Show match time value in table view.

This commit is contained in:
LevelX2 2013-07-02 17:02:03 +02:00
parent a71285a768
commit 35433e55b8
3 changed files with 14 additions and 5 deletions

View file

@ -91,7 +91,7 @@ public class TableView implements Serializable {
this.controllerName += sb.toString();
this.deckType = table.getDeckType();
if (table.getMatch().getGames().isEmpty()) {
this.additionalInfo = "";
this.additionalInfo = new StringBuilder("Timer: ").append(table.getMatch().getOptions().getMatchTimeLimit().toString()).toString();
} else {
this.additionalInfo = sbScore.toString();
}

View file

@ -149,15 +149,17 @@ public class Table implements Serializable {
throw new GameException("Seat is occupied.");
}
seat.setPlayer(player);
if (isReady())
if (isReady()) {
state = TableState.STARTING;
}
return seat.getPlayer().getId();
}
private boolean isReady() {
for (int i = 0; i < numSeats; i++ ) {
if (seats[i].getPlayer() == null)
if (seats[i].getPlayer() == null) {
return false;
}
}
return true;
}
@ -172,8 +174,9 @@ public class Table implements Serializable {
public Seat getNextAvailableSeat(String playerType) {
for (int i = 0; i < numSeats; i++ ) {
if (seats[i].getPlayer() == null && seats[i].getPlayerType().equals(playerType))
if (seats[i].getPlayer() == null && seats[i].getPlayerType().equals(playerType)) {
return seats[i];
}
}
return null;
}
@ -183,8 +186,9 @@ public class Table implements Serializable {
Player player = seats[i].getPlayer();
if (player != null && player.getId().equals(playerId)) {
seats[i].setPlayer(null);
if (state == TableState.STARTING)
if (state == TableState.STARTING) {
state = TableState.WAITING;
}
break;
}
}

View file

@ -131,6 +131,11 @@ public class MatchOptions implements Serializable {
return matchTimeLimit.getTimeLimit();
}
public MatchTimeLimit getMatchTimeLimit() {
return this.matchTimeLimit;
}
public void setMatchTimeLimit(MatchTimeLimit matchTimeLimit) {
this.matchTimeLimit = matchTimeLimit;
}