mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
* Fixed that game name for menu works also for watching games.
This commit is contained in:
parent
c519814f03
commit
6c6d12f40f
2 changed files with 14 additions and 5 deletions
|
|
@ -77,7 +77,7 @@ public class GamePane extends MagePane {
|
|||
public void watchGame(UUID gameId) {
|
||||
this.setTitle("Watching " + gameId);
|
||||
this.gameId = gameId;
|
||||
gamePanel.watchGame(gameId);
|
||||
gamePanel.watchGame(gameId, this);
|
||||
}
|
||||
|
||||
public void replayGame(UUID gameId) {
|
||||
|
|
|
|||
|
|
@ -359,8 +359,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized void watchGame(UUID gameId) {
|
||||
public synchronized void watchGame(UUID gameId, GamePane gamePane) {
|
||||
this.gameId = gameId;
|
||||
this.gamePane = gamePane;
|
||||
this.playerId = null;
|
||||
session = MageFrame.getSession();
|
||||
MageFrame.addGame(gameId, this);
|
||||
|
|
@ -559,14 +560,22 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
if (!menuNameSet) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (playerId == null) {
|
||||
sb.append("Watching: ");
|
||||
} else {
|
||||
sb.append("Playing: ");
|
||||
}
|
||||
boolean first = true;
|
||||
for (PlayerView player: game.getPlayers()) {
|
||||
if (sb.length() > 0) {
|
||||
sb.append(" vs. ");
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
sb.append(" - ");
|
||||
}
|
||||
sb.append(player.getName());
|
||||
}
|
||||
menuNameSet = true;
|
||||
gamePane.setTitle("Game: " + sb.toString());
|
||||
gamePane.setTitle(sb.toString());
|
||||
}
|
||||
|
||||
GameManager.getInstance().setStackSize(game.getStack().size());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue