From 91fe62b396a4bbaf9c70146329b3f2e3869004a7 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 3 Feb 2015 17:31:40 +0100 Subject: [PATCH] Added a little spell cast during current turn counter (Storm) below the phase panel. --- .../main/java/mage/client/game/GamePanel.java | 22 +++++++++++++------ Mage.Common/src/mage/view/GameView.java | 13 +++++++++++ 2 files changed, 28 insertions(+), 7 deletions(-) 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 51ac9a77759..850fe4bf097 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -31,6 +31,7 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Point; @@ -57,6 +58,7 @@ import java.util.UUID; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; import javax.swing.AbstractAction; +import javax.swing.Box; import javax.swing.GroupLayout; import javax.swing.GroupLayout.Alignment; import javax.swing.ImageIcon; @@ -66,6 +68,7 @@ import javax.swing.JLayeredPane; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.KeyStroke; +import javax.swing.SwingConstants; import javax.swing.SwingWorker; import javax.swing.border.EmptyBorder; import javax.swing.border.LineBorder; @@ -603,6 +606,7 @@ public final class GamePanel extends javax.swing.JPanel { else { this.txtStep.setText(""); } + this.txtPhasesBottomInfo.setText(" " + Integer.toString(game.getSpellsCastCurrentTurn()+99)); this.txtActivePlayer.setText(game.getActivePlayerName()); this.txtPriority.setText(game.getPriorityPlayerName()); this.txtTurn.setText(Integer.toString(game.getTurn())); @@ -982,6 +986,9 @@ public final class GamePanel extends javax.swing.JPanel { lblPriority = new javax.swing.JLabel(); feedbackPanel = new mage.client.game.FeedbackPanel(); + txtPhasesBottomInfo = new javax.swing.JLabel(); + txtPhasesBottomInfo.setToolTipText("spells cast during the current turn"); + btnCancelSkip = new javax.swing.JButton(); // F3 btnSkipToNextTurn = new javax.swing.JButton(); // F4 btnSkipToEndTurn = new javax.swing.JButton(); // F5 @@ -991,7 +998,6 @@ public final class GamePanel extends javax.swing.JPanel { btnConcede = new javax.swing.JButton(); btnSwitchHands = new javax.swing.JButton(); - btnStopWatching = new javax.swing.JButton(); bigCard = new mage.client.cards.BigCard(); @@ -1048,7 +1054,7 @@ public final class GamePanel extends javax.swing.JPanel { lblTurn.setLabelFor(txtTurn); lblTurn.setText("Turn:"); - + txtTurn.setText("Turn"); txtTurn.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(153, 153, 153), 1, true)); txtTurn.setMinimumSize(new java.awt.Dimension(0, 16)); @@ -1457,7 +1463,7 @@ public final class GamePanel extends javax.swing.JPanel { jPhases = new JPanel(); jPhases.setBackground(new Color(0, 0, 0, 0)); jPhases.setLayout(null); - jPhases.setPreferredSize(new Dimension(X_PHASE_WIDTH, 450)); + jPhases.setPreferredSize(new Dimension(X_PHASE_WIDTH, 435)); MouseAdapter phasesMouseAdapter = new MouseAdapter() { @Override @@ -1501,9 +1507,11 @@ public final class GamePanel extends javax.swing.JPanel { empty1.setBackground(new Color(0, 0, 0, 0)); phasesContainer.add(empty1, ratio); phasesContainer.add(jPhases); - JPanel empty2 = new JPanel(); - empty2.setBackground(new Color(0, 0, 0, 0)); - phasesContainer.add(empty2, ratio); + + JPanel phasesBottomPanel = new JPanel(); + phasesBottomPanel.setBackground(new Color(0, 0, 0, 0)); + phasesBottomPanel.add(txtPhasesBottomInfo); + phasesContainer.add(phasesBottomPanel); javax.swing.GroupLayout gl_jPanel3 = new javax.swing.GroupLayout(jPanel3); gl_jPanel3.setHorizontalGroup( @@ -1854,7 +1862,7 @@ public final class GamePanel extends javax.swing.JPanel { private javax.swing.JSplitPane jSplitPane2; private JPanel jPhases; private JPanel phasesContainer; - + private javax.swing.JLabel txtPhasesBottomInfo; private HoverButton currentStep; private Point prevPoint; diff --git a/Mage.Common/src/mage/view/GameView.java b/Mage.Common/src/mage/view/GameView.java index 39f62f4299f..e82272227fc 100644 --- a/Mage.Common/src/mage/view/GameView.java +++ b/Mage.Common/src/mage/view/GameView.java @@ -49,6 +49,7 @@ import org.apache.log4j.Logger; import java.io.Serializable; import java.util.*; +import mage.watchers.common.CastSpellLastTurnWatcher; /** @@ -79,6 +80,7 @@ public class GameView implements Serializable { private final int turn; private boolean special = false; private final boolean isPlayer; + private final int spellsCastCurrentTurn; public GameView(GameState state, Game game, UUID createdForPlayerId, UUID watcherUserId) { @@ -160,6 +162,12 @@ public class GameView implements Serializable { combat.add(new CombatGroupView(combatGroup, game)); } this.special = state.getSpecialActions().getControlledBy(state.getPriorityPlayerId()).size() > 0; + CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher"); + if (watcher != null) { + spellsCastCurrentTurn = watcher.getAmountOfSpellsAllPlayersCastOnCurrentTurn(); + } else { + spellsCastCurrentTurn = 0; + } } private void checkPaid(UUID uuid, StackAbility stackAbility) { @@ -298,4 +306,9 @@ public class GameView implements Serializable { public void setCanPlayInHand(Set canPlayInHand) { this.canPlayInHand = canPlayInHand; } + + public int getSpellsCastCurrentTurn() { + return spellsCastCurrentTurn; + } + }