1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-03-27 17:00:20 -09:00

changes to support multiplayer

This commit is contained in:
BetaSteward 2010-05-17 03:19:06 +00:00
parent 79dbfca2ff
commit 805f20264e
53 changed files with 1266 additions and 458 deletions

View file

@ -0,0 +1,7 @@
server-name=localhost
port=17171
remote-server=mage-server
cards-resource-path=resources/images/cards/
symbols-resource-path=resources/images/symbols/
resource-path=resources/images/
card-scaling-factor=0.4

View file

@ -73,4 +73,4 @@ run.test.classpath=\
source.encoding=UTF-8
src.dir=src
test.src.dir=test
app.version=0.2
app.version=0.3

View file

@ -3,4 +3,5 @@ port=17171
remote-server=mage-server
cards-resource-path=resources/images/cards/
symbols-resource-path=resources/images/symbols/
resource-path=resources/images/
resource-path=resources/images/
card-scaling-factor=0.4

View file

@ -52,7 +52,7 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout"/>
<SubComponents>
<Component class="mage.client.TablesPane" name="tablesPane">
<Component class="mage.client.table.TablesPane" name="tablesPane">
<Properties>
<Property name="maximum" type="boolean" value="true"/>
</Properties>

View file

@ -36,17 +36,14 @@ package mage.client;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JDesktopPane;
import javax.swing.JLayeredPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import mage.cards.decks.Deck;
import mage.client.dialog.AboutDialog;
import mage.client.dialog.ConnectDialog;
import mage.client.remote.Session;
@ -99,7 +96,8 @@ public class MageFrame extends javax.swing.JFrame {
session = new Session(this);
connectDialog = new ConnectDialog(session);
desktopPane.add(connectDialog);
desktopPane.add(connectDialog, JLayeredPane.POPUP_LAYER);
// connectDialog.setLocation(50, 50);
disableButtons();
}
@ -134,7 +132,7 @@ public class MageFrame extends javax.swing.JFrame {
private void initComponents() {
desktopPane = new javax.swing.JDesktopPane();
tablesPane = new mage.client.TablesPane();
tablesPane = new mage.client.table.TablesPane();
gamePane = new mage.client.game.GamePane();
deckEditorPane = new mage.client.deckeditor.DeckEditorPane();
mageToolbar = new javax.swing.JToolBar();
@ -344,7 +342,7 @@ public class MageFrame extends javax.swing.JFrame {
private javax.swing.JToolBar.Separator jSeparator4;
private javax.swing.JLabel lblStatus;
private javax.swing.JToolBar mageToolbar;
private mage.client.TablesPane tablesPane;
private mage.client.table.TablesPane tablesPane;
// End of variables declaration//GEN-END:variables
public void setStatusText(String status) {

View file

@ -7,7 +7,7 @@
</Property>
<Property name="opaque" type="boolean" value="false"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new Dimension(FRAME_WIDTH, FRAME_HEIGHT)" type="code"/>
<Connection code="new Dimension(dimension.frameWidth, dimension.frameHeight)" type="code"/>
</Property>
</Properties>
<AuxValues>
@ -37,7 +37,7 @@
<Property name="opaque" type="boolean" value="false"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_allCodePost" type="java.lang.String" value="jScrollPane1.setBounds(new Rectangle(CONTENT_XOFFSET, TEXT_YOFFSET, TEXT_WIDTH, TEXT_HEIGHT));"/>
<AuxValue name="JavaCodeGenerator_allCodePost" type="java.lang.String" value="jScrollPane1.setBounds(new Rectangle(dimension.contentXOffset, dimension.textYOffset, dimension.textWidth, dimension.textHeight));"/>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Constraints>

View file

@ -63,6 +63,7 @@ import javax.swing.text.StyledDocument;
import mage.Constants.CardType;
import mage.client.MageFrame;
import mage.client.remote.Session;
import mage.client.util.ImageHelper;
import mage.view.CardView;
import static mage.client.util.Constants.*;
@ -76,6 +77,7 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
protected static Session session = MageFrame.getSession();
protected Point p;
protected CardDimensions dimension;
protected UUID gameId;
protected BigCard bigCard;
@ -85,15 +87,17 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
protected TextPopup popupText = new TextPopup();
protected BufferedImage background;
protected BufferedImage image = new BufferedImage(FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT, BufferedImage.TYPE_INT_RGB);
protected BufferedImage small = new BufferedImage(FRAME_WIDTH, FRAME_HEIGHT, BufferedImage.TYPE_INT_RGB);
protected BufferedImage small;
/** Creates new form Card */
public Card(CardView card, BigCard bigCard, UUID gameId) {
public Card(CardView card, BigCard bigCard, CardDimensions dimension, UUID gameId) {
this.dimension = dimension;
initComponents();
this.gameId = gameId;
this.card = card;
this.bigCard = bigCard;
small = new BufferedImage(dimension.frameWidth, dimension.frameHeight, BufferedImage.TYPE_INT_RGB);
background = ImageHelper.getBackground(card);
StyledDocument doc = text.getStyledDocument();
@ -132,15 +136,15 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
gSmall.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
gSmall.setColor(Color.BLACK);
gSmall.drawImage(ImageHelper.ScaleImage(image, FRAME_WIDTH, FRAME_HEIGHT), 0, 0, this);
gSmall.drawImage(ImageHelper.ScaleImage(image, dimension.frameWidth, dimension.frameHeight), 0, 0, this);
gImage.setFont(new Font("Arial", Font.PLAIN, NAME_FONT_MAX_SIZE));
gImage.drawString(card.getName(), CONTENT_MAX_XOFFSET, NAME_MAX_YOFFSET);
if (card.getCardTypes().contains(CardType.CREATURE)) {
gImage.drawString(card.getPower() + "/" + card.getToughness(), POWBOX_MAX_LEFT + 10, POWBOX_MAX_TOP + 15);
gImage.drawString(card.getPower() + "/" + card.getToughness(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
}
else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
gImage.drawString(card.getLoyalty(), POWBOX_MAX_LEFT + 10, POWBOX_MAX_TOP + 15);
gImage.drawString(card.getLoyalty(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
}
if (card.getCardTypes().size() > 0)
@ -148,17 +152,17 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
gImage.dispose();
gSmall.setFont(new Font("Arial", Font.PLAIN, NAME_FONT_SIZE));
gSmall.drawString(card.getName(), CONTENT_XOFFSET, NAME_YOFFSET+1);
gSmall.setFont(new Font("Arial", Font.PLAIN, dimension.nameFontSize));
gSmall.drawString(card.getName(), dimension.contentXOffset, dimension.nameYOffset);
if (card.getCardTypes().contains(CardType.CREATURE)) {
gSmall.drawString(card.getPower() + "/" + card.getToughness(), POWBOX_LEFT + 5, POWBOX_TOP + 8);
gSmall.drawString(card.getPower() + "/" + card.getToughness(), dimension.powBoxTextLeft, dimension.powBoxTextTop);
}
else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
gSmall.drawString(card.getLoyalty(), POWBOX_LEFT + 5, POWBOX_TOP + 8);
gSmall.drawString(card.getLoyalty(), dimension.powBoxTextLeft, dimension.powBoxTextTop);
}
if (card.getCardTypes().size() > 0)
gSmall.drawString(cardType, CONTENT_XOFFSET, TYPE_YOFFSET);
gSmall.drawString(cardType, dimension.contentXOffset, dimension.typeYOffset);
drawText();
gSmall.dispose();
@ -171,15 +175,17 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
sb.append("\n").append(card.getManaCost());
}
sb.append("\n").append(cardType);
sb.append("\n").append(card.getColor().toString());
for (String rule: getRules()) {
sb.append("\n").append(rule);
if (card.getColor().hasColor()) {
sb.append("\n").append(card.getColor().toString());
}
if (card.getCardTypes().contains(CardType.CREATURE)) {
sb.append(card.getPower()).append("/").append(card.getToughness());
sb.append("\n").append(card.getPower()).append("/").append(card.getToughness());
}
else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
sb.append(card.getLoyalty());
sb.append("\n").append(card.getLoyalty());
}
for (String rule: getRules()) {
sb.append("\n").append(rule);
}
return sb.toString();
}
@ -235,7 +241,7 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
setMinimumSize(getPreferredSize());
setOpaque(false);
setPreferredSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT));
setPreferredSize(new Dimension(dimension.frameWidth, dimension.frameHeight));
setLayout(null);
jScrollPane1.setBorder(null);
@ -245,14 +251,14 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
text.setBorder(null);
text.setEditable(false);
text.setFont(new java.awt.Font("Arial", 0, 9)); // NOI18N
text.setFont(new java.awt.Font("Arial", 0, 9));
text.setFocusable(false);
text.setOpaque(false);
jScrollPane1.setViewportView(text);
add(jScrollPane1);
jScrollPane1.setBounds(20, 110, 130, 100);
jScrollPane1.setBounds(new Rectangle(CONTENT_XOFFSET, TEXT_YOFFSET, TEXT_WIDTH, TEXT_HEIGHT));
jScrollPane1.setBounds(new Rectangle(dimension.contentXOffset, dimension.textYOffset, dimension.textWidth, dimension.textHeight));
}// </editor-fold>//GEN-END:initComponents
@Override
@ -266,7 +272,7 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
} else {
g2.setColor(Color.BLACK);
}
g2.drawRect(0, 0, FRAME_WIDTH - 1, FRAME_HEIGHT - 1);
g2.drawRect(0, 0, dimension.frameWidth - 1, dimension.frameHeight - 1);
}
@Override
@ -298,11 +304,11 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
if (popup != null)
popup.hide();
PopupFactory factory = PopupFactory.getSharedInstance();
popup = factory.getPopup(this, popupText, (int) this.getLocationOnScreen().getX() + FRAME_WIDTH, (int) this.getLocationOnScreen().getY() + 40);
popup = factory.getPopup(this, popupText, (int) this.getLocationOnScreen().getX() + dimension.frameWidth, (int) this.getLocationOnScreen().getY() + 40);
popup.show();
//hack to get popup to resize to fit text
popup.hide();
popup = factory.getPopup(this, popupText, (int) this.getLocationOnScreen().getX() + FRAME_WIDTH, (int) this.getLocationOnScreen().getY() + 40);
popup = factory.getPopup(this, popupText, (int) this.getLocationOnScreen().getX() + dimension.frameWidth, (int) this.getLocationOnScreen().getY() + 40);
popup.show();
}

View file

@ -0,0 +1,69 @@
/*
* 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.
*/
package mage.client.cards;
import static mage.client.util.Constants.*;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class CardDimensions {
public static int frameHeight;
public static int frameWidth;
public static int symbolHeight;
public static int symbolWidth;
public static int contentXOffset;
public static int nameYOffset;
public static int typeYOffset;
public static int textYOffset;
public static int textWidth;
public static int textHeight;
public static int powBoxTextTop;
public static int powBoxTextLeft;
public static int nameFontSize;
public CardDimensions(double scaleFactor) {
frameHeight = (int)(FRAME_MAX_HEIGHT * scaleFactor);
frameWidth = (int)(FRAME_MAX_WIDTH * scaleFactor);
symbolHeight = (int)(SYMBOL_MAX_HEIGHT * scaleFactor);
symbolWidth = (int)(SYMBOL_MAX_WIDTH * scaleFactor);
contentXOffset = (int)(CONTENT_MAX_XOFFSET * scaleFactor);
nameYOffset = (int)(NAME_MAX_YOFFSET * scaleFactor);
typeYOffset = (int)(TYPE_MAX_YOFFSET * scaleFactor);
textYOffset = (int)(TEXT_MAX_YOFFSET * scaleFactor);
textWidth = (int)(TEXT_MAX_WIDTH * scaleFactor);
textHeight = (int)(TEXT_MAX_HEIGHT * scaleFactor);
powBoxTextTop = (int)(POWBOX_MAX_TOP * scaleFactor);
powBoxTextLeft = (int)(POWBOX_MAX_LEFT * scaleFactor);
nameFontSize = Math.max(9, (int)(NAME_FONT_MAX_SIZE * scaleFactor));
}
}

View file

@ -52,6 +52,7 @@ public class CardEventSource implements EventSource<Event>, Serializable {
dispatcher.fireEvent(new Event(cardId, message));
}
@Override
public void clearListeners() {
dispatcher.clearListeners();
}

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Form version="1.3" maxVersion="1.7">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>

View file

@ -44,11 +44,11 @@ import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.client.util.Config;
import mage.client.util.Event;
import mage.client.util.Listener;
import mage.view.CardView;
import mage.view.CardsView;
import static mage.client.util.Constants.*;
/**
*
@ -64,7 +64,7 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
public CardGrid() {
initComponents();
addComponentListener(this);
setPreferredSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT));
setPreferredSize(new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight));
}
public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId) {
@ -72,7 +72,7 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
this.gameId = gameId;
cards.clear();
for (CardView card: showCards) {
Card cardImg = new Card(card, bigCard, gameId);
Card cardImg = new Card(card, bigCard, Config.dimensions, gameId);
cardImg.update(card);
cardImg.addMouseListener(this);
cards.add(cardImg);
@ -84,13 +84,13 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
public void drawCards() {
removeAll();
int maxWidth = this.getParent().getWidth();
int numColumns = maxWidth / FRAME_WIDTH;
int numColumns = maxWidth / Config.dimensions.frameWidth;
int curColumn = 0;
int curRow = 0;
if (cards.size() > 0) {
Rectangle rectangle = new Rectangle(FRAME_WIDTH, FRAME_HEIGHT);
Rectangle rectangle = new Rectangle(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
for (Card cardImg: cards) {
rectangle.setLocation(curColumn * FRAME_WIDTH, curRow * 20);
rectangle.setLocation(curColumn * Config.dimensions.frameWidth, curRow * 20);
cardImg.setBounds(rectangle);
add(cardImg);
moveToFront(cardImg);

View file

@ -36,6 +36,7 @@ package mage.client.cards;
import java.awt.Dimension;
import java.util.UUID;
import mage.client.util.Config;
import mage.view.CardView;
import mage.view.CardsView;
import static mage.client.util.Constants.*;
@ -49,17 +50,17 @@ public class Cards extends javax.swing.JPanel {
/** Creates new form Cards */
public Cards() {
initComponents();
cardArea.setPreferredSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT));
cardArea.setPreferredSize(new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight));
}
public void loadCards(CardsView cards, BigCard bigCard, UUID gameId) {
cardArea.removeAll();
for (CardView card: cards) {
Card cardImg = new Card(card, bigCard, gameId);
Card cardImg = new Card(card, bigCard, Config.dimensions, gameId);
cardArea.add(cardImg);
cardImg.update(card);
}
cardArea.setPreferredSize(new Dimension(cards.size() * FRAME_WIDTH, FRAME_HEIGHT));
cardArea.setPreferredSize(new Dimension(cards.size() * Config.dimensions.frameWidth, Config.dimensions.frameHeight));
cardArea.revalidate();
cardArea.repaint();
this.revalidate();

View file

@ -39,6 +39,7 @@ import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.UUID;
import mage.client.util.Config;
import mage.client.util.Event;
import mage.client.util.Listener;
import mage.view.CardView;
@ -56,23 +57,23 @@ public class CardsList extends javax.swing.JPanel implements MouseListener {
/** Creates new form Cards */
public CardsList() {
initComponents();
cardArea.setPreferredSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT));
cardArea.setPreferredSize(new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight));
}
public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId) {
cardArea.removeAll();
if (showCards != null && showCards.size() > 0) {
Rectangle rectangle = new Rectangle(FRAME_WIDTH, FRAME_HEIGHT);
Rectangle rectangle = new Rectangle(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
int count = 0;
for (CardView card: showCards) {
Card cardImg = new Card(card, bigCard, gameId);
Card cardImg = new Card(card, bigCard, Config.dimensions, gameId);
cardImg.setBounds(rectangle);
cardArea.add(cardImg);
cardArea.moveToFront(cardImg);
cardImg.update(card);
cardImg.addMouseListener(this);
if (count >= 10) {
rectangle.translate(FRAME_WIDTH, -200);
rectangle.translate(Config.dimensions.frameWidth, -200);
count = 0;
} else {
rectangle.translate(0, 20);
@ -80,7 +81,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener {
}
}
}
cardArea.setPreferredSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT + 200));
cardArea.setPreferredSize(new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight + 200));
cardArea.revalidate();
this.revalidate();
this.repaint();
@ -122,6 +123,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener {
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2 && !e.isConsumed()) {
e.consume();

View file

@ -46,8 +46,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.swing.PopupFactory;
import javax.swing.text.BadLocationException;
import javax.swing.text.StyledDocument;
import mage.client.util.ImageHelper;
import mage.view.CounterView;
import mage.view.PermanentView;
@ -63,14 +61,15 @@ public class Permanent extends Card {
protected List<Permanent> links = new ArrayList<Permanent>();
protected boolean linked;
protected BufferedImage tappedImage = new BufferedImage(FRAME_HEIGHT, FRAME_WIDTH, BufferedImage.TYPE_INT_RGB);
protected BufferedImage tappedImage;
protected BufferedImage flippedImage;
/** Creates new form Permanent */
public Permanent(PermanentView permanent, BigCard bigCard, UUID gameId) {
super(permanent, bigCard, gameId);
public Permanent(PermanentView permanent, BigCard bigCard, CardDimensions dimensions, UUID gameId) {
super(permanent, bigCard, dimensions, gameId);
this.setSize(this.getPreferredSize());
this.permanent = permanent;
tappedImage = new BufferedImage(dimension.frameHeight, dimension.frameWidth, BufferedImage.TYPE_INT_RGB);
}
public UUID getPermanentId() {
@ -154,10 +153,10 @@ public class Permanent extends Card {
g2.setColor(Color.BLACK);
}
if (permanent.isTapped()) {
g2.drawRect(0, 0, FRAME_HEIGHT - 1, FRAME_WIDTH - 1);
g2.drawRect(0, 0, dimension.frameHeight - 1, dimension.frameWidth - 1);
}
else {
g2.drawRect(0, 0, FRAME_WIDTH - 1, FRAME_HEIGHT - 1);
g2.drawRect(0, 0, dimension.frameWidth - 1, dimension.frameHeight - 1);
}
}
@ -166,7 +165,7 @@ public class Permanent extends Card {
Graphics2D g = (Graphics2D) tappedImage.getGraphics();
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.drawImage(this.createImage(ImageHelper.rotate(small)), 0, 0, this);
g.drawImage(this.createImage(ImageHelper.rotate(small, dimension)), 0, 0, this);
g.dispose();
}
@ -177,7 +176,7 @@ public class Permanent extends Card {
if (permanent.getDamage() > 0) {
Graphics2D g = image.createGraphics();
g.setColor(Color.RED);
g.drawString(Integer.toString(permanent.getDamage()), DAMAGE_MAX_LEFT, POWBOX_MAX_TOP + 15);
g.drawString(Integer.toString(permanent.getDamage()), DAMAGE_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
g.dispose();
}
generateTappedImage();
@ -186,10 +185,10 @@ public class Permanent extends Card {
@Override
public Dimension getPreferredSize() {
if (permanent != null && permanent.isTapped()) {
return new Dimension(FRAME_HEIGHT, FRAME_WIDTH);
return new Dimension(dimension.frameHeight, dimension.frameWidth);
}
else {
return new Dimension(FRAME_WIDTH, FRAME_HEIGHT);
return new Dimension(dimension.frameWidth, dimension.frameHeight);
}
}
@ -207,7 +206,7 @@ public class Permanent extends Card {
if (popup != null)
popup.hide();
PopupFactory factory = PopupFactory.getSharedInstance();
int x = (int) this.getLocationOnScreen().getX() + (permanent.isTapped()?FRAME_HEIGHT:FRAME_WIDTH);
int x = (int) this.getLocationOnScreen().getX() + (permanent.isTapped()?dimension.frameHeight:dimension.frameWidth);
int y = (int) this.getLocationOnScreen().getY() + 40;
popup = factory.getPopup(this, popupText, x, y);
popup.show();

View file

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
<Properties>
<Property name="title" type="java.lang.String" value="About MAGE"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
@ -55,7 +58,7 @@
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="19" max="32767" attributes="0"/>
<EmptySpace pref="23" max="32767" attributes="0"/>
<Component id="btnOk" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>

View file

@ -48,6 +48,7 @@ public class AboutDialog extends MageDialog {
public void showDialog() {
this.lblVersion.setText(MageDialog.class.getPackage().getImplementationVersion());
this.setLocation(100, 100);
this.setVisible(true);
}
@ -66,6 +67,8 @@ public class AboutDialog extends MageDialog {
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
setTitle("About MAGE");
btnOk.setText("OK");
btnOk.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -115,7 +118,7 @@ public class AboutDialog extends MageDialog {
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 19, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
.addComponent(btnOk)
.addContainerGap())
);

View file

@ -3,6 +3,7 @@
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
<Properties>
<Property name="resizable" type="boolean" value="true"/>
<Property name="title" type="java.lang.String" value="Combat"/>
<Property name="normalBounds" type="java.awt.Rectangle" editor="org.netbeans.beaninfo.editors.RectangleEditor">
<Rectangle value="[400, 200, 410, 307]"/>
</Property>

View file

@ -108,6 +108,7 @@ public class CombatDialog extends MageDialog {
combatArea = new javax.swing.JPanel();
setResizable(true);
setTitle("Combat");
setNormalBounds(new java.awt.Rectangle(400, 200, 410, 307));
setVisible(true);
getContentPane().setLayout(new java.awt.BorderLayout());

View file

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
<Properties>
<Property name="title" type="java.lang.String" value="Connect"/>
<Property name="normalBounds" type="java.awt.Rectangle" editor="org.netbeans.beaninfo.editors.RectangleEditor">
<Rectangle value="[100, 100, 410, 307]"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
@ -22,12 +28,7 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="btnConnect" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="lblPort" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="lblServer" min="-2" max="-2" attributes="0"/>
@ -39,10 +40,15 @@
<Component id="txtPort" min="-2" pref="71" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="131" max="-2" attributes="0"/>
</Group>
<Component id="txtServer" pref="268" max="32767" attributes="0"/>
<Component id="txtUserName" alignment="0" pref="268" max="32767" attributes="0"/>
<Component id="txtServer" pref="236" max="32767" attributes="0"/>
<Component id="txtUserName" alignment="0" pref="236" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="btnConnect" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -50,7 +56,7 @@
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblServer" alignment="3" min="-2" max="-2" attributes="0"/>
@ -66,7 +72,7 @@
<Component id="txtUserName" min="-2" max="-2" attributes="0"/>
<Component id="lblUserName" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="43" max="32767" attributes="0"/>
<EmptySpace pref="17" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="btnCancel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnConnect" alignment="3" min="-2" max="-2" attributes="0"/>

View file

@ -67,6 +67,7 @@ public class ConnectDialog extends MageDialog {
this.txtPort.setText(prefs.get("serverPort", Integer.toString(Config.port)));
this.txtUserName.setText(prefs.get("userName", ""));
this.setModal(true);
this.setLocation(50, 50);
this.setVisible(true);
}
@ -88,6 +89,9 @@ public class ConnectDialog extends MageDialog {
btnConnect = new javax.swing.JButton();
btnCancel = new javax.swing.JButton();
setTitle("Connect");
setNormalBounds(new java.awt.Rectangle(100, 100, 410, 307));
lblServer.setLabelFor(txtServer);
lblServer.setText("Server:");
@ -124,11 +128,7 @@ public class ConnectDialog extends MageDialog {
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(btnConnect)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCancel))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lblPort)
.addComponent(lblServer)
@ -138,13 +138,17 @@ public class ConnectDialog extends MageDialog {
.addGroup(layout.createSequentialGroup()
.addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(131, 131, 131))
.addComponent(txtServer, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE)
.addComponent(txtUserName, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE))))
.addComponent(txtServer, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
.addComponent(txtUserName, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(btnConnect)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCancel)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblServer)
@ -157,7 +161,7 @@ public class ConnectDialog extends MageDialog {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtUserName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblUserName))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 43, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnCancel)
.addComponent(btnConnect))

View file

@ -61,11 +61,11 @@ public class ExileZoneDialog extends MageDialog {
cards.loadCards(exile, bigCard, gameId);
if (getParent() != MageFrame.getDesktop() || this.isClosed)
MageFrame.getDesktop().add(this, JLayeredPane.POPUP_LAYER);
try {
this.setIcon(false);
} catch (PropertyVetoException ex) {
Logger.getLogger(ShowCardsDialog.class.getName()).log(Level.SEVERE, null, ex);
}
// try {
// this.setIcon(false);
// } catch (PropertyVetoException ex) {
// Logger.getLogger(ShowCardsDialog.class.getName()).log(Level.SEVERE, null, ex);
// }
}
this.setVisible(exile.size() > 0);
}

View file

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
<Properties>
<Property name="title" type="java.lang.String" value="Join Table"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
@ -33,7 +36,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="newPlayerPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="22" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="btnCancel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnOK" alignment="3" min="-2" max="-2" attributes="0"/>
@ -60,7 +63,7 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnOKActionPerformed"/>
</Events>
</Component>
<Component class="mage.client.NewPlayerPanel" name="newPlayerPanel">
<Component class="mage.client.table.NewPlayerPanel" name="newPlayerPanel">
</Component>
</SubComponents>
</Form>

View file

@ -65,6 +65,7 @@ public class JoinTableDialog extends MageDialog {
this.roomId = roomId;
this.tableId = tableId;
this.setModal(true);
this.setLocation(100, 100);
this.setVisible(true);
}
@ -80,7 +81,9 @@ public class JoinTableDialog extends MageDialog {
btnCancel = new javax.swing.JButton();
btnOK = new javax.swing.JButton();
newPlayerPanel = new mage.client.NewPlayerPanel();
newPlayerPanel = new mage.client.table.NewPlayerPanel();
setTitle("Join Table");
btnCancel.setText("Cancel");
btnCancel.addActionListener(new java.awt.event.ActionListener() {
@ -112,7 +115,7 @@ public class JoinTableDialog extends MageDialog {
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(newPlayerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnCancel)
.addComponent(btnOK))
@ -153,7 +156,7 @@ public class JoinTableDialog extends MageDialog {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCancel;
private javax.swing.JButton btnOK;
private mage.client.NewPlayerPanel newPlayerPanel;
private mage.client.table.NewPlayerPanel newPlayerPanel;
// End of variables declaration//GEN-END:variables
}

View file

@ -24,7 +24,7 @@
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="298" max="32767" attributes="0"/>
<EmptySpace min="0" pref="302" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>

View file

@ -63,7 +63,6 @@ public class MageDialog extends javax.swing.JInternalFrame {
@Override
public void show() {
this.setLocation(200, 200);
super.show();
if (this.modal) {
startModal();

View file

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
<Properties>
<Property name="title" type="java.lang.String" value="New Table"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
@ -19,42 +22,75 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="25" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="lblGameType" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="lbDeckType" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="cbDeckType" alignment="0" max="32767" attributes="1"/>
<Component id="cbGameType" alignment="0" min="-2" pref="241" max="-2" attributes="1"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="lbPlayer2Type" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="cbPlayer2Type" min="-2" pref="241" max="-2" attributes="1"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="player1Panel" pref="468" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="player2Panel" pref="468" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="360" max="32767" attributes="0"/>
<Component id="btnOK" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="358" max="32767" attributes="0"/>
<Component id="btnOK" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="lbDeckType" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="426" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="cbGameType" alignment="0" max="32767" attributes="1"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lblNumPlayers" min="-2" max="-2" attributes="0"/>
<Component id="spnNumPlayers" min="-2" pref="90" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lblRange" min="-2" max="-2" attributes="1"/>
<Component id="cbRange" min="-2" pref="141" max="-2" attributes="1"/>
</Group>
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lblAttack" min="-2" max="-2" attributes="0"/>
<Component id="cbAttackOption" alignment="0" min="-2" pref="199" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="lblGameType" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="cbDeckType" alignment="0" max="32767" attributes="1"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jSeparator2" pref="466" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="396" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="player1Panel" pref="466" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="399" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jSeparator1" pref="466" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Component id="pnlOtherPlayers" alignment="0" min="-2" pref="486" max="-2" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jSeparator3" pref="466" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
@ -62,30 +98,56 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="cbGameType" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblGameType" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="lbDeckType" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="cbDeckType" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="lblGameType" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="cbGameType" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="cbDeckType" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lbDeckType" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="lblAttack" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="cbAttackOption" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="lblNumPlayers" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="spnNumPlayers" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="lblRange" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="cbRange" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jSeparator2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="player1Panel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lbPlayer2Type" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cbPlayer2Type" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="pnlOtherPlayers" pref="83" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jSeparator1" pref="4" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="player2Panel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="26" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="btnCancel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnOK" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
</Group>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="223" max="-2" attributes="0"/>
<Component id="jSeparator3" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="149" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
@ -93,28 +155,21 @@
<SubComponents>
<Component class="javax.swing.JLabel" name="lblGameType">
<Properties>
<Property name="text" type="java.lang.String" value="Game Type:"/>
<Property name="text" type="java.lang.String" value="Game Type"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="cbGameType">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbGameTypeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="lbDeckType">
<Properties>
<Property name="text" type="java.lang.String" value="Deck Type:"/>
<Property name="text" type="java.lang.String" value="Deck Type"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="cbDeckType">
</Component>
<Component class="javax.swing.JLabel" name="lbPlayer2Type">
<Properties>
<Property name="text" type="java.lang.String" value="Player 2 Type:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="cbPlayer2Type">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbPlayer2TypeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btnOK">
<Properties>
<Property name="text" type="java.lang.String" value="OK"/>
@ -131,9 +186,79 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCancelActionPerformed"/>
</Events>
</Component>
<Component class="mage.client.NewPlayerPanel" name="player2Panel">
<Component class="mage.client.table.NewPlayerPanel" name="player1Panel">
</Component>
<Component class="mage.client.NewPlayerPanel" name="player1Panel">
<Component class="javax.swing.JSpinner" name="spnNumPlayers">
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="numPlayersChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="lblNumPlayers">
<Properties>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="spnNumPlayers"/>
</Property>
<Property name="text" type="java.lang.String" value="Players"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="cbRange">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="0"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblRange">
<Properties>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="cbRange"/>
</Property>
<Property name="text" type="java.lang.String" value="Range of Influence"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblAttack">
<Properties>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="cbAttackOption"/>
</Property>
<Property name="text" type="java.lang.String" value="Attack Option"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="cbAttackOption">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="0"/>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="pnlOtherPlayers">
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
<Property name="columns" type="int" value="1"/>
<Property name="rows" type="int" value="0"/>
</Layout>
</Container>
<Component class="javax.swing.JSeparator" name="jSeparator1">
</Component>
<Component class="javax.swing.JSeparator" name="jSeparator2">
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="11" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Player 1 (You)"/>
</Properties>
</Component>
<Component class="javax.swing.JSeparator" name="jSeparator3">
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="11" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Other Players"/>
</Properties>
</Component>
</SubComponents>
</Form>

View file

@ -34,6 +34,8 @@
package mage.client.dialog;
import java.io.FileNotFoundException;
import java.io.IOException;
import mage.client.*;
import java.util.ArrayList;
import java.util.List;
@ -42,9 +44,16 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.SpinnerNumberModel;
import mage.Constants.MultiplayerAttackOption;
import mage.Constants.RangeOfInfluence;
import mage.cards.decks.DeckCardLists;
import mage.client.remote.Session;
import mage.client.table.TablePlayerPanel;
import mage.client.util.Event;
import mage.client.util.Listener;
import mage.util.Logging;
import mage.view.GameTypeView;
import mage.view.TableView;
/**
@ -59,12 +68,11 @@ public class NewTableDialog extends MageDialog {
private UUID playerId;
private UUID roomId;
private Session session;
private List<TablePlayerPanel> players = new ArrayList<TablePlayerPanel>();
/** Creates new form NewTableDialog */
public NewTableDialog() {
initComponents();
this.player2Panel.setVisible(false);
}
/** This method is called from within the constructor to
@ -80,25 +88,34 @@ public class NewTableDialog extends MageDialog {
cbGameType = new javax.swing.JComboBox();
lbDeckType = new javax.swing.JLabel();
cbDeckType = new javax.swing.JComboBox();
lbPlayer2Type = new javax.swing.JLabel();
cbPlayer2Type = new javax.swing.JComboBox();
btnOK = new javax.swing.JButton();
btnCancel = new javax.swing.JButton();
player2Panel = new mage.client.NewPlayerPanel();
player1Panel = new mage.client.NewPlayerPanel();
player1Panel = new mage.client.table.NewPlayerPanel();
spnNumPlayers = new javax.swing.JSpinner();
lblNumPlayers = new javax.swing.JLabel();
cbRange = new javax.swing.JComboBox();
lblRange = new javax.swing.JLabel();
lblAttack = new javax.swing.JLabel();
cbAttackOption = new javax.swing.JComboBox();
pnlOtherPlayers = new javax.swing.JPanel();
jSeparator1 = new javax.swing.JSeparator();
jSeparator2 = new javax.swing.JSeparator();
jLabel1 = new javax.swing.JLabel();
jSeparator3 = new javax.swing.JSeparator();
jLabel2 = new javax.swing.JLabel();
lblGameType.setText("Game Type:");
setTitle("New Table");
lbDeckType.setText("Deck Type:");
lblGameType.setText("Game Type");
lbPlayer2Type.setText("Player 2 Type:");
cbPlayer2Type.addActionListener(new java.awt.event.ActionListener() {
cbGameType.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbPlayer2TypeActionPerformed(evt);
cbGameTypeActionPerformed(evt);
}
});
lbDeckType.setText("Deck Type");
btnOK.setText("OK");
btnOK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -113,63 +130,136 @@ public class NewTableDialog extends MageDialog {
}
});
spnNumPlayers.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
numPlayersChanged(evt);
}
});
lblNumPlayers.setLabelFor(spnNumPlayers);
lblNumPlayers.setText("Players");
lblRange.setLabelFor(cbRange);
lblRange.setText("Range of Influence");
lblAttack.setLabelFor(cbAttackOption);
lblAttack.setText("Attack Option");
pnlOtherPlayers.setLayout(new java.awt.GridLayout(0, 1));
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11));
jLabel1.setText("Player 1 (You)");
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11));
jLabel2.setText("Other Players");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(25, 25, 25)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lblGameType)
.addComponent(lbDeckType))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(cbDeckType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 241, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(lbPlayer2Type)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cbPlayer2Type, javax.swing.GroupLayout.PREFERRED_SIZE, 241, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 468, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(player2Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 468, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(360, Short.MAX_VALUE)
.addComponent(btnOK)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCancel)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(358, Short.MAX_VALUE)
.addComponent(btnOK)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCancel)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(lbDeckType)
.addContainerGap(426, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(cbGameType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblNumPlayers)
.addComponent(spnNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblRange)
.addComponent(cbRange, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblAttack)
.addComponent(cbAttackOption, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(lblGameType)
.addComponent(cbDeckType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addContainerGap(396, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel2)
.addContainerGap(399, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE)
.addContainerGap())
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, 486, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE)
.addContainerGap()))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblGameType))
.addComponent(lbDeckType)
.addGap(0, 0, 0)
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lbDeckType))
.addComponent(lblGameType)
.addGap(0, 0, 0)
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(lblAttack)
.addGap(0, 0, 0)
.addComponent(cbAttackOption, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(lblNumPlayers)
.addGap(0, 0, 0)
.addComponent(spnNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(lblRange)
.addGap(0, 0, 0)
.addComponent(cbRange, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1)
.addGap(0, 0, 0)
.addComponent(player1Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(8, 8, 8)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lbPlayer2Type)
.addComponent(cbPlayer2Type, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 4, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(player2Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnCancel)
.addComponent(btnOK))
.addContainerGap())
.addGap(0, 0, 0))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(223, 223, 223)
.addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(149, Short.MAX_VALUE)))
);
pack();
@ -181,45 +271,100 @@ public class NewTableDialog extends MageDialog {
this.setVisible(false);
}//GEN-LAST:event_btnCancelActionPerformed
private void cbPlayer2TypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbPlayer2TypeActionPerformed
if (!this.cbPlayer2Type.getSelectedItem().equals("Human")) {
this.player2Panel.setVisible(true);
private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
GameTypeView gameType = (GameTypeView) cbGameType.getSelectedItem();
List<String> playerTypes = new ArrayList<String>();
playerTypes.add("Human");
for (TablePlayerPanel player: players) {
playerTypes.add(player.getPlayerType());
}
else {
this.player2Panel.setVisible(false);
table = session.createTable(
roomId,
gameType.getName(),
(String)this.cbDeckType.getSelectedItem(),
playerTypes,
(MultiplayerAttackOption)this.cbAttackOption.getSelectedItem(),
(RangeOfInfluence)this.cbRange.getSelectedItem());
try {
if (session.joinTable(roomId, table.getTableId(), 0, this.player1Panel.getPlayerName(), DeckCardLists.load(this.player1Panel.getDeckFile()))) {
int seatNum = 1;
for (TablePlayerPanel player: players) {
if (!player.getPlayerType().equals("Human")) {
if (!player.joinTable(roomId, table.getTableId(), seatNum)) {
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error joining table.", "Error", JOptionPane.ERROR_MESSAGE);
session.removeTable(roomId, table.getTableId());
table = null;
return;
}
}
seatNum++;
}
this.setVisible(false);
return;
}
} catch (FileNotFoundException ex) {
handleError(ex);
} catch (IOException ex) {
handleError(ex);
} catch (ClassNotFoundException ex) {
handleError(ex);
}
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error joining table.", "Error", JOptionPane.ERROR_MESSAGE);
session.removeTable(roomId, table.getTableId());
table = null;
}//GEN-LAST:event_btnOKActionPerformed
private void cbGameTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbGameTypeActionPerformed
setGameOptions();
}//GEN-LAST:event_cbGameTypeActionPerformed
private void numPlayersChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_numPlayersChanged
int numPlayers = (Integer)this.spnNumPlayers.getValue() - 1;
createPlayers(numPlayers);
}//GEN-LAST:event_numPlayersChanged
private void setGameOptions() {
GameTypeView gameType = (GameTypeView) cbGameType.getSelectedItem();
this.spnNumPlayers.setModel(new SpinnerNumberModel(gameType.getMinPlayers(), gameType.getMinPlayers(), gameType.getMaxPlayers(), 1));
this.spnNumPlayers.setEnabled(gameType.getMinPlayers() != gameType.getMaxPlayers());
this.cbAttackOption.setEnabled(gameType.isUseAttackOption());
this.cbRange.setEnabled(gameType.isUseRange());
createPlayers(gameType.getMinPlayers() - 1);
}
private void createPlayers(int numPlayers) {
if (numPlayers > players.size()) {
while (players.size() != numPlayers) {
TablePlayerPanel playerPanel = new TablePlayerPanel();
playerPanel.init(players.size() + 2);
players.add(playerPanel);
playerPanel.addPlayerTypeEventListener(
new Listener<Event> () {
@Override
public void event(Event event) {
drawPlayers();
}
}
);
}
}
else if (numPlayers < players.size()) {
while (players.size() != numPlayers) {
players.remove(players.size() - 1);
}
}
drawPlayers();
}
private void drawPlayers() {
this.pnlOtherPlayers.removeAll();
for (TablePlayerPanel panel: players) {
this.pnlOtherPlayers.add(panel);
}
this.pack();
this.revalidate();
this.repaint();
}//GEN-LAST:event_cbPlayer2TypeActionPerformed
private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
try {
List<String> playerTypes = new ArrayList<String>();
playerTypes.add("Human");
playerTypes.add((String) this.cbPlayer2Type.getSelectedItem());
table = session.createTable(roomId, (String)this.cbGameType.getSelectedItem(), (String)this.cbDeckType.getSelectedItem(), playerTypes);
if (session.joinTable(roomId, table.getTableId(), 0, this.player1Panel.getPlayerName(), DeckCardLists.load(this.player1Panel.getDeckFile()))) {
if (!this.cbPlayer2Type.getSelectedItem().equals("Human")) {
if (session.joinTable(roomId, table.getTableId(), 1, this.player2Panel.getPlayerName(), DeckCardLists.load(this.player2Panel.getDeckFile()))) {
this.setVisible(false);
return;
}
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error joining table.", "Error", JOptionPane.ERROR_MESSAGE);
}
else {
this.setVisible(false);
return;
}
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error joining table.", "Error", JOptionPane.ERROR_MESSAGE);
}
} catch (Exception ex) {
handleError(ex);
}
session.removeTable(roomId, table.getTableId());
table = null;
}//GEN-LAST:event_btnOKActionPerformed
}
private void handleError(Exception ex) {
logger.log(Level.SEVERE, "Error loading deck", ex);
@ -229,14 +374,14 @@ public class NewTableDialog extends MageDialog {
public void showDialog(UUID roomId) {
session = MageFrame.getSession();
this.player1Panel.setPlayerName(session.getUserName());
cbGameType.setModel(new DefaultComboBoxModel(session.getGameTypes()));
cbGameType.setModel(new DefaultComboBoxModel(session.getGameTypes().toArray()));
cbDeckType.setModel(new DefaultComboBoxModel(session.getDeckTypes()));
cbPlayer2Type.setModel(new DefaultComboBoxModel(session.getPlayerTypes()));
cbRange.setModel(new DefaultComboBoxModel(RangeOfInfluence.values()));
cbAttackOption.setModel(new DefaultComboBoxModel(MultiplayerAttackOption.values()));
this.roomId = roomId;
this.setModal(true);
this.pack();
this.revalidate();
this.repaint();
setGameOptions();
this.setLocation(150, 100);
this.setVisible(true);
}
@ -251,14 +396,23 @@ public class NewTableDialog extends MageDialog {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCancel;
private javax.swing.JButton btnOK;
private javax.swing.JComboBox cbAttackOption;
private javax.swing.JComboBox cbDeckType;
private javax.swing.JComboBox cbGameType;
private javax.swing.JComboBox cbPlayer2Type;
private javax.swing.JComboBox cbRange;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JSeparator jSeparator3;
private javax.swing.JLabel lbDeckType;
private javax.swing.JLabel lbPlayer2Type;
private javax.swing.JLabel lblAttack;
private javax.swing.JLabel lblGameType;
private mage.client.NewPlayerPanel player1Panel;
private mage.client.NewPlayerPanel player2Panel;
private javax.swing.JLabel lblNumPlayers;
private javax.swing.JLabel lblRange;
private mage.client.table.NewPlayerPanel player1Panel;
private javax.swing.JPanel pnlOtherPlayers;
private javax.swing.JSpinner spnNumPlayers;
// End of variables declaration//GEN-END:variables
}

View file

@ -43,6 +43,8 @@ import javax.swing.JLayeredPane;
import mage.client.MageFrame;
import mage.client.cards.BigCard;
import mage.client.cards.Card;
import mage.client.cards.CardDimensions;
import mage.client.util.Config;
import mage.view.CardView;
import mage.view.CardsView;
import static mage.client.util.Constants.*;
@ -59,13 +61,13 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
this.setModal(false);
}
public void loadCards(String name, CardsView showCards, BigCard bigCard, UUID gameId) {
public void loadCards(String name, CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId) {
this.title = name;
cardArea.removeAll();
if (showCards != null && showCards.size() < 10)
loadCardsFew(showCards, bigCard, gameId);
loadCardsFew(showCards, bigCard, dimension, gameId);
else
loadCardsMany(showCards, bigCard, gameId);
loadCardsMany(showCards, bigCard, dimension, gameId);
cardArea.revalidate();
if (getParent() != MageFrame.getDesktop() || this.isClosed)
MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
@ -75,34 +77,34 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
this.setVisible(true);
}
private void loadCardsFew(CardsView showCards, BigCard bigCard, UUID gameId) {
Rectangle rectangle = new Rectangle(FRAME_WIDTH, FRAME_HEIGHT);
private void loadCardsFew(CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId) {
Rectangle rectangle = new Rectangle(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
for (CardView card: showCards) {
Card cardImg = new Card(card, bigCard, gameId);
Card cardImg = new Card(card, bigCard, dimension, gameId);
cardImg.setBounds(rectangle);
cardArea.add(cardImg);
cardArea.moveToFront(cardImg);
cardImg.update(card);
cardImg.addMouseListener(this);
rectangle.translate(FRAME_WIDTH, 0);
rectangle.translate(Config.dimensions.frameWidth, 0);
}
cardArea.setPreferredSize(new Dimension(FRAME_WIDTH * showCards.size(), FRAME_HEIGHT));
cardArea.setPreferredSize(new Dimension(Config.dimensions.frameWidth * showCards.size(), Config.dimensions.frameHeight));
}
private void loadCardsMany(CardsView showCards, BigCard bigCard, UUID gameId) {
private void loadCardsMany(CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId) {
int columns = 1;
if (showCards != null && showCards.size() > 0) {
Rectangle rectangle = new Rectangle(FRAME_WIDTH, FRAME_HEIGHT);
Rectangle rectangle = new Rectangle(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
int count = 0;
for (CardView card: showCards) {
Card cardImg = new Card(card, bigCard, gameId);
Card cardImg = new Card(card, bigCard, dimension, gameId);
cardImg.setBounds(rectangle);
cardArea.add(cardImg);
cardArea.moveToFront(cardImg);
cardImg.update(card);
cardImg.addMouseListener(this);
if (count >= 20) {
rectangle.translate(FRAME_WIDTH, -400);
rectangle.translate(Config.dimensions.frameWidth, -400);
columns++;
count = 0;
} else {
@ -111,7 +113,7 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
}
}
}
cardArea.setPreferredSize(new Dimension(FRAME_WIDTH * columns, FRAME_HEIGHT + 400));
cardArea.setPreferredSize(new Dimension(Config.dimensions.frameWidth * columns, Config.dimensions.frameHeight + 400));
}
/** This method is called from within the constructor to

View file

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
<Form version="1.6" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
<Properties>
<Property name="title" type="java.lang.String" value="Waiting for players"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
@ -36,7 +39,7 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jSplitPane1" pref="231" max="32767" attributes="0"/>
<Component id="jSplitPane1" pref="247" max="32767" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="btnMoveDown" alignment="3" min="-2" max="-2" attributes="0"/>
@ -53,12 +56,20 @@
<Component class="javax.swing.JButton" name="btnMoveUp">
<Properties>
<Property name="text" type="java.lang.String" value="Move Up"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnMoveUpActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btnMoveDown">
<Properties>
<Property name="text" type="java.lang.String" value="Move Down"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnMoveDownActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btnCancel">
<Properties>
@ -71,6 +82,7 @@
<Component class="javax.swing.JButton" name="btnStart">
<Properties>
<Property name="text" type="java.lang.String" value="Start"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnStartActionPerformed"/>
@ -102,6 +114,9 @@
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="tableWaitModel" type="code"/>
</Property>
<Property name="selectionModel" type="javax.swing.ListSelectionModel" editor="org.netbeans.modules.form.editors2.JTableSelectionModelEditor">
<JTableSelectionModel selectionMode="0"/>
</Property>
</Properties>
</Component>
</SubComponents>

View file

@ -74,16 +74,23 @@ public class TableWaitingDialog extends MageDialog implements Observer {
tableSeats.createDefaultColumnsFromModel();
}
@Override
public void update(Observable arg0, Object arg1) {
TableView table = session.getTable(roomId, tableId);
if (table != null) {
if (table.getTableState() == TableState.STARTING) {
this.btnStart.setEnabled(true);
this.btnMoveDown.setEnabled(true);
this.btnMoveUp.setEnabled(true);
} else {
this.btnStart.setEnabled(false);
this.btnMoveDown.setEnabled(false);
this.btnMoveUp.setEnabled(false);
}
int row = this.tableSeats.getSelectedRow();
tableWaitModel.loadData(table);
this.tableSeats.repaint();
this.tableSeats.getSelectionModel().setSelectionInterval(row, row);
}
else {
closeDialog();
@ -108,6 +115,7 @@ public class TableWaitingDialog extends MageDialog implements Observer {
this.chatPanel.connect(chatId);
seatsWatchdog.addObserver(this);
this.setModal(true);
this.setLocation(100, 100);
this.setVisible(true);
}
else {
@ -141,9 +149,23 @@ public class TableWaitingDialog extends MageDialog implements Observer {
tableSeats = new javax.swing.JTable();
chatPanel = new mage.client.chat.ChatPanel();
setTitle("Waiting for players");
btnMoveUp.setText("Move Up");
btnMoveUp.setEnabled(false);
btnMoveUp.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnMoveUpActionPerformed(evt);
}
});
btnMoveDown.setText("Move Down");
btnMoveDown.setEnabled(false);
btnMoveDown.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnMoveDownActionPerformed(evt);
}
});
btnCancel.setText("Cancel");
btnCancel.addActionListener(new java.awt.event.ActionListener() {
@ -153,6 +175,7 @@ public class TableWaitingDialog extends MageDialog implements Observer {
});
btnStart.setText("Start");
btnStart.setEnabled(false);
btnStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnStartActionPerformed(evt);
@ -164,6 +187,7 @@ public class TableWaitingDialog extends MageDialog implements Observer {
jSplitPane1.setResizeWeight(1.0);
tableSeats.setModel(tableWaitModel);
tableSeats.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
jScrollPane1.setViewportView(tableSeats);
jSplitPane1.setLeftComponent(jScrollPane1);
@ -188,7 +212,7 @@ public class TableWaitingDialog extends MageDialog implements Observer {
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 243, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnMoveDown)
@ -215,6 +239,23 @@ public class TableWaitingDialog extends MageDialog implements Observer {
closeDialog();
}//GEN-LAST:event_btnCancelActionPerformed
private void btnMoveDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMoveDownActionPerformed
int row = this.tableSeats.getSelectedRow();
if (row < this.tableSeats.getRowCount() - 1) {
session.swapSeats(roomId, tableId, row, row + 1);
this.tableSeats.getSelectionModel().setSelectionInterval(row + 1, row + 1);
}
}//GEN-LAST:event_btnMoveDownActionPerformed
private void btnMoveUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMoveUpActionPerformed
int row = this.tableSeats.getSelectedRow();
if (row > 0) {
session.swapSeats(roomId, tableId, row, row - 1);
this.tableSeats.getSelectionModel().setSelectionInterval(row - 1, row - 1);
}
}//GEN-LAST:event_btnMoveUpActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCancel;
@ -233,7 +274,6 @@ class TableWaitModel extends AbstractTableModel {
private String[] columnNames = new String[]{"Seat Num", "Player Id", "Name", "Player Type"};
private SeatView[] seats = new SeatView[0];
public void loadData(TableView table) {
seats = table.getSeats().toArray(new SeatView[0]);
this.fireTableDataChanged();
@ -303,6 +343,7 @@ class SeatsWatchdog extends Observable implements ActionListener {
t.start();
}
@Override
public void actionPerformed(ActionEvent arg0) {
setChanged();
notifyObservers();

View file

@ -11,7 +11,7 @@
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-68,0,0,1,-115"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-68,0,0,0,-105"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout"/>

View file

@ -46,6 +46,7 @@ import java.util.Map.Entry;
import java.util.UUID;
import mage.client.cards.BigCard;
import mage.client.cards.Permanent;
import mage.client.util.Config;
import mage.view.PermanentView;
import static mage.client.util.Constants.*;
@ -93,9 +94,9 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane implements Compon
}
private void addPermanent(PermanentView permanent) {
Permanent perm = new Permanent(permanent, bigCard, gameId);
Permanent perm = new Permanent(permanent, bigCard, Config.dimensions, gameId);
perm.addComponentListener(this);
perm.setBounds(findEmptySpace(new Dimension(FRAME_WIDTH, FRAME_HEIGHT)));
perm.setBounds(findEmptySpace(new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight)));
permanents.put(permanent.getId(), perm);
this.add(perm);
moveToFront(perm);
@ -162,8 +163,6 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane implements Compon
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setLayout(null);
}// </editor-fold>//GEN-END:initComponents
@Override

View file

@ -37,6 +37,7 @@ package mage.client.game;
import java.awt.Dimension;
import java.util.UUID;
import mage.client.cards.BigCard;
import mage.client.util.Config;
import mage.view.CombatGroupView;
import static mage.client.util.Constants.*;
@ -63,9 +64,9 @@ public class CombatGroup extends javax.swing.JPanel {
public void update(CombatGroupView combatGroup) {
this.lblDefender.setText(combatGroup.getDefenderName());
this.attackers.loadCards(combatGroup.getAttackers(), bigCard, gameId);
attackers.setPreferredSize(new Dimension(FRAME_WIDTH + 6, FRAME_HEIGHT + 6));
attackers.setPreferredSize(new Dimension(Config.dimensions.frameWidth + 6, Config.dimensions.frameHeight + 6));
this.blockers.loadCards(combatGroup.getBlockers(), bigCard, gameId);
blockers.setPreferredSize(new Dimension(FRAME_WIDTH + 6, FRAME_HEIGHT + 6));
blockers.setPreferredSize(new Dimension(Config.dimensions.frameWidth + 6, Config.dimensions.frameHeight + 6));
this.attackers.setVisible(true);
this.blockers.setVisible(true);
}

View file

@ -394,6 +394,9 @@
<EtchetBorder/>
</Border>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new java.awt.Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight + 25)" type="code"/>
</Property>
</Properties>
<Layout>
@ -410,15 +413,17 @@
</Layout>
<SubComponents>
<Component class="mage.client.cards.Cards" name="hand">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new java.awt.Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight)" type="code"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="pnlBattlefield">
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
<Property name="columns" type="int" value="1"/>
<Property name="rows" type="int" value="0"/>
</Layout>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
</Container>
</SubComponents>
</Container>

View file

@ -34,6 +34,7 @@
package mage.client.game;
import java.awt.GridBagConstraints;
import java.util.logging.Level;
import mage.client.*;
import java.util.HashMap;
@ -51,6 +52,7 @@ import mage.client.dialog.PickNumberDialog;
import mage.client.dialog.ShowCardsDialog;
import mage.client.game.FeedbackPanel.FeedbackMode;
import mage.client.remote.Session;
import mage.client.util.Config;
import mage.util.Logging;
import mage.view.AbilityPickerView;
import mage.view.CardsView;
@ -144,19 +146,60 @@ public class GamePanel extends javax.swing.JPanel {
combat.setLocation(500, 300);
this.players.clear();
this.pnlBattlefield.removeAll();
PlayAreaPanel sessionPlayer = null;
//arrange players in a circle with the session player at the bottom left
int numSeats = game.getPlayers().size();
int numColumns = (numSeats + 1) / 2;
boolean oddNumber = (numColumns > 1 && numSeats % 2 == 1);
int col = 0;
int row = 1;
int playerSeat = 0;
for (PlayerView player: game.getPlayers()) {
if (playerId.equals(player.getPlayerId()))
break;
playerSeat++;
}
PlayerView player = game.getPlayers().get(playerSeat);
PlayAreaPanel sessionPlayer = new PlayAreaPanel(player, bigCard, gameId);
players.put(player.getPlayerId(), sessionPlayer);
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.weightx = 0.5;
c.weighty = 0.5;
if (oddNumber)
c.gridwidth = 2;
c.gridx = col;
c.gridy = row;
this.pnlBattlefield.add(sessionPlayer, c);
sessionPlayer.setVisible(true);
if (oddNumber)
col++;
int playerNum = playerSeat + 1;
while (true) {
if (row == 1)
col++;
else
col--;
if (col >= numColumns) {
row = 0;
col = numColumns - 1;
}
player = game.getPlayers().get(playerNum);
PlayAreaPanel playerPanel = new PlayAreaPanel(player, bigCard, gameId);
players.put(player.getPlayerId(), playerPanel);
if (playerId.equals(player.getPlayerId()))
sessionPlayer = playerPanel;
else
this.pnlBattlefield.add(playerPanel);
c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.weightx = 0.5;
c.weighty = 0.5;
c.gridx = col;
c.gridy = row;
this.pnlBattlefield.add(playerPanel, c);
playerPanel.setVisible(true);
playerNum++;
if (playerNum >= numSeats)
playerNum = 0;
if (playerNum == playerSeat)
break;
}
// add PlayAreaPanel that belongs to the client last so that is will appear at the bottom
if (sessionPlayer != null)
this.pnlBattlefield.add(sessionPlayer);
updateGame(game);
}
@ -167,8 +210,12 @@ public class GamePanel extends javax.swing.JPanel {
this.hand.loadCards(game.getHand(), bigCard, gameId);
if (game.getPhase() != null)
this.txtPhase.setText(game.getPhase().toString());
else
this.txtPhase.setText("");
if (game.getStep() != null)
this.txtStep.setText(game.getStep().toString());
else
this.txtStep.setText("");
this.txtActivePlayer.setText(game.getActivePlayerName());
this.txtPriority.setText(game.getPriorityPlayerName());
this.txtTurn.setText(Integer.toString(game.getTurn()));
@ -251,12 +298,12 @@ public class GamePanel extends javax.swing.JPanel {
public void revealCards(String name, CardsView cards) {
ShowCardsDialog showCards = new ShowCardsDialog();
MageFrame.getDesktop().add(showCards);
showCards.loadCards(name, cards, bigCard, gameId);
showCards.loadCards(name, cards, bigCard, Config.dimensions, gameId);
}
private void showCards(String title, CardsView cards) {
ShowCardsDialog showCards = new ShowCardsDialog();
showCards.loadCards(title, cards, bigCard, gameId);
showCards.loadCards(title, cards, bigCard, Config.dimensions, gameId);
}
public void getAmount(int min, int max) {
@ -493,19 +540,22 @@ public class GamePanel extends javax.swing.JPanel {
);
pnlHand.setBorder(javax.swing.BorderFactory.createEtchedBorder());
pnlHand.setPreferredSize(new java.awt.Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight + 25));
hand.setPreferredSize(new java.awt.Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight));
javax.swing.GroupLayout pnlHandLayout = new javax.swing.GroupLayout(pnlHand);
pnlHand.setLayout(pnlHandLayout);
pnlHandLayout.setHorizontalGroup(
pnlHandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(hand, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 661, Short.MAX_VALUE)
.addComponent(hand, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 711, Short.MAX_VALUE)
);
pnlHandLayout.setVerticalGroup(
pnlHandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(hand, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 209, Short.MAX_VALUE)
);
pnlBattlefield.setLayout(new java.awt.GridLayout(0, 1));
pnlBattlefield.setLayout(new java.awt.GridBagLayout());
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
@ -516,7 +566,7 @@ public class GamePanel extends javax.swing.JPanel {
.addGap(0, 0, 0)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(pnlHand, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(pnlBattlefield, javax.swing.GroupLayout.DEFAULT_SIZE, 665, Short.MAX_VALUE)))
.addComponent(pnlBattlefield, javax.swing.GroupLayout.DEFAULT_SIZE, 715, Short.MAX_VALUE)))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

View file

@ -19,14 +19,14 @@
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="524" max="32767" attributes="0"/>
<Component id="jScrollPane1" pref="357" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="0" pref="302" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="1" pref="252" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
@ -53,7 +53,7 @@
<Component id="playerPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="manaPool" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="64" max="32767" attributes="0"/>
<EmptySpace pref="14" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -71,18 +71,7 @@
<SubComponents>
<Container class="mage.client.game.BattlefieldPanel" name="battlefieldPanel">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="522" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout"/>
</Container>
</SubComponents>
</Container>

View file

@ -98,18 +98,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
.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)
.addContainerGap(64, Short.MAX_VALUE))
);
javax.swing.GroupLayout battlefieldPanelLayout = new javax.swing.GroupLayout(battlefieldPanel);
battlefieldPanel.setLayout(battlefieldPanelLayout);
battlefieldPanelLayout.setHorizontalGroup(
battlefieldPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 522, Short.MAX_VALUE)
);
battlefieldPanelLayout.setVerticalGroup(
battlefieldPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
.addContainerGap(14, Short.MAX_VALUE))
);
jScrollPane1.setViewportView(battlefieldPanel);
@ -121,12 +110,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, 524, Short.MAX_VALUE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 302, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents

View file

@ -34,11 +34,13 @@
package mage.client.game;
import java.awt.Color;
import java.util.UUID;
import mage.client.MageFrame;
import mage.client.cards.BigCard;
import mage.client.dialog.ShowCardsDialog;
import mage.client.remote.Session;
import mage.client.util.Config;
import mage.view.PlayerView;
/**
@ -74,6 +76,15 @@ public class PlayerPanel extends javax.swing.JPanel {
this.txtLibrary.setText(Integer.toString(player.getLibraryCount()));
this.btnGrave.setText(Integer.toString(player.getGraveyard().size()));
this.btnPlayerName.setText(player.getName());
if (player.isActive()) {
this.btnPlayerName.setBackground(Color.DARK_GRAY);
}
else if (player.hasLeft()) {
this.btnPlayerName.setBackground(Color.RED);
}
else {
this.btnPlayerName.setBackground(Color.LIGHT_GRAY);
}
}
/** This method is called from within the constructor to
@ -189,7 +200,7 @@ public class PlayerPanel extends javax.swing.JPanel {
if (graveyard == null) {
graveyard = new ShowCardsDialog();
}
graveyard.loadCards(player.getName() + " graveyard", player.getGraveyard(), bigCard, gameId);
graveyard.loadCards(player.getName() + " graveyard", player.getGraveyard(), bigCard, Config.dimensions, gameId);
}//GEN-LAST:event_btnGraveActionPerformed

View file

@ -40,6 +40,8 @@ import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import mage.Constants.MultiplayerAttackOption;
import mage.Constants.RangeOfInfluence;
import mage.cards.decks.DeckCardLists;
import mage.client.MageFrame;
import mage.client.chat.ChatPanel;
@ -50,6 +52,7 @@ import mage.interfaces.MageException;
import mage.interfaces.Server;
import mage.interfaces.callback.CallbackClientDaemon;
import mage.util.Logging;
import mage.view.GameTypeView;
import mage.view.TableView;
/**
@ -66,7 +69,7 @@ public class Session {
private String userName;
private MageFrame frame;
private String[] playerTypes;
private String[] gameTypes;
private List<GameTypeView> gameTypes;
private String[] deckTypes;
private Map<UUID, ChatPanel> chats = new HashMap<UUID, ChatPanel>();
private GamePanel game;
@ -127,7 +130,7 @@ public class Session {
return playerTypes;
}
public String[] getGameTypes() {
public List<GameTypeView> getGameTypes() {
return gameTypes;
}
@ -373,9 +376,9 @@ public class Session {
return false;
}
public TableView createTable(UUID roomId, String gameType, String deckType, List<String> playerTypes) {
public TableView createTable(UUID roomId, String gameType, String deckType, List<String> playerTypes, MultiplayerAttackOption attackOption, RangeOfInfluence range) {
try {
return server.createTable(sessionId, roomId, gameType, deckType, playerTypes);
return server.createTable(sessionId, roomId, gameType, deckType, playerTypes, attackOption, range);
} catch (RemoteException ex) {
handleRemoteException(ex);
} catch (MageException ex) {
@ -407,6 +410,18 @@ public class Session {
return false;
}
public boolean swapSeats(UUID roomId, UUID tableId, int seatNum1, int seatNum2) {
try {
server.swapSeats(sessionId, roomId, tableId, seatNum1, seatNum2);
return true;
} catch (RemoteException ex) {
handleRemoteException(ex);
} catch (MageException ex) {
handleMageException(ex);
}
return false;
}
public boolean leaveTable(UUID roomId, UUID tableId) {
try {
server.leaveTable(sessionId, roomId, tableId);

View file

@ -18,56 +18,56 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Component id="lblPlayerDeck" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="lblPlayer2Name" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="lblPlayerName" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="txtPlayerName" alignment="0" pref="314" max="32767" attributes="1"/>
<Component id="txtPlayerDeck" alignment="0" pref="314" max="32767" attributes="1"/>
<Component id="txtPlayerName" alignment="0" pref="405" max="32767" attributes="1"/>
<Component id="txtPlayerDeck" alignment="0" pref="405" max="32767" attributes="1"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="btnPlayerDeck" min="-2" pref="24" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="txtPlayerName" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblPlayer2Name" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblPlayerName" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblPlayerDeck" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtPlayerDeck" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnPlayerDeck" alignment="3" min="-2" pref="19" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="lblPlayer2Name">
<Component class="javax.swing.JLabel" name="lblPlayerName">
<Properties>
<Property name="text" type="java.lang.String" value="Player Name:"/>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="txtPlayerName"/>
</Property>
<Property name="text" type="java.lang.String" value="Name:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="txtPlayerName">
</Component>
<Component class="javax.swing.JLabel" name="lblPlayerDeck">
<Properties>
<Property name="text" type="java.lang.String" value="Player Deck:"/>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="txtPlayerDeck"/>
</Property>
<Property name="text" type="java.lang.String" value="Deck:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="txtPlayerDeck">

View file

@ -32,12 +32,10 @@
* Created on 15-Dec-2009, 10:09:46 PM
*/
package mage.client;
package mage.client.table;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.prefs.Preferences;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
@ -89,14 +87,6 @@ public class NewPlayerPanel extends javax.swing.JPanel {
return this.txtPlayerDeck.getText();
}
// public void setPlayerName(String playerName) {
// this.txtPlayerName.setText(playerName);
// }
//
// public void setDeckFile(String deckFile) {
// this.txtPlayerDeck.setText(deckFile);
// }
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
@ -106,15 +96,17 @@ public class NewPlayerPanel extends javax.swing.JPanel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
lblPlayer2Name = new javax.swing.JLabel();
lblPlayerName = new javax.swing.JLabel();
txtPlayerName = new javax.swing.JTextField();
lblPlayerDeck = new javax.swing.JLabel();
txtPlayerDeck = new javax.swing.JTextField();
btnPlayerDeck = new javax.swing.JButton();
lblPlayer2Name.setText("Player Name:");
lblPlayerName.setLabelFor(txtPlayerName);
lblPlayerName.setText("Name:");
lblPlayerDeck.setText("Player Deck:");
lblPlayerDeck.setLabelFor(txtPlayerDeck);
lblPlayerDeck.setText("Deck:");
btnPlayerDeck.setText("...");
btnPlayerDeck.addActionListener(new java.awt.event.ActionListener() {
@ -130,32 +122,27 @@ public class NewPlayerPanel extends javax.swing.JPanel {
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(14, 14, 14)
.addGap(4, 4, 4)
.addComponent(lblPlayerDeck))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(lblPlayer2Name)))
.addComponent(lblPlayerName))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtPlayerName, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE)
.addComponent(txtPlayerDeck, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE))
.addComponent(txtPlayerName, javax.swing.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE)
.addComponent(txtPlayerDeck, javax.swing.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addComponent(btnPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtPlayerName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblPlayer2Name))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lblPlayerName))
.addGap(3, 3, 3)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblPlayerDeck)
.addComponent(txtPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(btnPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)))
);
}// </editor-fold>//GEN-END:initComponents
@ -166,8 +153,8 @@ public class NewPlayerPanel extends javax.swing.JPanel {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnPlayerDeck;
private javax.swing.JLabel lblPlayer2Name;
private javax.swing.JLabel lblPlayerDeck;
private javax.swing.JLabel lblPlayerName;
private javax.swing.JTextField txtPlayerDeck;
private javax.swing.JTextField txtPlayerName;
// End of variables declaration//GEN-END:variables

View file

@ -0,0 +1,61 @@
/*
* 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.
*/
package mage.client.table;
import java.io.Serializable;
import java.util.UUID;
import mage.client.util.Event;
import mage.client.util.EventDispatcher;
import mage.client.util.EventSource;
import mage.client.util.Listener;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class PlayerTypeEventSource implements EventSource<Event>, Serializable {
protected final EventDispatcher<Event> dispatcher = new EventDispatcher<Event>() {};
@Override
public void addListener(Listener<Event> listener) {
dispatcher.addListener(listener);
}
public void playerTypeChanged() {
dispatcher.fireEvent(new Event(null, "playerTypeChanged"));
}
@Override
public void clearListeners() {
dispatcher.clearListeners();
}
}

View file

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lblPlayerNum" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="lbPlayerType" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cbPlayerType" min="-2" pref="166" max="-2" attributes="1"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="newPlayerPanel" pref="318" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="lblPlayerNum" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="cbPlayerType" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lbPlayerType" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="newPlayerPanel" alignment="0" pref="43" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="lbPlayerType">
<Properties>
<Property name="text" type="java.lang.String" value="Type:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="cbPlayerType">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbPlayerTypeActionPerformed"/>
</Events>
</Component>
<Component class="mage.client.table.NewPlayerPanel" name="newPlayerPanel">
</Component>
<Component class="javax.swing.JLabel" name="lblPlayerNum">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="11" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Player #"/>
</Properties>
</Component>
</SubComponents>
</Form>

View file

@ -0,0 +1,170 @@
/*
* 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.
*/
/*
* TablePlayerPanel.java
*
* Created on 9-May-2010, 11:43:03 AM
*/
package mage.client.table;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import mage.cards.decks.DeckCardLists;
import mage.client.MageFrame;
import mage.client.remote.Session;
import mage.client.util.Event;
import mage.client.util.Listener;
import mage.util.Logging;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class TablePlayerPanel extends javax.swing.JPanel {
private final static Logger logger = Logging.getLogger(TablePlayerPanel.class.getName());
protected PlayerTypeEventSource playerTypeEventSource = new PlayerTypeEventSource();
private Session session;
/** Creates new form TablePlayerPanel */
public TablePlayerPanel() {
initComponents();
this.newPlayerPanel.setVisible(false);
}
public void init(int playerNum) {
session = MageFrame.getSession();
cbPlayerType.setModel(new DefaultComboBoxModel(session.getPlayerTypes()));
this.lblPlayerNum.setText("Player " + playerNum);
}
public boolean joinTable(UUID roomId, UUID tableId, int seatNum) throws FileNotFoundException, IOException, ClassNotFoundException {
if (!this.cbPlayerType.getSelectedItem().equals("Human")) {
return session.joinTable(roomId, tableId, seatNum, this.newPlayerPanel.getPlayerName(), DeckCardLists.load(this.newPlayerPanel.getDeckFile()));
}
return true;
}
public String getPlayerType() {
return (String) this.cbPlayerType.getSelectedItem();
}
public void addPlayerTypeEventListener(Listener<Event> listener) {
playerTypeEventSource.addListener(listener);
}
public void clearPlayerTypeEventListeners() {
playerTypeEventSource.clearListeners();
}
/** 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() {
lbPlayerType = new javax.swing.JLabel();
cbPlayerType = new javax.swing.JComboBox();
newPlayerPanel = new mage.client.table.NewPlayerPanel();
lblPlayerNum = new javax.swing.JLabel();
lbPlayerType.setText("Type:");
cbPlayerType.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbPlayerTypeActionPerformed(evt);
}
});
lblPlayerNum.setFont(new java.awt.Font("Tahoma", 1, 11));
lblPlayerNum.setText("Player #");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblPlayerNum)
.addGroup(layout.createSequentialGroup()
.addComponent(lbPlayerType)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbPlayerType, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(newPlayerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(lblPlayerNum)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cbPlayerType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lbPlayerType)))
.addComponent(newPlayerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 43, Short.MAX_VALUE))
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void cbPlayerTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbPlayerTypeActionPerformed
if (!this.cbPlayerType.getSelectedItem().equals("Human")) {
this.newPlayerPanel.setVisible(true);
}
else {
this.newPlayerPanel.setVisible(false);
}
this.revalidate();
this.repaint();
this.playerTypeEventSource.playerTypeChanged();
}//GEN-LAST:event_cbPlayerTypeActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JComboBox cbPlayerType;
private javax.swing.JLabel lbPlayerType;
private javax.swing.JLabel lblPlayerNum;
private mage.client.table.NewPlayerPanel newPlayerPanel;
// End of variables declaration//GEN-END:variables
}

View file

@ -29,7 +29,7 @@
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="mage.client.TablesPanel" name="tablesPanel">
<Component class="mage.client.table.TablesPanel" name="tablesPanel">
</Component>
</SubComponents>
</Form>
</Form>

View file

@ -32,9 +32,11 @@
* Created on Dec 17, 2009, 9:21:42 AM
*/
package mage.client;
package mage.client.table;
import java.util.UUID;
import mage.client.MageFrame;
import mage.client.MagePane;
/**
*
@ -69,7 +71,7 @@ public class TablesPane extends MagePane {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
tablesPanel = new mage.client.TablesPanel();
tablesPanel = new mage.client.table.TablesPanel();
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
@ -87,7 +89,7 @@ public class TablesPane extends MagePane {
// Variables declaration - do not modify//GEN-BEGIN:variables
private mage.client.TablesPanel tablesPanel;
private mage.client.table.TablesPanel tablesPanel;
// End of variables declaration//GEN-END:variables
}

View file

@ -32,7 +32,7 @@
* Created on 15-Dec-2009, 10:54:01 PM
*/
package mage.client;
package mage.client.table;
import mage.client.dialog.NewTableDialog;
import mage.client.dialog.JoinTableDialog;
@ -51,8 +51,8 @@ import javax.swing.Action;
import javax.swing.JOptionPane;
import javax.swing.Timer;
import javax.swing.table.AbstractTableModel;
import mage.Constants;
import mage.cards.decks.DeckCardLists;
import mage.client.MageFrame;
import mage.client.remote.MageRemoteException;
import mage.client.remote.Session;
import mage.client.util.ButtonColumn;
@ -260,7 +260,8 @@ public class TablesPanel extends javax.swing.JPanel implements Observer {
roomId,
"Two Player Duel",
"Constructed",
playerTypes
playerTypes,
null, null
);
session.joinTable(
roomId,

View file

@ -34,6 +34,7 @@ import java.io.IOException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import mage.client.cards.CardDimensions;
import mage.util.Logging;
/**
@ -53,7 +54,9 @@ public class Config {
public static final String cardArtResourcePath;
public static final String symbolsResourcePath;
public static final String resourcePath;
public static final double cardScalingFactor;
public static final boolean useResource;
public static final CardDimensions dimensions;
static {
Properties p = new Properties();
@ -67,6 +70,8 @@ public class Config {
remoteServer = p.getProperty("remote-server");
cardsResourcePath = p.getProperty("cards-resource-path");
resourcePath = p.getProperty("resource-path");
cardScalingFactor = Double.valueOf(p.getProperty("card-scaling-factor"));
dimensions = new CardDimensions(cardScalingFactor);
File test = new File(cardsResourcePath);
if (test.isDirectory()) {
useResource = false;

View file

@ -41,48 +41,50 @@ public final class Constants {
public static final int FRAME_MAX_WIDTH = 256;
public static final int ART_MAX_HEIGHT = 168;
public static final int ART_MAX_WIDTH = 227;
public static final int SYMBOL_MAX_HEIGHT = 28;
public static final int SYMBOL_MAX_WIDTH = 28;
public static final int SYMBOL_MAX_HEIGHT = 14;
public static final int SYMBOL_MAX_WIDTH = 14;
public static final int SYMBOL_MAX_XOFFSET = 27;
public static final int SYMBOL_MAX_YOFFSET = 15;
public static final int SYMBOL_MAX_SPACE = 28;
public static final int SYMBOL_MAX_SPACE = 14;
public static final int CONTENT_MAX_XOFFSET = 15;
public static final int ART_MAX_YOFFSET = 37;
public static final int NAME_MAX_YOFFSET = 27;
public static final int NAME_MAX_YOFFSET = 28;
public static final int TYPE_MAX_YOFFSET = 223;
public static final int TEXT_MAX_YOFFSET = 232;
public static final int TEXT_MAX_WIDTH = 227;
public static final int TEXT_MAX_HEIGHT = 105;
public static final int NAME_FONT_MAX_SIZE = 13;
public static final int TEXT_FONT_MAX_SIZE = 11;
public static final int PARAGRAPH_MAX_SPACING = 4;
// public static final int PARAGRAPH_MAX_SPACING = 4;
public static final int POWBOX_MAX_TOP = 336;
public static final int POWBOX_MAX_LEFT = 202;
public static final int POWBOX_TEXT_MAX_TOP = 352;
public static final int POWBOX_TEXT_MAX_LEFT = 212;
public static final int DAMAGE_MAX_LEFT = 180;
public static final double SCALE_FACTOR = 0.5;
public static final int FRAME_HEIGHT = (int)(FRAME_MAX_HEIGHT * SCALE_FACTOR);
public static final int FRAME_WIDTH = (int)(FRAME_MAX_WIDTH * SCALE_FACTOR);
public static final int ART_HEIGHT = (int)(ART_MAX_HEIGHT * SCALE_FACTOR);
public static final int ART_WIDTH = (int)(ART_MAX_WIDTH * SCALE_FACTOR);
public static final int SYMBOL_HEIGHT = (int)(SYMBOL_MAX_HEIGHT * SCALE_FACTOR);
public static final int SYMBOL_WIDTH = (int)(SYMBOL_MAX_WIDTH * SCALE_FACTOR);
public static final int SYMBOL_XOFFSET = (int)(SYMBOL_MAX_XOFFSET * SCALE_FACTOR);
public static final int SYMBOL_YOFFSET = (int)(SYMBOL_MAX_YOFFSET * SCALE_FACTOR);
public static final int SYMBOL_SPACE = (int)(SYMBOL_MAX_SPACE * SCALE_FACTOR);
public static final int CONTENT_XOFFSET = (int)(CONTENT_MAX_XOFFSET * SCALE_FACTOR);
public static final int ART_YOFFSET = (int)(ART_MAX_YOFFSET * SCALE_FACTOR);
public static final int NAME_YOFFSET = (int)(NAME_MAX_YOFFSET * SCALE_FACTOR);
public static final int TYPE_YOFFSET = (int)(TYPE_MAX_YOFFSET * SCALE_FACTOR);
public static final int TEXT_YOFFSET = (int)(TEXT_MAX_YOFFSET * SCALE_FACTOR);
public static final int TEXT_WIDTH = (int)(TEXT_MAX_WIDTH * SCALE_FACTOR);
public static final int TEXT_HEIGHT = (int)(TEXT_MAX_HEIGHT * SCALE_FACTOR);
public static final int POWBOX_TOP = (int)(POWBOX_MAX_TOP * SCALE_FACTOR);
public static final int POWBOX_LEFT = (int)(POWBOX_MAX_LEFT * SCALE_FACTOR);
public static final int DAMAGE_LEFT = (int)(DAMAGE_MAX_LEFT * SCALE_FACTOR);
public static final int NAME_FONT_SIZE = Math.max(9, (int)(NAME_FONT_MAX_SIZE * SCALE_FACTOR));
public static final int TEXT_FONT_SIZE = Math.max(9, (int)(TEXT_FONT_MAX_SIZE * SCALE_FACTOR));
public static final int PARAGRAPH_SPACING = (int)(PARAGRAPH_MAX_SPACING * SCALE_FACTOR);
// public static final int FRAME_HEIGHT = (int)(FRAME_MAX_HEIGHT * SCALE_FACTOR);
// public static final int FRAME_WIDTH = (int)(FRAME_MAX_WIDTH * SCALE_FACTOR);
//// public static final int ART_HEIGHT = (int)(ART_MAX_HEIGHT * SCALE_FACTOR);
//// public static final int ART_WIDTH = (int)(ART_MAX_WIDTH * SCALE_FACTOR);
// public static final int SYMBOL_HEIGHT = (int)(SYMBOL_MAX_HEIGHT * SCALE_FACTOR);
// public static final int SYMBOL_WIDTH = (int)(SYMBOL_MAX_WIDTH * SCALE_FACTOR);
//// public static final int SYMBOL_XOFFSET = (int)(SYMBOL_MAX_XOFFSET * SCALE_FACTOR);
//// public static final int SYMBOL_YOFFSET = (int)(SYMBOL_MAX_YOFFSET * SCALE_FACTOR);
//// public static final int SYMBOL_SPACE = (int)(SYMBOL_MAX_SPACE * SCALE_FACTOR);
// public static final int CONTENT_XOFFSET = (int)(CONTENT_MAX_XOFFSET * SCALE_FACTOR);
//// public static final int ART_YOFFSET = (int)(ART_MAX_YOFFSET * SCALE_FACTOR);
// public static final int NAME_YOFFSET = (int)(NAME_MAX_YOFFSET * SCALE_FACTOR);
// public static final int TYPE_YOFFSET = (int)(TYPE_MAX_YOFFSET * SCALE_FACTOR);
// public static final int TEXT_YOFFSET = (int)(TEXT_MAX_YOFFSET * SCALE_FACTOR);
// public static final int TEXT_WIDTH = (int)(TEXT_MAX_WIDTH * SCALE_FACTOR);
// public static final int TEXT_HEIGHT = (int)(TEXT_MAX_HEIGHT * SCALE_FACTOR);
// public static final int POWBOX_TEXT_TOP = (int)(POWBOX_TEXT_MAX_TOP * SCALE_FACTOR);
// public static final int POWBOX_TEXT_LEFT = (int)(POWBOX_TEXT_MAX_LEFT * SCALE_FACTOR);
//// public static final int DAMAGE_LEFT = (int)(DAMAGE_MAX_LEFT * SCALE_FACTOR);
// public static final int NAME_FONT_SIZE = Math.max(9, (int)(NAME_FONT_MAX_SIZE * SCALE_FACTOR));
//// public static final int TEXT_FONT_SIZE = Math.max(9, (int)(TEXT_FONT_MAX_SIZE * SCALE_FACTOR));
//// public static final int PARAGRAPH_SPACING = (int)(PARAGRAPH_MAX_SPACING * SCALE_FACTOR);
}

View file

@ -41,6 +41,7 @@ import java.util.HashMap;
import java.util.List;
import javax.imageio.ImageIO;
import mage.Constants.CardType;
import mage.client.cards.CardDimensions;
import mage.view.AbilityView;
import mage.view.CardView;
import mage.view.StackAbilityView;
@ -202,23 +203,23 @@ public class ImageHelper {
return image.getScaledInstance(width, height, Image.SCALE_SMOOTH);
}
public static MemoryImageSource rotate(Image image) {
int buffer[] = new int[FRAME_WIDTH * FRAME_HEIGHT];
int rotate[] = new int[FRAME_HEIGHT * FRAME_WIDTH];
PixelGrabber grabber = new PixelGrabber(image, 0, 0, FRAME_WIDTH, FRAME_HEIGHT, buffer, 0, FRAME_WIDTH);
public static MemoryImageSource rotate(Image image, CardDimensions dimensions) {
int buffer[] = new int[dimensions.frameWidth * dimensions.frameHeight];
int rotate[] = new int[dimensions.frameHeight * dimensions.frameWidth];
PixelGrabber grabber = new PixelGrabber(image, 0, 0, dimensions.frameWidth, dimensions.frameHeight, buffer, 0, dimensions.frameWidth);
try {
grabber.grabPixels();
}
catch(InterruptedException e) {
e.printStackTrace();
}
for(int y = 0; y < FRAME_HEIGHT; y++) {
for(int x = 0; x < FRAME_WIDTH; x++) {
rotate[((FRAME_WIDTH - x - 1) *FRAME_HEIGHT)+y] = buffer[(y*FRAME_WIDTH)+x];
for(int y = 0; y < dimensions.frameHeight; y++) {
for(int x = 0; x < dimensions.frameWidth; x++) {
rotate[((dimensions.frameWidth - x - 1) *dimensions.frameHeight)+y] = buffer[(y*dimensions.frameWidth)+x];
}
}
return new MemoryImageSource(FRAME_HEIGHT, FRAME_WIDTH, rotate, 0, FRAME_HEIGHT);
return new MemoryImageSource(dimensions.frameHeight, dimensions.frameWidth, rotate, 0, dimensions.frameHeight);
}
@ -230,11 +231,11 @@ public class ImageHelper {
Image image = Symbols.getSymbol(symbol);
if (image != null) {
g.drawImage(image, costLeft, yOffset, o);
costLeft -= SYMBOL_SPACE;
costLeft -= SYMBOL_MAX_SPACE;
}
else {
g.drawString(symbol, costLeft, yOffset + SYMBOL_SPACE);
costLeft -= SYMBOL_SPACE + 4;
g.drawString(symbol, costLeft, yOffset + SYMBOL_MAX_SPACE);
costLeft -= SYMBOL_MAX_SPACE + 4;
}
}
}

View file

@ -42,47 +42,47 @@ public class Symbols {
public static Map<String, Image> symbols = new HashMap<String, Image>();
static {
symbols.put("{B}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_black.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{U}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_blue.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{G}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_green.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{R}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_red.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{W}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_white.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{B}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_black.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{U}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_blue.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{G}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_green.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{R}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_red.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{W}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_white.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{0}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_0.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{1}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_1.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{2}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_2.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{3}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_3.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{4}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_4.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{5}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_5.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{6}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_6.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{7}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_7.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{8}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_8.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{9}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_9.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{10}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_10.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{11}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_11.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{12}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_12.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{13}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_13.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{14}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_14.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{15}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_15.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{16}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_16.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{X}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_x.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{0}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_0.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{1}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_1.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{2}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_2.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{3}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_3.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{4}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_4.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{5}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_5.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{6}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_6.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{7}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_7.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{8}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_8.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{9}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_9.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{10}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_10.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{11}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_11.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{12}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_12.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{13}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_13.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{14}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_14.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{15}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_15.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{16}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_16.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{X}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_x.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{B/G}", ImageHelper.loadImage(Config.symbolsResourcePath + "black_green.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{B/R}", ImageHelper.loadImage(Config.symbolsResourcePath + "black_red.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{U/B}", ImageHelper.loadImage(Config.symbolsResourcePath + "blue_black.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{U/R}", ImageHelper.loadImage(Config.symbolsResourcePath + "blue_red.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{G/B}", ImageHelper.loadImage(Config.symbolsResourcePath + "green_blue.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{G/W}", ImageHelper.loadImage(Config.symbolsResourcePath + "green_white.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{R/G}", ImageHelper.loadImage(Config.symbolsResourcePath + "red_green.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{R/W}", ImageHelper.loadImage(Config.symbolsResourcePath + "red_white.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{W/B}", ImageHelper.loadImage(Config.symbolsResourcePath + "white_black.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{W/U}", ImageHelper.loadImage(Config.symbolsResourcePath + "white_blue.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{B/G}", ImageHelper.loadImage(Config.symbolsResourcePath + "black_green.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{B/R}", ImageHelper.loadImage(Config.symbolsResourcePath + "black_red.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{U/B}", ImageHelper.loadImage(Config.symbolsResourcePath + "blue_black.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{U/R}", ImageHelper.loadImage(Config.symbolsResourcePath + "blue_red.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{G/B}", ImageHelper.loadImage(Config.symbolsResourcePath + "green_blue.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{G/W}", ImageHelper.loadImage(Config.symbolsResourcePath + "green_white.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{R/G}", ImageHelper.loadImage(Config.symbolsResourcePath + "red_green.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{R/W}", ImageHelper.loadImage(Config.symbolsResourcePath + "red_white.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{W/B}", ImageHelper.loadImage(Config.symbolsResourcePath + "white_black.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{W/U}", ImageHelper.loadImage(Config.symbolsResourcePath + "white_blue.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{2/B}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_black.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{2/U}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_blue.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{2/G}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_green.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{2/R}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_red.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{2/W}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_white.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
symbols.put("{2/B}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_black.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{2/U}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_blue.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{2/G}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_green.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{2/R}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_red.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
symbols.put("{2/W}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_white.png", SYMBOL_MAX_WIDTH, SYMBOL_MAX_HEIGHT));
}

View file

@ -3,4 +3,5 @@ port=17171
remote-server=mage-server
cards-resource-path=resources/images/cards/
symbols-resource-path=resources/images/symbols/
resource-path=resources/images/
resource-path=resources/images/
card-scaling-factor=0.4