* Client Windows - Name of game in windows sub menu is now build with player names.

This commit is contained in:
LevelX2 2014-06-25 01:32:55 +02:00
parent 5ae1f6306b
commit eb1e8dda14
2 changed files with 18 additions and 2 deletions

View file

@ -62,7 +62,7 @@ public class GamePane extends MagePane {
public void showGame(UUID gameId, UUID playerId) {
this.setTitle("Game " + gameId);
this.gameId = gameId;
gamePanel.showGame(gameId, playerId);
gamePanel.showGame(gameId, playerId, this);
}
public void cleanUp() {

View file

@ -134,6 +134,7 @@ public final class GamePanel extends javax.swing.JPanel {
private UUID gameId;
private UUID playerId;
private Session session;
GamePane gamePane;
private ReplayTask replayTask;
private final PickNumberDialog pickNumber;
private JLayeredPane jLayeredPane;
@ -141,6 +142,7 @@ public final class GamePanel extends javax.swing.JPanel {
private boolean smallMode = false;
private boolean initialized = false;
private int lastUpdatedTurn;
private boolean menuNameSet = false;
private Map<String, Card> loadedCards = new HashMap<>();
@ -336,8 +338,9 @@ public final class GamePanel extends javax.swing.JPanel {
DialogManager.getManager(gameId).setBounds(0, 0, rect.width, rect.height);
}
public synchronized void showGame(UUID gameId, UUID playerId) {
public synchronized void showGame(UUID gameId, UUID playerId, GamePane gamePane) {
this.gameId = gameId;
this.gamePane = gamePane;
this.playerId = playerId;
session = MageFrame.getSession();
MageFrame.addGame(gameId, this);
@ -554,6 +557,17 @@ public final class GamePanel extends javax.swing.JPanel {
}
}
}
if (!menuNameSet) {
StringBuilder sb = new StringBuilder();
for (PlayerView player: game.getPlayers()) {
if (sb.length() > 0) {
sb.append(" vs. ");
}
sb.append(player.getName());
}
menuNameSet = true;
gamePane.setTitle("Game: " + sb.toString());
}
GameManager.getInstance().setStackSize(game.getStack().size());
displayStack(game, bigCard, feedbackPanel, gameId);
@ -1536,4 +1550,6 @@ class ReplayTask extends SwingWorker<Void, Collection<MatchView>> {
logger.fatal("Replay Match Task error", ex);
} catch (CancellationException ex) {}
}
}