mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 02:52:02 -08:00
Displayint card name in choice dialog. Bigger cards for choice many.
This commit is contained in:
parent
8f0159d706
commit
638a6368d2
8 changed files with 51 additions and 31 deletions
|
|
@ -8,6 +8,7 @@ resource-path=/home/loki/.wine/drive_c/Program Files/Wizards of the Coast/Magic
|
||||||
#symbols-resource-path=resources/images/symbols/
|
#symbols-resource-path=resources/images/symbols/
|
||||||
#resource-path=resources/images/
|
#resource-path=resources/images/
|
||||||
card-scaling-factor=0.4
|
card-scaling-factor=0.4
|
||||||
|
card-scaling-factor-enlarged=0.5
|
||||||
hand-scaling-factor=1.3
|
hand-scaling-factor=1.3
|
||||||
|
|
||||||
# parameters for debugging and testing faster
|
# parameters for debugging and testing faster
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@ public class BigCard extends JComponent {
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
public void setDefaultImage() {
|
public void setDefaultImage() {
|
||||||
bigImage = ImageHelper.getImageFromResources("/empty.png");
|
bigImage = ImageHelper.getImageFromResources("/empty.png");
|
||||||
bigImage = ImageHelper.getResizedImage((BufferedImage) bigImage, getWidth(), getHeight());
|
bigImage = ImageHelper.getResizedImage((BufferedImage) bigImage, getWidth(), getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -499,4 +499,8 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
||||||
public boolean isTransformed() {
|
public boolean isTransformed() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showCardTitle() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,16 +28,6 @@
|
||||||
|
|
||||||
package mage.client.cards;
|
package mage.client.cards;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.Rectangle;
|
|
||||||
import java.awt.event.MouseListener;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import javax.swing.JLayeredPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JScrollPane;
|
|
||||||
|
|
||||||
import mage.cards.CardDimensions;
|
import mage.cards.CardDimensions;
|
||||||
import mage.cards.MageCard;
|
import mage.cards.MageCard;
|
||||||
import mage.client.plugins.impl.Plugins;
|
import mage.client.plugins.impl.Plugins;
|
||||||
|
|
@ -48,6 +38,11 @@ import mage.view.CardView;
|
||||||
import mage.view.CardsView;
|
import mage.view.CardsView;
|
||||||
import mage.view.SimpleCardsView;
|
import mage.view.SimpleCardsView;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.MouseListener;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class CardArea extends JPanel {
|
public class CardArea extends JPanel {
|
||||||
|
|
||||||
private boolean reloaded = false;
|
private boolean reloaded = false;
|
||||||
|
|
@ -78,7 +73,7 @@ public class CardArea extends JPanel {
|
||||||
if (showCards != null && showCards.size() < 10)
|
if (showCards != null && showCards.size() < 10)
|
||||||
loadCardsFew(showCards, bigCard, gameId, listener);
|
loadCardsFew(showCards, bigCard, gameId, listener);
|
||||||
else
|
else
|
||||||
loadCardsMany(showCards, bigCard, gameId, listener);
|
loadCardsMany(showCards, bigCard, gameId, listener, dimension);
|
||||||
cardArea.revalidate();
|
cardArea.revalidate();
|
||||||
|
|
||||||
this.revalidate();
|
this.revalidate();
|
||||||
|
|
@ -88,7 +83,7 @@ public class CardArea extends JPanel {
|
||||||
public void loadCardsNarrow(CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId, MouseListener listener) {
|
public void loadCardsNarrow(CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId, MouseListener listener) {
|
||||||
this.reloaded = true;
|
this.reloaded = true;
|
||||||
cardArea.removeAll();
|
cardArea.removeAll();
|
||||||
loadCardsMany(showCards, bigCard, gameId, listener);
|
loadCardsMany(showCards, bigCard, gameId, listener, dimension);
|
||||||
cardArea.revalidate();
|
cardArea.revalidate();
|
||||||
|
|
||||||
this.revalidate();
|
this.revalidate();
|
||||||
|
|
@ -99,13 +94,13 @@ public class CardArea extends JPanel {
|
||||||
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);
|
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, listener);
|
addCard(card, bigCard, gameId, rectangle, dimension, Config.dimensions, listener);
|
||||||
rectangle.translate(Config.dimensions.frameWidth, 0);
|
rectangle.translate(Config.dimensions.frameWidth, 0);
|
||||||
}
|
}
|
||||||
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, Dimension dimension, MouseListener listener) {
|
private void addCard(CardView card, BigCard bigCard, UUID gameId, Rectangle rectangle, Dimension dimension, CardDimensions cardDimensions, MouseListener listener) {
|
||||||
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());
|
||||||
|
|
@ -115,25 +110,27 @@ public class CardArea extends JPanel {
|
||||||
card = tmp;
|
card = tmp;
|
||||||
}
|
}
|
||||||
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, dimension, gameId, true);
|
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, dimension, gameId, true);
|
||||||
|
|
||||||
cardImg.setBounds(rectangle);
|
cardImg.setBounds(rectangle);
|
||||||
if (listener != null)
|
if (listener != null)
|
||||||
cardImg.addMouseListener(listener);
|
cardImg.addMouseListener(listener);
|
||||||
cardArea.add(cardImg);
|
cardArea.add(cardImg);
|
||||||
cardArea.moveToFront(cardImg);
|
cardArea.moveToFront(cardImg);
|
||||||
cardImg.update(card);
|
cardImg.update(card);
|
||||||
cardImg.setCardBounds(rectangle.x, rectangle.y, Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
cardImg.setCardBounds(rectangle.x, rectangle.y, cardDimensions.frameWidth, cardDimensions.frameHeight);
|
||||||
|
cardImg.showCardTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadCardsMany(CardsView showCards, BigCard bigCard, UUID gameId, MouseListener listener) {
|
private void loadCardsMany(CardsView showCards, BigCard bigCard, UUID gameId, MouseListener listener, CardDimensions cardDimensions) {
|
||||||
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(cardDimensions.frameWidth, cardDimensions.frameHeight);
|
||||||
Dimension dimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
Dimension dimension = new Dimension(cardDimensions.frameWidth, cardDimensions.frameHeight);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (CardView card : showCards.values()) {
|
for (CardView card : showCards.values()) {
|
||||||
addCard(card, bigCard, gameId, rectangle, dimension, listener);
|
addCard(card, bigCard, gameId, rectangle, dimension, cardDimensions, listener);
|
||||||
if (count >= 20) {
|
if (count >= 20) {
|
||||||
rectangle.translate(Config.dimensions.frameWidth, -400);
|
rectangle.translate(cardDimensions.frameWidth, -400);
|
||||||
columns++;
|
columns++;
|
||||||
count = 0;
|
count = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -142,7 +139,7 @@ public class CardArea extends JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cardArea.setPreferredSize(new Dimension(Config.dimensions.frameWidth * columns, Config.dimensions.frameHeight + 400));
|
cardArea.setPreferredSize(new Dimension(cardDimensions.frameWidth * columns, cardDimensions.frameHeight + 400));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isReloaded() {
|
public boolean isReloaded() {
|
||||||
|
|
|
||||||
|
|
@ -591,7 +591,7 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
private ShowCardsDialog showCards(String title, CardsView cards, boolean required) {
|
private ShowCardsDialog showCards(String title, CardsView cards, boolean required) {
|
||||||
ShowCardsDialog showCards = new ShowCardsDialog();
|
ShowCardsDialog showCards = new ShowCardsDialog();
|
||||||
showCards.loadCards(title, cards, bigCard, Config.dimensions, gameId, required);
|
showCards.loadCards(title, cards, bigCard, Config.dimensionsEnlarged, gameId, required);
|
||||||
return showCards;
|
return showCards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,14 @@
|
||||||
|
|
||||||
package mage.client.util;
|
package mage.client.util;
|
||||||
|
|
||||||
|
import mage.cards.CardDimensions;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import mage.cards.CardDimensions;
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
|
@ -48,8 +48,10 @@ public class Config {
|
||||||
public static final String serverName;
|
public static final String serverName;
|
||||||
public static final int port;
|
public static final int port;
|
||||||
public static final double cardScalingFactor;
|
public static final double cardScalingFactor;
|
||||||
|
public static final double cardScalingFactorEnlarged;
|
||||||
public static final double handScalingFactor;
|
public static final double handScalingFactor;
|
||||||
public static final CardDimensions dimensions;
|
public static final CardDimensions dimensions;
|
||||||
|
public static final CardDimensions dimensionsEnlarged;
|
||||||
|
|
||||||
public static final String defaultGameType;
|
public static final String defaultGameType;
|
||||||
public static final String defaultDeckPath;
|
public static final String defaultDeckPath;
|
||||||
|
|
@ -67,6 +69,7 @@ public class Config {
|
||||||
port = Integer.parseInt(p.getProperty("port"));
|
port = Integer.parseInt(p.getProperty("port"));
|
||||||
remoteServer = p.getProperty("remote-server");
|
remoteServer = p.getProperty("remote-server");
|
||||||
cardScalingFactor = Double.valueOf(p.getProperty("card-scaling-factor"));
|
cardScalingFactor = Double.valueOf(p.getProperty("card-scaling-factor"));
|
||||||
|
cardScalingFactorEnlarged = Double.valueOf(p.getProperty("card-scaling-factor-enlarged"));
|
||||||
handScalingFactor = Double.valueOf(p.getProperty("hand-scaling-factor"));
|
handScalingFactor = Double.valueOf(p.getProperty("hand-scaling-factor"));
|
||||||
defaultGameType = p.getProperty("default-game-type", "Human");
|
defaultGameType = p.getProperty("default-game-type", "Human");
|
||||||
defaultDeckPath = p.getProperty("default-deck-path");
|
defaultDeckPath = p.getProperty("default-deck-path");
|
||||||
|
|
@ -74,6 +77,7 @@ public class Config {
|
||||||
defaultComputerName = p.getProperty("default-computer-name");
|
defaultComputerName = p.getProperty("default-computer-name");
|
||||||
|
|
||||||
dimensions = new CardDimensions(cardScalingFactor);
|
dimensions = new CardDimensions(cardScalingFactor);
|
||||||
|
dimensionsEnlarged = new CardDimensions(cardScalingFactorEnlarged);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,8 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
||||||
private boolean animationInProgress = false;
|
private boolean animationInProgress = false;
|
||||||
private JButton dayNightButton;
|
private JButton dayNightButton;
|
||||||
|
|
||||||
|
private boolean displayTitleAnyway;
|
||||||
|
|
||||||
public CardPanel(CardView newGameCard, UUID gameId, final boolean loadImage, ActionCallback callback, final boolean foil) {
|
public CardPanel(CardView newGameCard, UUID gameId, final boolean loadImage, ActionCallback callback, final boolean foil) {
|
||||||
this.gameCard = newGameCard;
|
this.gameCard = newGameCard;
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
|
|
@ -197,6 +199,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
||||||
if (gameCard.isTransformed()) {
|
if (gameCard.isTransformed()) {
|
||||||
toggleTransformed();
|
toggleTransformed();
|
||||||
}
|
}
|
||||||
|
setText(gameCard);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (Error err) {
|
} catch (Error err) {
|
||||||
|
|
@ -207,6 +210,11 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setText(CardView card) {
|
private void setText(CardView card) {
|
||||||
|
if (displayTitleAnyway) {
|
||||||
|
titleText.setText(card.getName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (hasImage) {
|
if (hasImage) {
|
||||||
titleText.setText("");
|
titleText.setText("");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -595,6 +603,12 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showCardTitle() {
|
||||||
|
displayTitleAnyway = true;
|
||||||
|
setText(gameCard);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBeginAnimation() {
|
public void onBeginAnimation() {
|
||||||
animationInProgress = true;
|
animationInProgress = true;
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
package mage.cards;
|
package mage.cards;
|
||||||
|
|
||||||
import java.awt.Image;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
|
|
||||||
import mage.cards.action.ActionCallback;
|
import mage.cards.action.ActionCallback;
|
||||||
import mage.view.CardView;
|
import mage.view.CardView;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public abstract class MageCard extends JPanel {
|
public abstract class MageCard extends JPanel {
|
||||||
private static final long serialVersionUID = 6089945326434301879L;
|
private static final long serialVersionUID = 6089945326434301879L;
|
||||||
|
|
||||||
|
|
@ -29,4 +28,5 @@ public abstract class MageCard extends JPanel {
|
||||||
abstract public void updateCallback(ActionCallback callback, UUID gameId);
|
abstract public void updateCallback(ActionCallback callback, UUID gameId);
|
||||||
abstract public void toggleTransformed();
|
abstract public void toggleTransformed();
|
||||||
abstract public boolean isTransformed();
|
abstract public boolean isTransformed();
|
||||||
|
abstract public void showCardTitle();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue