From 5b02b5b32c876e954d5faab81573f82ae20cac32 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 23 Jun 2015 16:14:11 +0200 Subject: [PATCH] Exile, Reveal, Looked At windows of a game are hidden now as you switch to another pane (e.g. other game, tables, deck editor) and shown again as you switch back. --- .../main/java/mage/client/game/GamePane.java | 10 +++++ .../main/java/mage/client/game/GamePanel.java | 41 +++++++++++++++++-- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/game/GamePane.java b/Mage.Client/src/main/java/mage/client/game/GamePane.java index 35d1c16a97..9b7c00a5eb 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePane.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePane.java @@ -114,6 +114,16 @@ public class GamePane extends MagePane { return gameId; } + @Override + public void deactivated() { + gamePanel.deactivated(); + } + + @Override + public void activated() { + gamePanel.activated(); + } + private mage.client.game.GamePanel gamePanel; private javax.swing.JScrollPane jScrollPane1; private UUID gameId; diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index 43af41bc1d..ade062dacb 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -145,11 +145,14 @@ public final class GamePanel extends javax.swing.JPanel { private static final int X_PHASE_WIDTH = 55; private static final int STACK_MIN_CARDS_OFFSET_Y = 7; private final Map players = new HashMap<>(); + + // non modal frames private final Map exiles = new HashMap<>(); private final Map revealed = new HashMap<>(); private final Map lookedAt = new HashMap<>(); private final Map graveyardWindows = new HashMap<>(); private final Map graveyards = new HashMap<>(); + private final ArrayList pickTarget = new ArrayList<>(); private UUID gameId; private UUID playerId; // playerId of the player @@ -826,6 +829,40 @@ public final class GamePanel extends javax.swing.JPanel { } } + // Called if the game frame is deactivated because the tabled the deck editor or other frames go to foreground + public void deactivated() { + // hide the non modal windows (because otherwise they are shown on top of the new active pane) + for (CardInfoWindowDialog exileDialog: exiles.values()) { + exileDialog.hideDialog(); + } + for (CardInfoWindowDialog graveyardDialog: graveyardWindows.values()) { + graveyardDialog.hideDialog(); + } + for (CardInfoWindowDialog revealDialog: revealed.values()) { + revealDialog.hideDialog(); + } + for (CardInfoWindowDialog lookedAtDialog: lookedAt.values()) { + lookedAtDialog.hideDialog(); + } + } + + // Called if the game frame comes to front again + public void activated() { + // hide the non modal windows (because otherwise they are shown on top of the new active pane) + for (CardInfoWindowDialog exileDialog: exiles.values()) { + exileDialog.show(); + } + for (CardInfoWindowDialog graveyardDialog: graveyardWindows.values()) { + graveyardDialog.show(); + } + for (CardInfoWindowDialog revealDialog: revealed.values()) { + revealDialog.show(); + } + for (CardInfoWindowDialog lookedAtDialog: lookedAt.values()) { + lookedAtDialog.show(); + } + } + public void openGraveyardWindow(String playerName) { if(graveyardWindows.containsKey(playerName)) { CardInfoWindowDialog cardInfoWindowDialog = graveyardWindows.get(playerName); @@ -834,9 +871,7 @@ public final class GamePanel extends javax.swing.JPanel { } else { cardInfoWindowDialog.show(); } -// if (!cardInfoWindowDialog.isClosed()) { - return; -// } + return; } CardInfoWindowDialog newGraveyard = new CardInfoWindowDialog(ShowType.GRAVEYARD, playerName); graveyardWindows.put(playerName, newGraveyard);