Tournaments status is updated now and if tournament finished, it's moved to the lower finished matches view.

This commit is contained in:
LevelX2 2013-03-27 22:31:15 +01:00
parent 095c3c5776
commit 402f7fffd9
12 changed files with 89 additions and 24 deletions

View file

@ -32,8 +32,10 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.game.Game;
import mage.game.Table;
import mage.game.match.Match;
import mage.game.match.MatchPlayer;
import mage.game.tournament.TournamentPlayer;
/**
*
@ -69,6 +71,25 @@ public class MatchView implements Serializable {
}
// used for tournaments
public MatchView(Table table) {
this.matchId = table.getTournament().getId();
this.matchName = table.getName();
this.gameType = table.getGameType();
this.deckType = table.getDeckType();
StringBuilder sb1 = new StringBuilder();
for (TournamentPlayer tPlayer : table.getTournament().getPlayers()) {
sb1.append(tPlayer.getPlayer().getName()).append(" (").append(tPlayer.getPoints()).append(" P.) ");
}
this.players = sb1.toString();
StringBuilder sb2 = new StringBuilder();
for (TournamentPlayer tPlayer : table.getTournament().getPlayers()) {
sb2.append(tPlayer.getPlayer().getName()).append(": ").append(tPlayer.getResults()).append(" ");
}
this.result = sb2.toString();
}
public UUID getMatchId() {
return matchId;
}

View file

@ -75,7 +75,11 @@ public class TableView implements Serializable {
games.add(game.getId());
}
} else {
this.additionalInfo = new StringBuilder("Seats: ").append(table.getTournament().getPlayers().size()).append("/").append(table.getNumberOfSeats()).toString();
StringBuilder sb = new StringBuilder("Seats: ").append(table.getTournament().getPlayers().size()).append("/").append(table.getNumberOfSeats());
if (table.getState().equals(TableState.DUELING)) {
sb.append(" - Running round: ").append(table.getTournament().getRounds().size());
}
this.additionalInfo = sb.toString();
}
}