Reduced hand cards size. Removed battlefield card area gap (cards now have more place and are less reduced in size).

This commit is contained in:
magenoxx 2011-01-29 20:03:22 +03:00
parent 93878d4868
commit 2abc0e888d
15 changed files with 81 additions and 36 deletions

View file

@ -208,6 +208,9 @@ public class BigCard extends JComponent {
if (source == null) { if (source == null) {
source = BufferedImageBuilder.bufferImage(bigImage); source = BufferedImageBuilder.bufferImage(bigImage);
} }
if (source == null) {
return;
}
f = filter.filter(source, null); f = filter.filter(source, null);
} }
synchronized (BigCard.class) { synchronized (BigCard.class) {

View file

@ -67,6 +67,7 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener
protected BigCard bigCard; protected BigCard bigCard;
protected UUID gameId; protected UUID gameId;
private Map<UUID, MageCard> cards = new HashMap<UUID, MageCard>(); private Map<UUID, MageCard> cards = new HashMap<UUID, MageCard>();
private Dimension cardDimension;
public CardGrid() { public CardGrid() {
initComponents(); initComponents();
@ -93,7 +94,10 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener
} }
private void addCard(CardView card, BigCard bigCard, UUID gameId) { private void addCard(CardView card, BigCard bigCard, UUID gameId) {
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, Config.dimensions, gameId, true); if (cardDimension == null) {
cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
}
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, cardDimension, gameId, true);
cards.put(card.getId(), cardImg); cards.put(card.getId(), cardImg);
cardImg.addMouseListener(this); cardImg.addMouseListener(this);
add(cardImg); add(cardImg);

View file

@ -65,6 +65,8 @@ public class Cards extends javax.swing.JPanel {
private boolean dontDisplayTapped = false; private boolean dontDisplayTapped = false;
private static final int GAP_X = 5; private static final int GAP_X = 5;
private Dimension cardDimension;
/** Creates new form Cards */ /** Creates new form Cards */
public Cards() { public Cards() {
this(false); this(false);
@ -125,7 +127,7 @@ public class Cards extends javax.swing.JPanel {
} }
if (changed) { if (changed) {
layoutCards(Config.dimensions); layoutCards(getCardDimension());
} }
cardArea.setPreferredSize(new Dimension(cards.size() * (Config.dimensions.frameWidth + GAP_X), Config.dimensions.frameHeight)); cardArea.setPreferredSize(new Dimension(cards.size() * (Config.dimensions.frameWidth + GAP_X), Config.dimensions.frameHeight));
@ -137,8 +139,15 @@ public class Cards extends javax.swing.JPanel {
return changed; return changed;
} }
private Dimension getCardDimension() {
if (cardDimension == null) {
cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
}
return cardDimension;
}
private void addCard(CardView card, BigCard bigCard, UUID gameId) { private void addCard(CardView card, BigCard bigCard, UUID gameId) {
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, Config.dimensions, gameId, true); MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, getCardDimension(), gameId, true);
cards.put(card.getId(), cardImg); cards.put(card.getId(), cardImg);
cardArea.add(cardImg); cardArea.add(cardImg);
} }
@ -157,13 +166,13 @@ public class Cards extends javax.swing.JPanel {
} }
} }
private void layoutCards(CardDimensions dimension) { private void layoutCards(Dimension dimension) {
if (Plugins.getInstance().isCardPluginLoaded()) { if (Plugins.getInstance().isCardPluginLoaded()) {
int dx = 0; int dx = 0;
for (MageCard card: cards.values()) { for (MageCard card: cards.values()) {
card.setLocation(dx, 0); card.setLocation(dx, 0);
card.setCardBounds(dx, 0, dimension.frameWidth, dimension.frameHeight); card.setCardBounds(dx, 0, dimension.width, dimension.height);
dx += dimension.frameWidth + GAP_X; dx += dimension.width + GAP_X;
} }
} }
} }
@ -213,4 +222,8 @@ public class Cards extends javax.swing.JPanel {
jScrollPane1.getVerticalScrollBar().setUnitIncrement(unitIncrement); jScrollPane1.getVerticalScrollBar().setUnitIncrement(unitIncrement);
} }
} }
public void setCardDimension(Dimension dimension) {
this.cardDimension = dimension;
}
} }

View file

@ -60,6 +60,7 @@ import mage.view.CardsView;
public class CardsList extends javax.swing.JPanel implements MouseListener { public class CardsList extends javax.swing.JPanel implements MouseListener {
protected CardEventSource cardEventSource = new CardEventSource(); protected CardEventSource cardEventSource = new CardEventSource();
private Dimension cardDimension;
/** Creates new form Cards */ /** Creates new form Cards */
public CardsList() { public CardsList() {
@ -101,7 +102,10 @@ public class CardsList extends javax.swing.JPanel implements MouseListener {
} }
private void addCard(CardView card, BigCard bigCard, UUID gameId, Rectangle rectangle) { private void addCard(CardView card, BigCard bigCard, UUID gameId, Rectangle rectangle) {
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, Config.dimensions, gameId, true); if (cardDimension == null) {
cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
}
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, cardDimension, gameId, true);
cardImg.setBounds(rectangle); cardImg.setBounds(rectangle);
cardArea.add(cardImg); cardArea.add(cardImg);
cardArea.moveToFront(cardImg); cardArea.moveToFront(cardImg);

View file

@ -11,10 +11,12 @@
package mage.client.cards; package mage.client.cards;
import java.awt.Rectangle; import java.awt.*;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.util.UUID; import java.util.UUID;
import mage.cards.CardDimensions;
import mage.cards.MageCard; import mage.cards.MageCard;
import mage.client.MageFrame; import mage.client.MageFrame;
import mage.client.plugins.impl.Plugins; import mage.client.plugins.impl.Plugins;
@ -45,8 +47,9 @@ public class DraftGrid extends javax.swing.JPanel implements MouseListener {
int curColumn = 0; int curColumn = 0;
int curRow = 0; int curRow = 0;
Rectangle rectangle = new Rectangle(Config.dimensions.frameWidth, Config.dimensions.frameHeight); Rectangle rectangle = new Rectangle(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
Dimension dimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
for (CardView card: booster.values()) { for (CardView card: booster.values()) {
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, Config.dimensions, null, false); MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, dimension, null, false);
cardImg.addMouseListener(this); cardImg.addMouseListener(this);
add(cardImg); add(cardImg);
cardImg.update(card); cardImg.update(card);

View file

@ -39,6 +39,7 @@ import mage.client.components.arcane.ManaSymbols;
import mage.client.plugins.impl.Plugins; import mage.client.plugins.impl.Plugins;
import mage.client.util.AudioManager; import mage.client.util.AudioManager;
import mage.client.util.Command; import mage.client.util.Command;
import mage.client.util.Config;
import mage.client.util.ImageHelper; import mage.client.util.ImageHelper;
import mage.components.ImagePanel; import mage.components.ImagePanel;
import mage.view.CardView; import mage.view.CardView;
@ -212,7 +213,10 @@ public class MageBook extends JComponent {
} }
private void addCard(CardView card, BigCard bigCard, UUID gameId, Rectangle rectangle) { private void addCard(CardView card, BigCard bigCard, UUID gameId, Rectangle rectangle) {
final MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, cardDimensions, gameId, false); if (cardDimension == null) {
cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
}
final MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, cardDimension, gameId, false);
cardImg.setBounds(rectangle); cardImg.setBounds(rectangle);
jLayeredPane.add(cardImg, JLayeredPane.DEFAULT_LAYER, 10); jLayeredPane.add(cardImg, JLayeredPane.DEFAULT_LAYER, 10);
cardImg.update(card); cardImg.update(card);
@ -296,6 +300,7 @@ public class MageBook extends JComponent {
private static CardDimensions cardDimensions = new CardDimensions(1.2d); private static CardDimensions cardDimensions = new CardDimensions(1.2d);
private static Font font = new Font("Arial", Font.PLAIN, 14); private static Font font = new Font("Arial", Font.PLAIN, 14);
private static final Logger log = Logger.getLogger(MageBook.class); private static final Logger log = Logger.getLogger(MageBook.class);
private Dimension cardDimension;
static private final String CENTER_PANEL_IMAGE_PATH = "/book_bg.jpg"; static private final String CENTER_PANEL_IMAGE_PATH = "/book_bg.jpg";
static private final String RIGHT_PANEL_IMAGE_PATH = "/book_right.jpg"; static private final String RIGHT_PANEL_IMAGE_PATH = "/book_right.jpg";

View file

@ -71,9 +71,9 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
this.title = name; this.title = name;
cardArea.removeAll(); cardArea.removeAll();
if (showCards != null && showCards.size() < 10) if (showCards != null && showCards.size() < 10)
loadCardsFew(showCards, bigCard, dimension, gameId); loadCardsFew(showCards, bigCard, gameId);
else else
loadCardsMany(showCards, bigCard, dimension, gameId); loadCardsMany(showCards, bigCard, gameId);
cardArea.revalidate(); cardArea.revalidate();
if (getParent() != MageFrame.getDesktop() /*|| this.isClosed*/) { if (getParent() != MageFrame.getDesktop() /*|| this.isClosed*/) {
MageFrame.getDesktop().add(this, JLayeredPane.POPUP_LAYER); MageFrame.getDesktop().add(this, JLayeredPane.POPUP_LAYER);
@ -85,8 +85,9 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
this.setVisible(true); this.setVisible(true);
} }
private void loadCardsFew(CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId) { private void loadCardsFew(CardsView showCards, BigCard bigCard, UUID gameId) {
Rectangle rectangle = new Rectangle(Config.dimensions.frameWidth, Config.dimensions.frameHeight); Rectangle rectangle = new Rectangle(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
Dimension dimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
for (CardView card: showCards.values()) { for (CardView card: showCards.values()) {
addCard(card, bigCard, gameId, rectangle, dimension); addCard(card, bigCard, gameId, rectangle, dimension);
rectangle.translate(Config.dimensions.frameWidth, 0); rectangle.translate(Config.dimensions.frameWidth, 0);
@ -94,7 +95,7 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
cardArea.setPreferredSize(new Dimension(Config.dimensions.frameWidth * showCards.size(), Config.dimensions.frameHeight)); cardArea.setPreferredSize(new Dimension(Config.dimensions.frameWidth * showCards.size(), Config.dimensions.frameHeight));
} }
private void addCard(CardView card, BigCard bigCard, UUID gameId, Rectangle rectangle, CardDimensions dimension) { private void addCard(CardView card, BigCard bigCard, UUID gameId, Rectangle rectangle, Dimension dimension) {
if (card instanceof AbilityView) { if (card instanceof AbilityView) {
CardView tmp = ((AbilityView)card).getSourceCard(); CardView tmp = ((AbilityView)card).getSourceCard();
tmp.overrideRules(card.getRules()); tmp.overrideRules(card.getRules());
@ -112,10 +113,11 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
cardImg.setCardBounds(rectangle.x, rectangle.y, Config.dimensions.frameWidth, Config.dimensions.frameHeight); cardImg.setCardBounds(rectangle.x, rectangle.y, Config.dimensions.frameWidth, Config.dimensions.frameHeight);
} }
private void loadCardsMany(CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId) { private void loadCardsMany(CardsView showCards, BigCard bigCard, UUID gameId) {
int columns = 1; int columns = 1;
if (showCards != null && showCards.size() > 0) { if (showCards != null && showCards.size() > 0) {
Rectangle rectangle = new Rectangle(Config.dimensions.frameWidth, Config.dimensions.frameHeight); Rectangle rectangle = new Rectangle(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
Dimension dimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
int count = 0; int count = 0;
for (CardView card: showCards.values()) { for (CardView card: showCards.values()) {
addCard(card, bigCard, gameId, rectangle, dimension); addCard(card, bigCard, gameId, rectangle, dimension);

View file

@ -73,6 +73,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
protected static Map<UUID, PermanentView> battlefield; protected static Map<UUID, PermanentView> battlefield;
protected static List<Thread> threads = new ArrayList<Thread>(); protected static List<Thread> threads = new ArrayList<Thread>();
private static Dimension cardDimension;
/** Creates new form BattlefieldPanel */ /** Creates new form BattlefieldPanel */
public BattlefieldPanel(JScrollPane jScrollPane) { public BattlefieldPanel(JScrollPane jScrollPane) {
@ -154,7 +155,10 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
} }
private void addPermanent(PermanentView permanent, final int count) { private void addPermanent(PermanentView permanent, final int count) {
final MagePermanent perm = Plugins.getInstance().getMagePermanent(permanent, bigCard, Config.dimensions, gameId, true); if (cardDimension == null) {
cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
}
final MagePermanent perm = Plugins.getInstance().getMagePermanent(permanent, bigCard, cardDimension, gameId, true);
if (!Plugins.getInstance().isCardPluginLoaded()) { if (!Plugins.getInstance().isCardPluginLoaded()) {
perm.setBounds(findEmptySpace(new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight))); perm.setBounds(findEmptySpace(new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight)));
} else { } else {

View file

@ -88,6 +88,8 @@ public class GamePanel extends javax.swing.JPanel {
private UUID playerId; private UUID playerId;
private Session session; private Session session;
private static final Dimension handCardDimension = new Dimension(75, (int)(75 * 3.5f / 2.5f));
/** Creates new form GamePanel */ /** Creates new form GamePanel */
public GamePanel() { public GamePanel() {
initComponents(); initComponents();
@ -289,7 +291,7 @@ public class GamePanel extends javax.swing.JPanel {
} else { } else {
this.hand.loadCards(game.getHand(), bigCard, gameId); this.hand.loadCards(game.getHand(), bigCard, gameId);
int count = game.getHand().size(); int count = game.getHand().size();
hand.setPreferredSize(new java.awt.Dimension((Config.dimensions.frameWidth + 5) * count + 5, Config.dimensions.frameHeight + 20)); // for scroll hand.setPreferredSize(new java.awt.Dimension((handCardDimension.width + 5) * count + 5, handCardDimension.height + 20)); // for scroll
} }
if (game.getPhase() != null) if (game.getPhase() != null)
this.txtPhase.setText(game.getPhase().toString()); this.txtPhase.setText(game.getPhase().toString());
@ -381,9 +383,9 @@ public class GamePanel extends javax.swing.JPanel {
return JOptionPane.showConfirmDialog(this, message, title, JOptionPane.YES_NO_OPTION); return JOptionPane.showConfirmDialog(this, message, title, JOptionPane.YES_NO_OPTION);
} }
public JPanel getHand() { /*public JPanel getHand() {
return hand; return hand;
} }*/
public void select(String message, GameView gameView) { public void select(String message, GameView gameView) {
updateGame(gameView); updateGame(gameView);
@ -439,9 +441,9 @@ public class GamePanel extends javax.swing.JPanel {
return players; return players;
} }
public javax.swing.JPanel getBattlefield() { /*public javax.swing.JPanel getBattlefield() {
return pnlBattlefield; return pnlBattlefield;
} }*/
/** This method is called from within the constructor to /** This method is called from within the constructor to
* initialize the form. * initialize the form.
@ -480,6 +482,8 @@ public class GamePanel extends javax.swing.JPanel {
hand = new mage.client.cards.Cards(true); hand = new mage.client.cards.Cards(true);
chatPanel = new mage.client.chat.ChatPanel(); chatPanel = new mage.client.chat.ChatPanel();
hand.setCardDimension(handCardDimension);
jSplitPane1.setBorder(null); jSplitPane1.setBorder(null);
jSplitPane1.setDividerSize(7); jSplitPane1.setDividerSize(7);
jSplitPane1.setResizeWeight(1.0); jSplitPane1.setResizeWeight(1.0);

View file

@ -1,6 +1,6 @@
package mage.client.plugins; package mage.client.plugins;
import java.awt.Image; import java.awt.*;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -21,8 +21,8 @@ public interface MagePlugins {
void shutdown(); void shutdown();
void updateGamePanel(Map<String, JComponent> ui); void updateGamePanel(Map<String, JComponent> ui);
JComponent updateTablePanel(Map<String, JComponent> ui); JComponent updateTablePanel(Map<String, JComponent> ui);
MagePermanent getMagePermanent(PermanentView card, BigCard bigCard, CardDimensions dimension, UUID gameId, boolean canBeFoil); MagePermanent getMagePermanent(PermanentView card, BigCard bigCard, Dimension dimension, UUID gameId, boolean canBeFoil);
MageCard getMageCard(CardView card, BigCard bigCard, CardDimensions dimension, UUID gameId, boolean canBeFoil); MageCard getMageCard(CardView card, BigCard bigCard, Dimension dimension, UUID gameId, boolean canBeFoil);
boolean isThemePluginLoaded(); boolean isThemePluginLoaded();
boolean isCardPluginLoaded(); boolean isCardPluginLoaded();
boolean isCounterPluginLoaded(); boolean isCounterPluginLoaded();

View file

@ -1,6 +1,6 @@
package mage.client.plugins.impl; package mage.client.plugins.impl;
import java.awt.Image; import java.awt.*;
import java.io.File; import java.io.File;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
@ -80,7 +80,7 @@ public class Plugins implements MagePlugins {
} }
@Override @Override
public MagePermanent getMagePermanent(PermanentView card, BigCard bigCard, CardDimensions dimension, UUID gameId, boolean canBeFoil) { public MagePermanent getMagePermanent(PermanentView card, BigCard bigCard, Dimension dimension, UUID gameId, boolean canBeFoil) {
if (cardPlugin != null) { if (cardPlugin != null) {
mageActionCallback.refreshSession(); mageActionCallback.refreshSession();
mageActionCallback.setCardPreviewComponent(bigCard); mageActionCallback.setCardPreviewComponent(bigCard);
@ -91,7 +91,7 @@ public class Plugins implements MagePlugins {
} }
@Override @Override
public MageCard getMageCard(CardView card, BigCard bigCard, CardDimensions dimension, UUID gameId, boolean canBeFoil) { public MageCard getMageCard(CardView card, BigCard bigCard, Dimension dimension, UUID gameId, boolean canBeFoil) {
if (cardPlugin != null) { if (cardPlugin != null) {
mageActionCallback.refreshSession(); mageActionCallback.refreshSession();
mageActionCallback.setCardPreviewComponent(bigCard); mageActionCallback.setCardPreviewComponent(bigCard);

View file

@ -25,6 +25,9 @@ public class BufferedImageBuilder {
} }
public static BufferedImage bufferImage(Image image, int type) { public static BufferedImage bufferImage(Image image, int type) {
if (image == null) {
return null;
}
BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), type); BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), type);
Graphics2D g = bufferedImage.createGraphics(); Graphics2D g = bufferedImage.createGraphics();
g.drawImage(image, null, null); g.drawImage(image, null, null);

View file

@ -1,6 +1,6 @@
package mage.interfaces.plugin; package mage.interfaces.plugin;
import java.awt.Image; import java.awt.*;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -25,8 +25,8 @@ import net.xeoh.plugins.base.Plugin;
* @author nantuko * @author nantuko
*/ */
public interface CardPlugin extends Plugin { public interface CardPlugin extends Plugin {
MagePermanent getMagePermanent(PermanentView permanent, CardDimensions dimension, UUID gameId, ActionCallback callback, boolean canBeFoil); MagePermanent getMagePermanent(PermanentView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil);
MagePermanent getMageCard(CardView permanent, CardDimensions dimension, UUID gameId, ActionCallback callback, boolean canBeFoil); MagePermanent getMageCard(CardView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil);
void sortPermanents(Map<String, JComponent> ui, Collection<MagePermanent> cards); void sortPermanents(Map<String, JComponent> ui, Collection<MagePermanent> cards);
void downloadImages(Set<Card> allCards); void downloadImages(Set<Card> allCards);
void downloadSymbols(); void downloadSymbols();

View file

@ -50,7 +50,7 @@ public class CardPluginImpl implements CardPlugin {
static private final float CARD_SPACING_Y = 0.03f; static private final float CARD_SPACING_Y = 0.03f;
static private final float STACK_SPACING_X = 0.07f; static private final float STACK_SPACING_X = 0.07f;
static private final float STACK_SPACING_Y = 0.13f; static private final float STACK_SPACING_Y = 0.13f;
static private final int MW_GUIDE_HEIGHT = 30; //static private final int MW_GUIDE_HEIGHT = 30;
private int landStackMax = 5; private int landStackMax = 5;
private int cardWidthMin = 50, cardWidthMax = Constants.CARD_SIZE_FULL.width; private int cardWidthMin = 50, cardWidthMax = Constants.CARD_SIZE_FULL.width;
@ -77,20 +77,20 @@ public class CardPluginImpl implements CardPlugin {
} }
@Override @Override
public MagePermanent getMagePermanent(PermanentView permanent, CardDimensions dimension, UUID gameId, ActionCallback callback, boolean canBeFoil) { public MagePermanent getMagePermanent(PermanentView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil) {
boolean foil = canBeFoil && (new Random()).nextInt(5) == 0; boolean foil = canBeFoil && (new Random()).nextInt(5) == 0;
CardPanel cardPanel = new CardPanel(permanent, gameId, true, callback, foil); CardPanel cardPanel = new CardPanel(permanent, gameId, true, callback, foil);
cardPanel.setCardBounds(0, 0, dimension.frameWidth, dimension.frameHeight); cardPanel.setCardBounds(0, 0, dimension.width, dimension.height);
boolean implemented = !permanent.getRarity().equals(mage.Constants.Rarity.NA); boolean implemented = !permanent.getRarity().equals(mage.Constants.Rarity.NA);
cardPanel.setShowCastingCost(implemented); cardPanel.setShowCastingCost(implemented);
return cardPanel; return cardPanel;
} }
@Override @Override
public MagePermanent getMageCard(CardView permanent, CardDimensions dimension, UUID gameId, ActionCallback callback, boolean canBeFoil) { public MagePermanent getMageCard(CardView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil) {
boolean foil = canBeFoil && (new Random()).nextInt(5) == 0; boolean foil = canBeFoil && (new Random()).nextInt(5) == 0;
CardPanel cardPanel = new CardPanel(permanent, gameId, true, callback, foil); CardPanel cardPanel = new CardPanel(permanent, gameId, true, callback, foil);
cardPanel.setCardBounds(0, 0, dimension.frameWidth, dimension.frameHeight); cardPanel.setCardBounds(0, 0, dimension.width, dimension.height);
boolean implemented = !permanent.getRarity().equals(mage.Constants.Rarity.NA); boolean implemented = !permanent.getRarity().equals(mage.Constants.Rarity.NA);
cardPanel.setShowCastingCost(implemented); cardPanel.setShowCastingCost(implemented);
return cardPanel; return cardPanel;
@ -158,7 +158,7 @@ public class CardPluginImpl implements CardPlugin {
cardWidth = cardWidthMax; cardWidth = cardWidthMax;
Rectangle rect = jScrollPane.getVisibleRect(); Rectangle rect = jScrollPane.getVisibleRect();
playAreaWidth = rect.width; playAreaWidth = rect.width;
playAreaHeight = rect.height - MW_GUIDE_HEIGHT; playAreaHeight = rect.height;
while (true) { while (true) {
rows.clear(); rows.clear();
cardHeight = Math.round(cardWidth * CardPanel.ASPECT_RATIO); cardHeight = Math.round(cardWidth * CardPanel.ASPECT_RATIO);