From c40dd7fb4b9f9c433336c0016ba5bfb2f2870556 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 27 Mar 2014 17:05:29 +0100 Subject: [PATCH] * Select card window - Fixed a bug that the window (also if reqiured) was closed, if you clicked on the frame of the window (e.g. to resize). Now the window is not closed in this case and can also be resized (fixes #100). However if the target is not set to required, the window is not modal and clicking anywhere beside the window, will still close the window without having made a selection. --- .../java/mage/client/dialog/ShowCardsDialog.java | 5 ++++- .../src/main/java/mage/client/game/GamePanel.java | 12 +++++++++++- .../mage/client/remote/CallbackClientImpl.java | 2 +- Mage/src/mage/game/GameState.java | 14 +++++++------- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/dialog/ShowCardsDialog.java b/Mage.Client/src/main/java/mage/client/dialog/ShowCardsDialog.java index 0117224d4f..8be8b52c63 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/ShowCardsDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/ShowCardsDialog.java @@ -154,7 +154,10 @@ public class ShowCardsDialog extends MageDialog implements MouseListener { @Override public void mousePressed(MouseEvent e) { - this.hideDialog(); + // only hide dialog, if a cardPanel was selected + if (e.getSource() instanceof CardPanel) { + this.hideDialog(); + } } @Override 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 eeec6b82f3..4502e3d92b 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -661,7 +661,17 @@ public final class GamePanel extends javax.swing.JPanel { updateGame(gameView); this.feedbackPanel.getFeedback(FeedbackMode.QUESTION, question, false, null, messageId); } - + /** + * Shows a pick target dialog and allows the player to pick a target (e.g. the pick triggered ability) + * + * @param message + * @param cardView + * @param gameView + * @param targets + * @param required + * @param options + * @param messageId + */ public void pickTarget(String message, CardsView cardView, GameView gameView, Set targets, boolean required, Map options, int messageId) { ShowCardsDialog dialog = null; updateGame(gameView); diff --git a/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java b/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java index 8c019ffb82..4f0a325b97 100644 --- a/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java +++ b/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java @@ -208,7 +208,7 @@ public class CallbackClientImpl implements CallbackClient { panel.ask(message.getMessage(), message.getGameView(), callback.getMessageId()); } break; } - case "gameTarget": + case "gameTarget": // e.g. Pick triggered ability { GameClientMessage message = (GameClientMessage) callback.getData(); GamePanel panel = MageFrame.getGame(callback.getObjectId()); diff --git a/Mage/src/mage/game/GameState.java b/Mage/src/mage/game/GameState.java index 918bd00062..015c3b0657 100644 --- a/Mage/src/mage/game/GameState.java +++ b/Mage/src/mage/game/GameState.java @@ -90,10 +90,10 @@ public class GameState implements Serializable, Copyable { private final Turn turn; // revealed cards >, will be reset if all players pass priority private final Revealed revealed; - private final Map lookedAt = new HashMap(); + private final Map lookedAt = new HashMap<>(); private final DelayedTriggeredAbilities delayed; private final SpecialActions specialActions; - private final Map> otherAbilities = new HashMap>(); + private final Map> otherAbilities = new HashMap<>(); private final TurnMods turnMods; private final Watchers watchers; @@ -111,11 +111,11 @@ public class GameState implements Serializable, Copyable { private boolean paused; private ContinuousEffects effects; private TriggeredAbilities triggers; - private List triggered = new ArrayList(); + private List triggered = new ArrayList<>(); private Combat combat; - private Map values = new HashMap(); - private Map zones = new HashMap(); - private List simultaneousEvents = new ArrayList(); + private Map values = new HashMap<>(); + private Map zones = new HashMap<>(); + private List simultaneousEvents = new ArrayList<>(); public GameState() { players = new Players(); @@ -246,7 +246,7 @@ public class GameState implements Serializable, Copyable { } sb.append("permanents"); - List perms = new ArrayList(); + List perms = new ArrayList<>(); for (Permanent permanent: battlefield.getAllPermanents()) { perms.add(permanent.getValue()); }