* Number of wins can be set for tournaments. * Current score of running matches is shown in the table list.

This commit is contained in:
LevelX2 2013-06-10 16:25:31 +02:00
parent bbf277f17e
commit 3dbdba32e9
6 changed files with 129 additions and 52 deletions

View file

@ -49,6 +49,7 @@ public class TableView implements Serializable {
private UUID tableId;
private String gameType;
private int wins;
private String deckType;
private String tableName;
private String controllerName;
@ -71,19 +72,30 @@ public class TableView implements Serializable {
seats.add(new SeatView(seat));
}
if (!table.isTournament()) {
this.additionalInfo = new StringBuilder("Wins: ").append(table.getMatch().getWinsNeeded()).toString();
this.wins = table.getMatch().getWinsNeeded();
for (Game game: table.getMatch().getGames()) {
games.add(game.getId());
}
StringBuilder sb = new StringBuilder();
StringBuilder sbScore = new StringBuilder("Score: ");
for(MatchPlayer matchPlayer: table.getMatch().getPlayers()) {
if (!matchPlayer.getPlayer().getName().equals(table.getControllerName())) {
sb.append(", ").append(matchPlayer.getPlayer().getName());
sbScore.append("-").append(matchPlayer.getWins());
} else {
sbScore.insert(0,matchPlayer.getWins()).insert(0,"Score: ");
}
}
this.controllerName += sb.toString();
this.deckType = table.getDeckType();
if (table.getMatch().getGames().isEmpty()) {
this.additionalInfo = "";
} else {
this.additionalInfo = sbScore.toString();
}
} else {
this.wins = table.getTournament().getOptions().getMatchOptions().getWinsNeeded();
StringBuilder sb1 = new StringBuilder();
for (TournamentPlayer tp: table.getTournament().getPlayers()) {
if (!tp.getPlayer().getName().equals(table.getControllerName())) {
@ -98,7 +110,6 @@ public class TableView implements Serializable {
this.additionalInfo = sb.toString();
this.deckType = new StringBuilder(table.getDeckType()).append(" ").append(table.getTournament().getSetsFormatedShort()).toString();
}
}
public UUID getTableId() {
@ -117,6 +128,10 @@ public class TableView implements Serializable {
return gameType;
}
public int getWins() {
return wins;
}
public String getDeckType() {
return deckType;
}