mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
* UI: added game name and seats number columns to tables list;
This commit is contained in:
parent
12b8c12d74
commit
cfff0f8116
3 changed files with 83 additions and 58 deletions
|
|
@ -1,11 +1,5 @@
|
|||
|
||||
package mage.view;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.constants.SkillLevel;
|
||||
import mage.constants.TableState;
|
||||
import mage.game.Game;
|
||||
|
|
@ -15,6 +9,12 @@ import mage.game.draft.Draft;
|
|||
import mage.game.match.MatchPlayer;
|
||||
import mage.game.tournament.TournamentPlayer;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
|
@ -32,6 +32,7 @@ public class TableView implements Serializable {
|
|||
private TableState tableState;
|
||||
private final SkillLevel skillLevel;
|
||||
private final String tableStateText;
|
||||
private final String seatsInfo;
|
||||
private boolean isTournament;
|
||||
private List<SeatView> seats = new ArrayList<>();
|
||||
private List<UUID> games = new ArrayList<>();
|
||||
|
|
@ -46,10 +47,6 @@ public class TableView implements Serializable {
|
|||
this.tableId = table.getId();
|
||||
this.gameType = table.getGameType();
|
||||
this.tableName = table.getName();
|
||||
String tableNameInfo = null;
|
||||
if (tableName != null && !tableName.isEmpty()) {
|
||||
tableNameInfo = " [" + table.getName() + ']';
|
||||
}
|
||||
this.controllerName = table.getControllerName();
|
||||
this.tableState = table.getState();
|
||||
if (table.getState() == TableState.WAITING
|
||||
|
|
@ -69,8 +66,9 @@ public class TableView implements Serializable {
|
|||
}
|
||||
if (!table.isTournament()) {
|
||||
// MATCH
|
||||
seatsInfo = "" + table.getMatch().getPlayers().size() + '/' + table.getSeats().length;
|
||||
if (table.getState() == TableState.WAITING || table.getState() == TableState.READY_TO_START) {
|
||||
tableStateText = table.getState().toString() + " (" + table.getMatch().getPlayers().size() + '/' + table.getSeats().length + ')';
|
||||
tableStateText = table.getState().toString() + " (" + seatsInfo + ')';
|
||||
} else {
|
||||
tableStateText = table.getState().toString();
|
||||
}
|
||||
|
|
@ -94,7 +92,7 @@ public class TableView implements Serializable {
|
|||
sbScore.append(" Draws: ").append(table.getMatch().getDraws());
|
||||
}
|
||||
this.controllerName += sb.toString();
|
||||
this.deckType = table.getDeckType() + (tableNameInfo != null ? tableNameInfo : "");
|
||||
this.deckType = table.getDeckType();
|
||||
StringBuilder addInfo = new StringBuilder();
|
||||
if (table.getMatch().getGames().isEmpty()) {
|
||||
addInfo.append("Wins:").append(table.getMatch().getWinsNeeded());
|
||||
|
|
@ -129,10 +127,11 @@ public class TableView implements Serializable {
|
|||
}
|
||||
}
|
||||
this.controllerName += sb1.toString();
|
||||
this.seatsInfo = "" + table.getTournament().getPlayers().size() + "/" + table.getNumberOfSeats();
|
||||
StringBuilder infoText = new StringBuilder();
|
||||
StringBuilder stateText = new StringBuilder(table.getState().toString());
|
||||
infoText.append("Wins:").append(table.getTournament().getOptions().getMatchOptions().getWinsNeeded());
|
||||
infoText.append(" Seats: ").append(table.getTournament().getPlayers().size()).append('/').append(table.getNumberOfSeats());
|
||||
infoText.append(" Seats: ").append(this.seatsInfo);
|
||||
switch (table.getState()) {
|
||||
case WAITING:
|
||||
stateText.append(" (").append(table.getTournament().getPlayers().size()).append('/').append(table.getNumberOfSeats()).append(')');
|
||||
|
|
@ -158,7 +157,7 @@ public class TableView implements Serializable {
|
|||
}
|
||||
this.additionalInfo = infoText.toString();
|
||||
this.tableStateText = stateText.toString();
|
||||
this.deckType = table.getDeckType() + ' ' + table.getTournament().getBoosterInfo() + (tableNameInfo != null ? tableNameInfo : "");
|
||||
this.deckType = table.getDeckType() + ' ' + table.getTournament().getBoosterInfo();
|
||||
this.skillLevel = table.getTournament().getOptions().getMatchOptions().getSkillLevel();
|
||||
this.quitRatio = Integer.toString(table.getTournament().getOptions().getQuitRatio());
|
||||
this.minimumRating = Integer.toString(table.getTournament().getOptions().getMinimumRating());
|
||||
|
|
@ -180,11 +179,11 @@ public class TableView implements Serializable {
|
|||
public String getControllerName() {
|
||||
return controllerName;
|
||||
}
|
||||
|
||||
|
||||
public boolean getSpectatorsAllowed() {
|
||||
return spectatorsAllowed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getGameType() {
|
||||
return gameType;
|
||||
|
|
@ -210,6 +209,10 @@ public class TableView implements Serializable {
|
|||
return games;
|
||||
}
|
||||
|
||||
public String getSeatsInfo() {
|
||||
return seatsInfo;
|
||||
}
|
||||
|
||||
public boolean isTournament() {
|
||||
return this.isTournament;
|
||||
}
|
||||
|
|
@ -226,9 +229,13 @@ public class TableView implements Serializable {
|
|||
return skillLevel;
|
||||
}
|
||||
|
||||
public String getQuitRatio() { return quitRatio; }
|
||||
public String getQuitRatio() {
|
||||
return quitRatio;
|
||||
}
|
||||
|
||||
public String getMinimumRating() { return minimumRating; }
|
||||
public String getMinimumRating() {
|
||||
return minimumRating;
|
||||
}
|
||||
|
||||
public boolean isLimited() {
|
||||
return limited;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue