mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Show match time value in table view.
This commit is contained in:
parent
a71285a768
commit
35433e55b8
3 changed files with 14 additions and 5 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue