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.controllerName += sb.toString();
this.deckType = table.getDeckType(); this.deckType = table.getDeckType();
if (table.getMatch().getGames().isEmpty()) { if (table.getMatch().getGames().isEmpty()) {
this.additionalInfo = ""; this.additionalInfo = new StringBuilder("Timer: ").append(table.getMatch().getOptions().getMatchTimeLimit().toString()).toString();
} else { } else {
this.additionalInfo = sbScore.toString(); this.additionalInfo = sbScore.toString();
} }

View file

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

View file

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