New game panel: new player info, centered hand, displaying poison counters, layout fix (Issue 25 fix), avatars, etc.
|
@ -34,7 +34,6 @@
|
|||
|
||||
package mage.client;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.client.cards.CardsStorage;
|
||||
|
@ -50,7 +49,6 @@ import mage.client.remote.Session;
|
|||
import mage.client.util.EDTExceptionHandler;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import mage.components.ImagePanel;
|
||||
import mage.game.GameException;
|
||||
import mage.util.Logging;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
@ -70,7 +68,6 @@ import java.util.logging.Level;
|
|||
import java.util.logging.Logger;
|
||||
import java.util.prefs.Preferences;
|
||||
import mage.client.draft.DraftPane;
|
||||
import mage.sets.Sets;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -156,6 +153,11 @@ public class MageFrame extends javax.swing.JFrame {
|
|||
addMageLabel();
|
||||
setAppIcon();
|
||||
|
||||
//PlayerPanelNew n = new PlayerPanelNew();
|
||||
//n.setBounds(100,100,100,300);
|
||||
//n.setVisible(true);
|
||||
//backgroundPane.add(n);
|
||||
|
||||
desktopPane.add(ArrowBuilder.getArrowsPanel(), JLayeredPane.DRAG_LAYER);
|
||||
|
||||
desktopPane.addComponentListener(new ComponentAdapter() {
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
package mage.client.cards;
|
||||
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.ImageHelper;
|
||||
import mage.client.util.gui.BufferedImageBuilder;
|
||||
import mage.filters.FilterFactory;
|
||||
import mage.filters.impl.HueFilter;
|
||||
|
@ -69,9 +70,9 @@ public class BigCard extends JComponent {
|
|||
protected float hue = 0.005f;
|
||||
protected float dh = 0.005f;
|
||||
|
||||
static private final int DEFAULT_DELAY_PERIOD = 30;
|
||||
static private final float LEFT_BOUNDARY = 0.0f;
|
||||
static private final float RIGHT_BOUNDARY = 1f;
|
||||
static private final int DEFAULT_DELAY_PERIOD = 50;
|
||||
static private final float LEFT_BOUNDARY = -0.15f;
|
||||
static private final float RIGHT_BOUNDARY = 0.15f;
|
||||
|
||||
public BigCard() {
|
||||
initComponents();
|
||||
|
@ -79,7 +80,6 @@ public class BigCard extends JComponent {
|
|||
initBounds();
|
||||
}
|
||||
setDoubleBuffered(true);
|
||||
setOpaque(true);
|
||||
}
|
||||
|
||||
protected void initBounds() {
|
||||
|
@ -252,9 +252,9 @@ public class BigCard extends JComponent {
|
|||
setFocusable(false);
|
||||
setMinimumSize(new Dimension(FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT));
|
||||
setMaximumSize(new Dimension(FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT));
|
||||
setOpaque(false);
|
||||
setPreferredSize(getMinimumSize());
|
||||
setLayout(null);
|
||||
//setBackground(new Color(255,255,255,200));
|
||||
|
||||
scrollPane.setBorder(null);
|
||||
scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
|
@ -268,6 +268,10 @@ public class BigCard extends JComponent {
|
|||
add(scrollPane);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
public void setDefaultImage() {
|
||||
bigImage = ImageHelper.getImageFromResources("/empty.png");
|
||||
bigImage = ImageHelper.getResizedImage((BufferedImage) bigImage, getWidth(), getHeight());
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JScrollPane scrollPane;
|
||||
|
|
|
@ -382,8 +382,6 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
List<UUID> targets = card.getTargets();
|
||||
if (targets != null) {
|
||||
for (UUID uuid : targets) {
|
||||
//System.out.println("Getting play area panel for uuid: " + uuid);
|
||||
|
||||
PlayAreaPanel p = session.getGame().getPlayers().get(uuid);
|
||||
if (p != null) {
|
||||
Point target = p.getLocationOnScreen();
|
||||
|
|
|
@ -51,6 +51,10 @@ import mage.view.CardsView;
|
|||
import mage.view.PermanentView;
|
||||
import mage.view.StackAbilityView;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -63,15 +67,29 @@ public class Cards extends javax.swing.JPanel {
|
|||
|
||||
/** Creates new form Cards */
|
||||
public Cards() {
|
||||
initComponents();
|
||||
this(false);
|
||||
}
|
||||
|
||||
public Cards(boolean skipAddingScrollPane) {
|
||||
initComponents(skipAddingScrollPane);
|
||||
setOpaque(false);
|
||||
jScrollPane1.setOpaque(false);
|
||||
jScrollPane1.getViewport().setOpaque(false);
|
||||
cardArea.setOpaque(false);
|
||||
cardArea.setOpaque(false);
|
||||
if (!skipAddingScrollPane) {
|
||||
jScrollPane1.setOpaque(false);
|
||||
jScrollPane1.getViewport().setOpaque(false);
|
||||
}
|
||||
if (Plugins.getInstance().isCardPluginLoaded()) {
|
||||
cardArea.setLayout(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setBorder(Border border) {
|
||||
super.setBorder(border);
|
||||
if (jScrollPane1 != null) {
|
||||
jScrollPane1.setViewportBorder(border);
|
||||
jScrollPane1.setBorder(border);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean loadCards(CardsView cardsView, BigCard bigCard, UUID gameId) {
|
||||
boolean changed = false;
|
||||
|
@ -157,20 +175,21 @@ public class Cards extends javax.swing.JPanel {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
cardArea = new javax.swing.JPanel();
|
||||
|
||||
setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
|
||||
private void initComponents(boolean skipAddingScrollPane) {
|
||||
setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0, 0)));
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
|
||||
cardArea = new javax.swing.JPanel();
|
||||
cardArea.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 0));
|
||||
|
||||
cardArea.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 0));
|
||||
jScrollPane1.setViewportView(cardArea);
|
||||
|
||||
add(jScrollPane1, java.awt.BorderLayout.CENTER);
|
||||
if (skipAddingScrollPane) {
|
||||
add(cardArea, java.awt.BorderLayout.CENTER);
|
||||
} else{
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
jScrollPane1.setViewportView(cardArea);
|
||||
jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
|
||||
add(jScrollPane1, java.awt.BorderLayout.CENTER);
|
||||
}
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
|
@ -184,10 +203,14 @@ public class Cards extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
public void setHScrollSpeed(int unitIncrement) {
|
||||
jScrollPane1.getHorizontalScrollBar().setUnitIncrement(unitIncrement);
|
||||
if (jScrollPane1 != null) {
|
||||
jScrollPane1.getHorizontalScrollBar().setUnitIncrement(unitIncrement);
|
||||
}
|
||||
}
|
||||
|
||||
public void setVScrollSpeed(int unitIncrement) {
|
||||
jScrollPane1.getVerticalScrollBar().setUnitIncrement(unitIncrement);
|
||||
if (jScrollPane1 != null) {
|
||||
jScrollPane1.getVerticalScrollBar().setUnitIncrement(unitIncrement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,4 +168,8 @@ public class HoverButton extends JPanel implements MouseListener {
|
|||
public void changeSelected() {
|
||||
this.isSelected = !this.isSelected;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@ import javax.swing.JPanel;
|
|||
*/
|
||||
public class MageRoundPane extends JPanel {
|
||||
|
||||
private static int X_OFFSET = 30;
|
||||
private static int Y_OFFSET = 30;
|
||||
private int X_OFFSET = 30;
|
||||
private int Y_OFFSET = 30;
|
||||
private BufferedImage shadow = null;
|
||||
private Color backgroundColor = new Color(255, 255, 255, 220);
|
||||
private Color backgroundColor = new Color(255, 255, 255, 200);
|
||||
private int alpha = 0;
|
||||
|
||||
@Override
|
||||
|
@ -66,6 +66,14 @@ public class MageRoundPane extends JPanel {
|
|||
g2.dispose();
|
||||
}
|
||||
|
||||
public void setXOffset(int x_offset) {
|
||||
X_OFFSET = x_offset;
|
||||
}
|
||||
|
||||
public void setYOffset(int y_offset) {
|
||||
Y_OFFSET = y_offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBounds(int x, int y, int width, int height) {
|
||||
super.setBounds(x, y, width, height);
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.util.regex.Pattern;
|
|||
|
||||
public class ManaSymbols {
|
||||
private static final Logger log = Logger.getLogger(ManaSymbols.class);
|
||||
static private final Map<String, Image> manaImages = new HashMap<String, Image>();
|
||||
static private final Map<String, BufferedImage> manaImages = new HashMap<String, BufferedImage>();
|
||||
static private final Map<String, Image> manaImagesOriginal = new HashMap<String, Image>();
|
||||
static private final Map<String, Image> setImages = new HashMap<String, Image>();
|
||||
static private Pattern replaceSymbolsPattern = Pattern.compile("\\{([^}/]*)/?([^}]*)\\}");
|
||||
|
@ -107,6 +107,10 @@ public class ManaSymbols {
|
|||
return manaImagesOriginal.get(symbol);
|
||||
}
|
||||
|
||||
static public BufferedImage getManaSymbolImageSmall(String symbol) {
|
||||
return manaImages.get(symbol);
|
||||
}
|
||||
|
||||
static public Image getSetSymbolImage(String set) {
|
||||
return setImages.get(set);
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class CollectionViewerPane extends MagePane {
|
|||
}
|
||||
|
||||
private void initComponents(Component container) {
|
||||
Component component = container != null ? container : collectionViewerPanel;
|
||||
Component component = container != null ? container : new CollectionViewerPanel();
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
|
|
|
@ -71,9 +71,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
private BigCard bigCard;
|
||||
private Map<String, JComponent> ui = new HashMap<String, JComponent>();
|
||||
|
||||
protected static DefaultActionCallback defaultCallback = DefaultActionCallback.getInstance();
|
||||
protected static Map<UUID, PermanentView> battlefield;
|
||||
protected static Map<UUID, Integer> attachmentCache = new HashMap<UUID, Integer>();
|
||||
protected static List<Thread> threads = new ArrayList<Thread>();
|
||||
|
||||
/** Creates new form BattlefieldPanel */
|
||||
|
@ -277,8 +275,8 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
setBackground(java.awt.Color.gray);
|
||||
setForeground(java.awt.Color.gray);
|
||||
//setBackground(java.awt.Color.gray);
|
||||
//setForeground(java.awt.Color.gray);
|
||||
setOpaque(true);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
lblMessage = new MageTextArea();
|
||||
btnSpecial = new javax.swing.JButton();
|
||||
|
||||
setBackground(new java.awt.Color(204, 204, 204));
|
||||
setBackground(new java.awt.Color(255,255,255,200));
|
||||
|
||||
btnRight.setText("Cancel");
|
||||
btnRight.addActionListener(new java.awt.event.ActionListener() {
|
||||
|
|
|
@ -34,9 +34,7 @@
|
|||
|
||||
package mage.client.game;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.util.HashMap;
|
||||
|
@ -46,12 +44,14 @@ import java.util.UUID;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.border.LineBorder;
|
||||
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.cards.Cards;
|
||||
import mage.client.deckeditor.collection.viewer.MageBook;
|
||||
import mage.client.dialog.ExileZoneDialog;
|
||||
import mage.client.dialog.PickChoiceDialog;
|
||||
import mage.client.dialog.ShowCardsDialog;
|
||||
|
@ -225,7 +225,7 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
PlayerView player = game.getPlayers().get(playerSeat);
|
||||
PlayAreaPanel sessionPlayer = new PlayAreaPanel(player, bigCard, gameId);
|
||||
PlayAreaPanel sessionPlayer = new PlayAreaPanel(player, bigCard, gameId, true);
|
||||
players.put(player.getPlayerId(), sessionPlayer);
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.fill = GridBagConstraints.BOTH;
|
||||
|
@ -252,7 +252,7 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
col = numColumns - 1;
|
||||
}
|
||||
player = game.getPlayers().get(playerNum);
|
||||
PlayAreaPanel playerPanel = new PlayAreaPanel(player, bigCard, gameId);
|
||||
PlayAreaPanel playerPanel = new PlayAreaPanel(player, bigCard, gameId, false);
|
||||
players.put(player.getPlayerId(), playerPanel);
|
||||
c = new GridBagConstraints();
|
||||
c.fill = GridBagConstraints.BOTH;
|
||||
|
@ -271,10 +271,13 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
public synchronized void updateGame(GameView game) {
|
||||
if (playerId == null || game.getHand() == null)
|
||||
if (playerId == null || game.getHand() == null) {
|
||||
this.hand.setVisible(false);
|
||||
else
|
||||
} else {
|
||||
this.hand.loadCards(game.getHand(), bigCard, gameId);
|
||||
int count = game.getHand().size();
|
||||
hand.setPreferredSize(new java.awt.Dimension((Config.dimensions.frameWidth + 5) * count + 5, Config.dimensions.frameHeight + 20)); // for scroll
|
||||
}
|
||||
if (game.getPhase() != null)
|
||||
this.txtPhase.setText(game.getPhase().toString());
|
||||
else
|
||||
|
@ -447,7 +450,7 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
btnPreviousPlay = new javax.swing.JButton();
|
||||
btnNextPlay = new javax.swing.JButton();
|
||||
pnlBattlefield = new javax.swing.JPanel();
|
||||
hand = new mage.client.cards.Cards();
|
||||
hand = new mage.client.cards.Cards(true);
|
||||
chatPanel = new mage.client.chat.ChatPanel();
|
||||
|
||||
jSplitPane1.setBorder(null);
|
||||
|
@ -455,8 +458,9 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
jSplitPane1.setResizeWeight(1.0);
|
||||
jSplitPane1.setOneTouchExpandable(true);
|
||||
jSplitPane1.setMinimumSize(new java.awt.Dimension(26, 48));
|
||||
|
||||
pnlGameInfo.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
jSplitPane1.setDividerLocation(Integer.MAX_VALUE);
|
||||
//pnlGameInfo.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
pnlGameInfo.setOpaque(false);
|
||||
|
||||
lblPhase.setLabelFor(txtPhase);
|
||||
lblPhase.setText("Phase:");
|
||||
|
@ -497,6 +501,8 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
feedbackPanel.setMaximumSize(new java.awt.Dimension(208, 121));
|
||||
feedbackPanel.setMinimumSize(new java.awt.Dimension(208, 121));
|
||||
|
||||
bigCard.setBorder(new LineBorder(Color.black, 1, true));
|
||||
|
||||
btnConcede.setText("Concede");
|
||||
btnConcede.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
|
@ -556,44 +562,44 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
javax.swing.GroupLayout pnlGameInfoLayout = new javax.swing.GroupLayout(pnlGameInfo);
|
||||
pnlGameInfo.setLayout(pnlGameInfoLayout);
|
||||
pnlGameInfoLayout.setHorizontalGroup(
|
||||
pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(pnlGameInfoLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblPriority)
|
||||
.addComponent(lblPhase)
|
||||
.addComponent(lblStep)
|
||||
.addComponent(lblTurn)
|
||||
.addComponent(lblActivePlayer))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtActivePlayer, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
|
||||
.addComponent(txtPriority, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
|
||||
.addComponent(txtTurn, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
|
||||
.addComponent(txtStep, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
|
||||
.addComponent(txtPhase, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
.addGroup(pnlGameInfoLayout.createSequentialGroup()
|
||||
.addGap(10, 10, 10)
|
||||
.addComponent(btnConcede)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnStopWatching)
|
||||
.addContainerGap(62, Short.MAX_VALUE))
|
||||
.addComponent(bigCard, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
|
||||
.addComponent(feedbackPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
|
||||
.addComponent(stack, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
|
||||
.addGroup(pnlGameInfoLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(pnlReplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(51, Short.MAX_VALUE))
|
||||
);
|
||||
pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
/*.addGroup(pnlGameInfoLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblPriority)
|
||||
.addComponent(lblPhase)
|
||||
.addComponent(lblStep)
|
||||
.addComponent(lblTurn)
|
||||
.addComponent(lblActivePlayer))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtActivePlayer, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
|
||||
.addComponent(txtPriority, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
|
||||
.addComponent(txtTurn, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
|
||||
.addComponent(txtStep, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
|
||||
.addComponent(txtPhase, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE))
|
||||
.addContainerGap())*/
|
||||
.addGroup(pnlGameInfoLayout.createSequentialGroup()
|
||||
.addGap(10, 10, 10)
|
||||
.addComponent(btnConcede)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnStopWatching)
|
||||
.addContainerGap(62, Short.MAX_VALUE))
|
||||
.addComponent(bigCard, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
|
||||
.addComponent(feedbackPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
|
||||
.addComponent(stack, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
|
||||
.addGroup(pnlGameInfoLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(pnlReplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(51, Short.MAX_VALUE))
|
||||
);
|
||||
pnlGameInfoLayout.setVerticalGroup(
|
||||
pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(pnlGameInfoLayout.createSequentialGroup()
|
||||
.addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(1, 1, 1)
|
||||
.addComponent(feedbackPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(7, 7, 7)
|
||||
/*.addGap(7, 7, 7)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPhase)
|
||||
|
@ -615,7 +621,8 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
.addComponent(lblPriority)
|
||||
.addComponent(txtPriority, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(stack, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
*/
|
||||
.addComponent(stack, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 164, Short.MAX_VALUE)
|
||||
.addComponent(pnlReplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
|
@ -626,7 +633,9 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
|
||||
pnlBattlefield.setLayout(new java.awt.GridBagLayout());
|
||||
|
||||
hand.setPreferredSize(new java.awt.Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight + 25));
|
||||
//hand.setPreferredSize(new java.awt.Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight + 20)); // for scroll
|
||||
hand.setBorder(emptyBorder);
|
||||
HandContainer handContainer = new HandContainer(hand);
|
||||
|
||||
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
|
||||
jPanel3.setLayout(jPanel3Layout);
|
||||
|
@ -636,15 +645,16 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
.addComponent(pnlGameInfo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(hand, javax.swing.GroupLayout.DEFAULT_SIZE, 715, Short.MAX_VALUE)
|
||||
.addComponent(pnlBattlefield, javax.swing.GroupLayout.DEFAULT_SIZE, 715, Short.MAX_VALUE)))
|
||||
.addComponent(handContainer, javax.swing.GroupLayout.DEFAULT_SIZE, 715, Short.MAX_VALUE)
|
||||
.addComponent(pnlBattlefield, javax.swing.GroupLayout.DEFAULT_SIZE, 715, Short.MAX_VALUE)
|
||||
))
|
||||
);
|
||||
jPanel3Layout.setVerticalGroup(
|
||||
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
|
||||
.addComponent(pnlBattlefield, javax.swing.GroupLayout.DEFAULT_SIZE, 794, Short.MAX_VALUE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(hand, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(handContainer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(pnlGameInfo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
|
@ -664,6 +674,13 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 798, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
bigCard.setDefaultImage();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void btnConcedeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConcedeActionPerformed
|
||||
|
@ -692,6 +709,39 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
session.previousPlay();
|
||||
}//GEN-LAST:event_btnPreviousPlayActionPerformed
|
||||
|
||||
private class HandContainer extends JPanel {
|
||||
|
||||
public HandContainer(Cards hand) {
|
||||
super();
|
||||
initComponents(hand);
|
||||
}
|
||||
|
||||
public void initComponents(Cards hand) {
|
||||
jPanel = new JPanel();
|
||||
jScrollPane1 = new JScrollPane(jPanel);
|
||||
jScrollPane1.getViewport().setBackground(new Color(0,0,0,0));
|
||||
|
||||
jPanel.setLayout(new GridBagLayout()); // centers hand
|
||||
jPanel.setBackground(new Color(0,0,0,0));
|
||||
jPanel.add(hand);
|
||||
|
||||
setOpaque(false);
|
||||
jPanel.setOpaque(false);
|
||||
jScrollPane1.setOpaque(false);
|
||||
|
||||
jPanel.setBorder(emptyBorder);
|
||||
jScrollPane1.setBorder(emptyBorder);
|
||||
jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
|
||||
jScrollPane1.getHorizontalScrollBar().setUnitIncrement(8);
|
||||
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
add(jScrollPane1, java.awt.BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
private JPanel jPanel;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private mage.client.game.AbilityPicker abilityPicker;
|
||||
private mage.client.cards.BigCard bigCard;
|
||||
|
@ -721,4 +771,5 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
private javax.swing.JLabel txtTurn;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
private Border emptyBorder = new EmptyBorder(0,0,0,0);
|
||||
}
|
||||
|
|
|
@ -34,18 +34,22 @@
|
|||
|
||||
package mage.client.game;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.sets.Sets;
|
||||
import mage.view.PlayerView;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -56,16 +60,17 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
UUID gameId;
|
||||
|
||||
/** Creates new form PlayAreaPanel */
|
||||
public PlayAreaPanel() {
|
||||
initComponents();
|
||||
setOpaque(false);
|
||||
public PlayAreaPanel(boolean me) {
|
||||
initComponents(me);
|
||||
setOpaque(false);
|
||||
jPanel1.setOpaque(false);
|
||||
jScrollPane1.setOpaque(false);
|
||||
jScrollPane1.getViewport().setOpaque(false);
|
||||
battlefieldPanel.setOpaque(false);
|
||||
}
|
||||
}
|
||||
|
||||
public PlayAreaPanel(PlayerView player, BigCard bigCard, UUID gameId) {
|
||||
this();
|
||||
public PlayAreaPanel(PlayerView player, BigCard bigCard, UUID gameId, boolean me) {
|
||||
this(me);
|
||||
init(player, bigCard, gameId);
|
||||
update(player);
|
||||
}
|
||||
|
@ -85,7 +90,6 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
|
||||
public void update(PlayerView player) {
|
||||
this.playerPanel.update(player);
|
||||
this.manaPool.update(player.getManaPool());
|
||||
this.battlefieldPanel.update(player.getBattlefield());
|
||||
}
|
||||
|
||||
|
@ -100,16 +104,17 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
private void initComponents(boolean me) {
|
||||
setBorder(BorderFactory.createLineBorder(new Color(0,0,0,0)));
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
playerPanel = new mage.client.game.PlayerPanel();
|
||||
manaPool = new mage.client.game.ManaPool();
|
||||
playerPanel = new PlayerPanelExt(me);
|
||||
playerPanel.setPreferredSize(new Dimension(92, 250));
|
||||
//manaPool = new mage.client.game.ManaPool();
|
||||
btnCheat = new javax.swing.JButton();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
battlefieldPanel = new mage.client.game.BattlefieldPanel(jScrollPane1);
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
||||
//jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
||||
|
||||
btnCheat.setText("Cheat");
|
||||
btnCheat.addActionListener(new java.awt.event.ActionListener() {
|
||||
|
@ -118,26 +123,29 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(manaPool, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
|
||||
//.addComponent(manaPool, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
|
||||
.addComponent(playerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btnCheat, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
|
||||
//.addComponent(btnCheat, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(playerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(manaPool, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
|
||||
.addComponent(btnCheat))
|
||||
//.addGap(0, 0, 0)
|
||||
//.addComponent(manaPool, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
//.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
|
||||
//.addComponent(btnCheat)
|
||||
)
|
||||
);
|
||||
|
||||
jScrollPane1.setViewportView(battlefieldPanel);
|
||||
Border empty = new EmptyBorder(0,0,0,0);
|
||||
jScrollPane1.setBorder(empty);
|
||||
jScrollPane1.setViewportBorder(empty);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
|
@ -146,11 +154,12 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE))
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE)
|
||||
)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
@ -170,8 +179,8 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
private javax.swing.JButton btnCheat;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private mage.client.game.ManaPool manaPool;
|
||||
private mage.client.game.PlayerPanel playerPanel;
|
||||
//private mage.client.game.ManaPool manaPool;
|
||||
private PlayerPanelExt playerPanel;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
|
|
320
Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java
Normal file
|
@ -0,0 +1,320 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
* PlayerPanel.java
|
||||
*
|
||||
* Created on Nov 18, 2009, 3:01:31 PM
|
||||
*/
|
||||
|
||||
package mage.client.game;
|
||||
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.components.HoverButton;
|
||||
import mage.client.components.MageRoundPane;
|
||||
import mage.client.components.arcane.GlowText;
|
||||
import mage.client.components.arcane.ManaSymbols;
|
||||
import mage.client.components.arcane.UI;
|
||||
import mage.client.dialog.ShowCardsDialog;
|
||||
import mage.client.remote.Session;
|
||||
import mage.client.util.Command;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.ImageHelper;
|
||||
import mage.client.util.gui.BufferedImageBuilder;
|
||||
import mage.client.util.gui.ImageResizeUtil;
|
||||
import mage.components.ImagePanel;
|
||||
import mage.sets.Sets;
|
||||
import mage.view.ManaPoolView;
|
||||
import mage.view.PlayerView;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.LineBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Enhanced player pane.
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class PlayerPanelExt extends javax.swing.JPanel {
|
||||
|
||||
private UUID playerId;
|
||||
private UUID gameId;
|
||||
private Session session;
|
||||
private PlayerView player;
|
||||
|
||||
private ShowCardsDialog graveyard;
|
||||
private BigCard bigCard;
|
||||
|
||||
private static final int AVATAR_COUNT = 77;
|
||||
|
||||
private static final Border greenBorder = new LineBorder(Color.green, 2);
|
||||
private static final Border redBorder = new LineBorder(Color.red, 2);
|
||||
private static final Border emptyBorder = BorderFactory.createEmptyBorder(0,0,0,0);
|
||||
|
||||
/** Creates new form PlayerPanel */
|
||||
public PlayerPanelExt(boolean me) {
|
||||
initComponents(me);
|
||||
}
|
||||
|
||||
public void init(UUID gameId, UUID playerId, BigCard bigCard) {
|
||||
this.gameId = gameId;
|
||||
this.playerId = playerId;
|
||||
this.bigCard = bigCard;
|
||||
session = MageFrame.getSession();
|
||||
}
|
||||
|
||||
public void update(PlayerView player) {
|
||||
this.player = player;
|
||||
lifeLabel.setText(Integer.toString(player.getLife()));
|
||||
handLabel.setText(Integer.toString(player.getHandCount()));
|
||||
libraryLabel.setText(Integer.toString(player.getLibraryCount()));
|
||||
graveLabel.setText(Integer.toString(player.getGraveyard().size()));
|
||||
|
||||
this.avatar.setText(player.getName());
|
||||
if (player.isActive()) {
|
||||
this.avatar.setBorder(greenBorder);
|
||||
} else if (player.hasLeft()) {
|
||||
this.avatar.setBorder(redBorder);
|
||||
} else {
|
||||
this.avatar.setBorder(emptyBorder);
|
||||
}
|
||||
|
||||
update(player.getManaPool());
|
||||
}
|
||||
|
||||
protected void update(ManaPoolView pool) {
|
||||
manaLabels.get("B").setText(Integer.toString(pool.getBlack()));
|
||||
manaLabels.get("R").setText(Integer.toString(pool.getRed()));
|
||||
manaLabels.get("W").setText(Integer.toString(pool.getWhite()));
|
||||
manaLabels.get("G").setText(Integer.toString(pool.getGreen()));
|
||||
manaLabels.get("U").setText(Integer.toString(pool.getBlue()));
|
||||
manaLabels.get("X").setText(Integer.toString(pool.getColorless()));
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents(boolean me) {
|
||||
setLayout(null);
|
||||
setOpaque(false);
|
||||
|
||||
MageRoundPane panelBackground = new MageRoundPane();
|
||||
panelBackground.setXOffset(3);
|
||||
panelBackground.setYOffset(3);
|
||||
panelBackground.setLayout(null);
|
||||
panelBackground.setVisible(true);
|
||||
panelBackground.setBounds(0, 0, 92, 250);
|
||||
add(panelBackground);
|
||||
|
||||
Rectangle r = new Rectangle(80, 80);
|
||||
Random rand = new Random();
|
||||
Integer index = me ? 51 : rand.nextInt(AVATAR_COUNT) + 1;
|
||||
if (index == 64 || index == 65) {
|
||||
index += 2;
|
||||
}
|
||||
Image image = ImageHelper.getImageFromResources("/avatars/face" + index + ".jpg");
|
||||
|
||||
// Avatar
|
||||
BufferedImage resized = ImageResizeUtil.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
||||
avatar = new HoverButton("player", resized, resized, resized, r);
|
||||
avatar.setBounds(6, 6, r.width, r.height);
|
||||
panelBackground.add(avatar);
|
||||
avatar.setObserver(new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
session.sendPlayerUUID(gameId, playerId);
|
||||
}
|
||||
});
|
||||
|
||||
// Life count
|
||||
lifeLabel = new JLabel();
|
||||
lifeLabel.setBounds(30, 82, 30, 30);
|
||||
r = new Rectangle(18, 18);
|
||||
life = (ImagePanel)addParam(panelBackground, "Life", lifeLabel, r, "/info/life.png", false);
|
||||
life.setBounds(9, 90, r.width, r.height);
|
||||
|
||||
// Hand count
|
||||
handLabel = new JLabel();
|
||||
handLabel.setBounds(70, 82, 50, 30);
|
||||
r = new Rectangle(18, 18);
|
||||
hand = (ImagePanel)addParam(panelBackground, "Hand", handLabel, r, "/info/hand.png", false);
|
||||
hand.setBounds(48, 90, r.width, r.height);
|
||||
|
||||
// Poison count
|
||||
poisonLabel = new JLabel();
|
||||
poisonLabel.setText("0");
|
||||
poisonLabel.setBounds(30, 112, 20, 20);
|
||||
//poisonLabel.setBorder(greenBorder);
|
||||
r = new Rectangle(14, 14);
|
||||
poison = (ImagePanel)addParam(panelBackground, "Poison", poisonLabel, r, "/info/poison.png", false);
|
||||
poison.setBounds(12, 116, r.width, r.height);
|
||||
|
||||
// Library count
|
||||
libraryLabel = new JLabel();
|
||||
libraryLabel.setBounds(70, 107, 30, 30);
|
||||
r = new Rectangle(19, 19);
|
||||
library = (ImagePanel)addParam(panelBackground, "Library", libraryLabel, r, "/info/library.png", false);
|
||||
library.setBounds(48, 113, r.width, r.height);
|
||||
|
||||
// Grave count and open graveyard button
|
||||
graveLabel = new JLabel();
|
||||
r = new Rectangle(21, 21);
|
||||
graveLabel.setBounds(35, 250 - r.height - 5, r.width, r.height);
|
||||
grave = (HoverButton)addParam(panelBackground, "Graveyard", graveLabel, r, "/info/grave.png", true);
|
||||
grave.setBounds(9, 250 - r.height - 5, r.width, r.height);
|
||||
grave.setObserver(new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
btnGraveActionPerformed(null);
|
||||
}
|
||||
});
|
||||
|
||||
// Cheat button
|
||||
r = new Rectangle(25, 21);
|
||||
image = ImageHelper.getImageFromResources("/info/cheat.png");
|
||||
resized = ImageResizeUtil.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
||||
cheat = new JButton();
|
||||
cheat.setIcon(new ImageIcon(resized));
|
||||
panelBackground.add(cheat);
|
||||
cheat.setBounds(55, 250 - r.height - 5, r.width, r.height);
|
||||
cheat.setToolTipText("Cheat button");
|
||||
cheat.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
btnCheatActionPerformed(e);
|
||||
}
|
||||
});
|
||||
|
||||
// Add mana symbols
|
||||
addManaImagePanel("W", new Rectangle(11, 140, 15, 15), panelBackground);
|
||||
addManaImagePanel("U", new Rectangle(11, 160, 15, 15), panelBackground);
|
||||
addManaImagePanel("B", new Rectangle(11, 180, 15, 15), panelBackground);
|
||||
addManaImagePanel("R", new Rectangle(50, 140, 15, 15), panelBackground);
|
||||
addManaImagePanel("G", new Rectangle(50, 160, 15, 15), panelBackground);
|
||||
addManaImagePanel("X", new Rectangle(50, 180, 15, 15), panelBackground);
|
||||
}
|
||||
|
||||
private void addManaImagePanel(String mana, Rectangle rect, JPanel container) {
|
||||
BufferedImage imageMana = ManaSymbols.getManaSymbolImageSmall(mana);
|
||||
if (imageMana != null) {
|
||||
ImagePanel manaB = new ImagePanel(imageMana, ImagePanel.ACTUAL);
|
||||
manaB.setBounds(rect.x, rect.y, rect.width, rect.height);
|
||||
manaB.setOpaque(false);
|
||||
container.add(manaB);
|
||||
}
|
||||
JLabel manaCountLabel = new JLabel();
|
||||
manaCountLabel.setText("0");
|
||||
manaCountLabel.setBounds(rect.x + rect.width + 5, rect.y - 8, 30, 30);
|
||||
container.add(manaCountLabel);
|
||||
manaLabels.put(mana, manaCountLabel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds image panel and label to the container panel.
|
||||
*
|
||||
* @param containerPanel
|
||||
* @param text
|
||||
* @param r
|
||||
* @param imagePath
|
||||
* @return
|
||||
*/
|
||||
private JComponent addParam(JPanel containerPanel, String tooltip, JLabel text, Rectangle r, String imagePath, boolean isButton) {
|
||||
if (text != null) {
|
||||
text.setForeground(Color.black);
|
||||
containerPanel.add(text);
|
||||
text.setToolTipText(tooltip);
|
||||
}
|
||||
|
||||
Image image = ImageHelper.getImageFromResources(imagePath);
|
||||
BufferedImage resized = ImageResizeUtil.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
||||
JComponent component = null;
|
||||
if (isButton) {
|
||||
component = new HoverButton(null, resized, resized, resized, r);
|
||||
} else {
|
||||
component = new ImagePanel(resized, ImagePanel.ACTUAL);
|
||||
}
|
||||
component.setToolTipText(tooltip);
|
||||
component.setOpaque(false);
|
||||
containerPanel.add(component);
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
private void btnGraveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGraveActionPerformed
|
||||
if (graveyard == null) {
|
||||
graveyard = new ShowCardsDialog();
|
||||
}
|
||||
graveyard.loadCards(player.getName() + " graveyard", player.getGraveyard(), bigCard, Config.dimensions, gameId, false);
|
||||
}
|
||||
|
||||
private void btnCheatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheatActionPerformed
|
||||
try {
|
||||
session.cheat(gameId, playerId, Sets.loadDeck("cheat.dck"));
|
||||
} catch (FileNotFoundException ex) {
|
||||
Logger.getLogger(PlayAreaPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(PlayAreaPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
private HoverButton avatar;
|
||||
private ImagePanel life;
|
||||
private ImagePanel poison;
|
||||
private ImagePanel hand;
|
||||
private HoverButton grave;
|
||||
private ImagePanel library;
|
||||
private JButton cheat;
|
||||
|
||||
private JLabel lifeLabel;
|
||||
private JLabel handLabel;
|
||||
private JLabel libraryLabel;
|
||||
private JLabel poisonLabel;
|
||||
private JLabel graveLabel;
|
||||
|
||||
private Map<String, JLabel> manaLabels = new HashMap<String, JLabel>();
|
||||
}
|
|
@ -39,6 +39,8 @@ import java.awt.image.ImageObserver;
|
|||
import java.awt.image.MemoryImageSource;
|
||||
import java.awt.image.PixelGrabber;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -47,6 +49,7 @@ import javax.imageio.ImageIO;
|
|||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.cards.CardDimensions;
|
||||
import mage.client.components.arcane.UI;
|
||||
import mage.sets.Sets;
|
||||
import mage.view.AbilityView;
|
||||
import mage.view.CardView;
|
||||
|
@ -311,4 +314,24 @@ public class ImageHelper {
|
|||
return image;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image using relative path in resources.
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
public static Image getImageFromResources(String path) {
|
||||
InputStream stream;
|
||||
stream = UI.class.getResourceAsStream(path);
|
||||
if (stream == null) {
|
||||
throw new IllegalArgumentException("Couldn't find image in resources: " + path);
|
||||
}
|
||||
|
||||
try {
|
||||
BufferedImage image = ImageIO.read(stream);
|
||||
return image;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
BIN
Mage.Client/src/main/resources/avatars/Face4.jpg
Normal file
After ![]() (image error) Size: 9.2 KiB |
BIN
Mage.Client/src/main/resources/avatars/Face40.jpg
Normal file
After ![]() (image error) Size: 7.9 KiB |
BIN
Mage.Client/src/main/resources/avatars/Face41.jpg
Normal file
After ![]() (image error) Size: 7.2 KiB |
BIN
Mage.Client/src/main/resources/avatars/Face42.jpg
Normal file
After ![]() (image error) Size: 6.9 KiB |
BIN
Mage.Client/src/main/resources/avatars/Face43.jpg
Normal file
After ![]() (image error) Size: 7.5 KiB |
BIN
Mage.Client/src/main/resources/avatars/Face44.jpg
Normal file
After ![]() (image error) Size: 6.6 KiB |
BIN
Mage.Client/src/main/resources/avatars/Face45.jpg
Normal file
After ![]() (image error) Size: 6.9 KiB |
BIN
Mage.Client/src/main/resources/avatars/Face46.jpg
Normal file
After ![]() (image error) Size: 9.7 KiB |
BIN
Mage.Client/src/main/resources/avatars/Face47.jpg
Normal file
After ![]() (image error) Size: 5.9 KiB |
BIN
Mage.Client/src/main/resources/avatars/Face48.jpg
Normal file
After ![]() (image error) Size: 5.9 KiB |
BIN
Mage.Client/src/main/resources/avatars/face1.jpg
Normal file
After ![]() (image error) Size: 8 KiB |
BIN
Mage.Client/src/main/resources/avatars/face10.jpg
Normal file
After ![]() (image error) Size: 7.7 KiB |
BIN
Mage.Client/src/main/resources/avatars/face11.jpg
Normal file
After ![]() (image error) Size: 7.3 KiB |
BIN
Mage.Client/src/main/resources/avatars/face12.jpg
Normal file
After ![]() (image error) Size: 8 KiB |
BIN
Mage.Client/src/main/resources/avatars/face13.jpg
Normal file
After ![]() (image error) Size: 7.4 KiB |
BIN
Mage.Client/src/main/resources/avatars/face14.jpg
Normal file
After ![]() (image error) Size: 7.3 KiB |
BIN
Mage.Client/src/main/resources/avatars/face15.jpg
Normal file
After ![]() (image error) Size: 8.2 KiB |
BIN
Mage.Client/src/main/resources/avatars/face16.jpg
Normal file
After ![]() (image error) Size: 7 KiB |
BIN
Mage.Client/src/main/resources/avatars/face17.jpg
Normal file
After ![]() (image error) Size: 7.5 KiB |
BIN
Mage.Client/src/main/resources/avatars/face18.jpg
Normal file
After ![]() (image error) Size: 7.5 KiB |
BIN
Mage.Client/src/main/resources/avatars/face19.jpg
Normal file
After ![]() (image error) Size: 7.4 KiB |
BIN
Mage.Client/src/main/resources/avatars/face2.jpg
Normal file
After ![]() (image error) Size: 7.6 KiB |
BIN
Mage.Client/src/main/resources/avatars/face20.jpg
Normal file
After ![]() (image error) Size: 8 KiB |
BIN
Mage.Client/src/main/resources/avatars/face21.jpg
Normal file
After ![]() (image error) Size: 7.7 KiB |
BIN
Mage.Client/src/main/resources/avatars/face22.jpg
Normal file
After ![]() (image error) Size: 7.4 KiB |
BIN
Mage.Client/src/main/resources/avatars/face23.jpg
Normal file
After ![]() (image error) Size: 7.6 KiB |
BIN
Mage.Client/src/main/resources/avatars/face24.jpg
Normal file
After ![]() (image error) Size: 7.2 KiB |
BIN
Mage.Client/src/main/resources/avatars/face25.jpg
Normal file
After ![]() (image error) Size: 6.9 KiB |
BIN
Mage.Client/src/main/resources/avatars/face26.jpg
Normal file
After ![]() (image error) Size: 7.3 KiB |
BIN
Mage.Client/src/main/resources/avatars/face27.jpg
Normal file
After ![]() (image error) Size: 7.4 KiB |
BIN
Mage.Client/src/main/resources/avatars/face28.jpg
Normal file
After ![]() (image error) Size: 7.3 KiB |
BIN
Mage.Client/src/main/resources/avatars/face29.jpg
Normal file
After ![]() (image error) Size: 7 KiB |
BIN
Mage.Client/src/main/resources/avatars/face3.jpg
Normal file
After ![]() (image error) Size: 8.7 KiB |
BIN
Mage.Client/src/main/resources/avatars/face30.jpg
Normal file
After ![]() (image error) Size: 9 KiB |
BIN
Mage.Client/src/main/resources/avatars/face31.jpg
Normal file
After ![]() (image error) Size: 8.5 KiB |
BIN
Mage.Client/src/main/resources/avatars/face32.jpg
Normal file
After ![]() (image error) Size: 6.7 KiB |
BIN
Mage.Client/src/main/resources/avatars/face33.jpg
Normal file
After ![]() (image error) Size: 6.8 KiB |
BIN
Mage.Client/src/main/resources/avatars/face34.jpg
Normal file
After ![]() (image error) Size: 8.8 KiB |
BIN
Mage.Client/src/main/resources/avatars/face35.jpg
Normal file
After ![]() (image error) Size: 9.5 KiB |
BIN
Mage.Client/src/main/resources/avatars/face36.jpg
Normal file
After ![]() (image error) Size: 6.7 KiB |
BIN
Mage.Client/src/main/resources/avatars/face37.jpg
Normal file
After ![]() (image error) Size: 8.3 KiB |
BIN
Mage.Client/src/main/resources/avatars/face38.jpg
Normal file
After ![]() (image error) Size: 8.5 KiB |
BIN
Mage.Client/src/main/resources/avatars/face39.jpg
Normal file
After ![]() (image error) Size: 7 KiB |
BIN
Mage.Client/src/main/resources/avatars/face49.jpg
Normal file
After ![]() (image error) Size: 6.1 KiB |
BIN
Mage.Client/src/main/resources/avatars/face5.jpg
Normal file
After ![]() (image error) Size: 7.4 KiB |
BIN
Mage.Client/src/main/resources/avatars/face50.jpg
Normal file
After ![]() (image error) Size: 6.9 KiB |
BIN
Mage.Client/src/main/resources/avatars/face51.jpg
Normal file
After ![]() (image error) Size: 6.3 KiB |
BIN
Mage.Client/src/main/resources/avatars/face52.jpg
Normal file
After ![]() (image error) Size: 8.8 KiB |
BIN
Mage.Client/src/main/resources/avatars/face53.jpg
Normal file
After ![]() (image error) Size: 7.5 KiB |
BIN
Mage.Client/src/main/resources/avatars/face54.jpg
Normal file
After ![]() (image error) Size: 9.8 KiB |
BIN
Mage.Client/src/main/resources/avatars/face55.jpg
Normal file
After ![]() (image error) Size: 6.7 KiB |
BIN
Mage.Client/src/main/resources/avatars/face56.jpg
Normal file
After ![]() (image error) Size: 5.7 KiB |
BIN
Mage.Client/src/main/resources/avatars/face57.jpg
Normal file
After ![]() (image error) Size: 6 KiB |
BIN
Mage.Client/src/main/resources/avatars/face58.jpg
Normal file
After ![]() (image error) Size: 7.6 KiB |
BIN
Mage.Client/src/main/resources/avatars/face59.jpg
Normal file
After ![]() (image error) Size: 7.2 KiB |
BIN
Mage.Client/src/main/resources/avatars/face6.jpg
Normal file
After ![]() (image error) Size: 7.4 KiB |
BIN
Mage.Client/src/main/resources/avatars/face60.jpg
Normal file
After ![]() (image error) Size: 9 KiB |
BIN
Mage.Client/src/main/resources/avatars/face61.jpg
Normal file
After ![]() (image error) Size: 5.8 KiB |
BIN
Mage.Client/src/main/resources/avatars/face62.jpg
Normal file
After ![]() (image error) Size: 9.5 KiB |
BIN
Mage.Client/src/main/resources/avatars/face63.jpg
Normal file
After ![]() (image error) Size: 6.4 KiB |
BIN
Mage.Client/src/main/resources/avatars/face64.jpg
Normal file
After ![]() (image error) Size: 7.8 KiB |
BIN
Mage.Client/src/main/resources/avatars/face65.jpg
Normal file
After ![]() (image error) Size: 7.6 KiB |
BIN
Mage.Client/src/main/resources/avatars/face66.jpg
Normal file
After ![]() (image error) Size: 8.5 KiB |
BIN
Mage.Client/src/main/resources/avatars/face67.jpg
Normal file
After ![]() (image error) Size: 8.1 KiB |
BIN
Mage.Client/src/main/resources/avatars/face68.jpg
Normal file
After ![]() (image error) Size: 8.3 KiB |
BIN
Mage.Client/src/main/resources/avatars/face69.jpg
Normal file
After ![]() (image error) Size: 11 KiB |
BIN
Mage.Client/src/main/resources/avatars/face7.jpg
Normal file
After ![]() (image error) Size: 7.1 KiB |
BIN
Mage.Client/src/main/resources/avatars/face70.jpg
Normal file
After ![]() (image error) Size: 8.5 KiB |
BIN
Mage.Client/src/main/resources/avatars/face71.jpg
Normal file
After ![]() (image error) Size: 9.2 KiB |
BIN
Mage.Client/src/main/resources/avatars/face72.jpg
Normal file
After ![]() (image error) Size: 9.3 KiB |
BIN
Mage.Client/src/main/resources/avatars/face73.jpg
Normal file
After ![]() (image error) Size: 8.7 KiB |
BIN
Mage.Client/src/main/resources/avatars/face74.jpg
Normal file
After ![]() (image error) Size: 9.9 KiB |
BIN
Mage.Client/src/main/resources/avatars/face75.jpg
Normal file
After ![]() (image error) Size: 10 KiB |
BIN
Mage.Client/src/main/resources/avatars/face76.jpg
Normal file
After ![]() (image error) Size: 8 KiB |
BIN
Mage.Client/src/main/resources/avatars/face77.jpg
Normal file
After ![]() (image error) Size: 11 KiB |
BIN
Mage.Client/src/main/resources/avatars/face8.jpg
Normal file
After ![]() (image error) Size: 7 KiB |
BIN
Mage.Client/src/main/resources/avatars/face9.jpg
Normal file
After ![]() (image error) Size: 5.6 KiB |
BIN
Mage.Client/src/main/resources/empty.png
Normal file
After ![]() (image error) Size: 66 KiB |
BIN
Mage.Client/src/main/resources/info/cheat.png
Normal file
After ![]() (image error) Size: 2 KiB |
BIN
Mage.Client/src/main/resources/info/grave.png
Normal file
After ![]() (image error) Size: 8.7 KiB |
BIN
Mage.Client/src/main/resources/info/hand.png
Normal file
After ![]() (image error) Size: 926 B |
BIN
Mage.Client/src/main/resources/info/library.png
Normal file
After ![]() (image error) Size: 4.9 KiB |
BIN
Mage.Client/src/main/resources/info/life.png
Normal file
After ![]() (image error) Size: 721 B |
BIN
Mage.Client/src/main/resources/info/poison.png
Normal file
After ![]() (image error) Size: 470 B |
|
@ -113,10 +113,14 @@ public class ManaSymbols {
|
|||
}
|
||||
|
||||
static public String replaceSetCodeWithHTML(String set, String rarity) {
|
||||
if (setImagesExist.containsKey(set)) {
|
||||
Integer width = setImagesExist.get(set).width;
|
||||
Integer height = setImagesExist.get(set).height;
|
||||
return "<img src='file:plugins/images/sets/small/" + set + "-" + rarity + ".png' alt='" + rarity + " ' width=" + width + " height=" + height + ">";
|
||||
String _set = set;
|
||||
if (_set.equals("CON")) {
|
||||
_set = "CFX";
|
||||
}
|
||||
if (setImagesExist.containsKey(_set)) {
|
||||
Integer width = setImagesExist.get(_set).width;
|
||||
Integer height = setImagesExist.get(_set).height;
|
||||
return "<img src='file:plugins/images/sets/small/" + _set + "-" + rarity + ".png' alt='" + rarity + " ' width=" + width + " height=" + height + ">";
|
||||
} else {
|
||||
return set;
|
||||
}
|
||||
|
|
|
@ -123,6 +123,8 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (legal.length() > 0) {
|
||||
//buffer.append("<br>");
|
||||
legal = legal.replaceAll("\\{this\\}", card.getName());
|
||||
|
|