mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
GUI: fix that cheat button shows for all players instead current user only (related to #5289);
This commit is contained in:
parent
7cfe39ae21
commit
1045f352bc
3 changed files with 9 additions and 3 deletions
|
|
@ -494,7 +494,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void init(PlayerView player, BigCard bigCard, UUID gameId, int priorityTime) {
|
public final void init(PlayerView player, BigCard bigCard, UUID gameId, int priorityTime) {
|
||||||
this.playerPanel.init(gameId, player.getPlayerId(), bigCard, priorityTime);
|
this.playerPanel.init(gameId, player.getPlayerId(), player.getControlled(), bigCard, priorityTime);
|
||||||
this.battlefieldPanel.init(gameId, bigCard);
|
this.battlefieldPanel.init(gameId, bigCard);
|
||||||
this.gameId = gameId;
|
this.gameId = gameId;
|
||||||
this.playerId = player.getPlayerId();
|
this.playerId = player.getPlayerId();
|
||||||
|
|
|
||||||
|
|
@ -86,11 +86,11 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
deadBackgroundColor = currentTheme.getPlayerPanel_deadBackgroundColor();
|
deadBackgroundColor = currentTheme.getPlayerPanel_deadBackgroundColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(UUID gameId, UUID playerId, BigCard bigCard, int priorityTime) {
|
public void init(UUID gameId, UUID playerId, boolean controlled, BigCard bigCard, int priorityTime) {
|
||||||
this.gameId = gameId;
|
this.gameId = gameId;
|
||||||
this.playerId = playerId;
|
this.playerId = playerId;
|
||||||
this.bigCard = bigCard;
|
this.bigCard = bigCard;
|
||||||
cheat.setVisible(SessionHandler.isTestMode());
|
cheat.setVisible(SessionHandler.isTestMode() && controlled);
|
||||||
cheat.setFocusable(false);
|
cheat.setFocusable(false);
|
||||||
flagName = null;
|
flagName = null;
|
||||||
if (priorityTime > 0) {
|
if (priorityTime > 0) {
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ public class PlayerView implements Serializable {
|
||||||
|
|
||||||
private final UUID playerId;
|
private final UUID playerId;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
private final boolean controlled; // gui: player is current user
|
||||||
private final int life;
|
private final int life;
|
||||||
private final Counters counters;
|
private final Counters counters;
|
||||||
private final int wins;
|
private final int wins;
|
||||||
|
|
@ -64,6 +65,7 @@ public class PlayerView implements Serializable {
|
||||||
public PlayerView(Player player, GameState state, Game game, UUID createdForPlayerId, UUID watcherUserId) {
|
public PlayerView(Player player, GameState state, Game game, UUID createdForPlayerId, UUID watcherUserId) {
|
||||||
this.playerId = player.getId();
|
this.playerId = player.getId();
|
||||||
this.name = player.getName();
|
this.name = player.getName();
|
||||||
|
this.controlled = player.getId().equals(createdForPlayerId);
|
||||||
this.life = player.getLife();
|
this.life = player.getLife();
|
||||||
this.counters = player.getCounters();
|
this.counters = player.getCounters();
|
||||||
this.wins = player.getMatchPlayer().getWins();
|
this.wins = player.getMatchPlayer().getWins();
|
||||||
|
|
@ -164,6 +166,10 @@ public class PlayerView implements Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getControlled() {
|
||||||
|
return this.controlled;
|
||||||
|
}
|
||||||
|
|
||||||
public int getLife() {
|
public int getLife() {
|
||||||
return this.life;
|
return this.life;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue