New stack dialog (experimental)
|
@ -42,6 +42,7 @@ import mage.client.components.MageComponents;
|
|||
import mage.client.components.MageJDesktop;
|
||||
import mage.client.components.MageRoundPane;
|
||||
import mage.client.components.MageUI;
|
||||
import mage.client.components.ext.dlg.DialogManager;
|
||||
import mage.client.constants.Constants.DeckEditorMode;
|
||||
import mage.client.deckeditor.DeckEditorPane;
|
||||
import mage.client.deckeditor.collection.viewer.CollectionViewerPane;
|
||||
|
@ -183,6 +184,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
initComponents();
|
||||
setSize(1024, 768);
|
||||
SettingsManager.getInstance().setScreenWidthAndHeight(1024, 768);
|
||||
DialogManager.getManager().setScreenWidth(1024);
|
||||
DialogManager.getManager().setScreenHeight(768);
|
||||
DialogManager.getManager().setBounds(0, 0, 1024, 768);
|
||||
DialogManager.getManager().setVisible(false);
|
||||
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
|
||||
|
||||
session = new SessionImpl(this);
|
||||
|
|
|
@ -42,11 +42,8 @@ import mage.view.*;
|
|||
|
||||
import javax.swing.border.Border;
|
||||
import java.awt.*;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -122,8 +119,13 @@ public class Cards extends javax.swing.JPanel {
|
|||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (CardView card: cardsView.values()) {
|
||||
|
||||
java.util.List<CardView> orderedList = new ArrayList<CardView>();
|
||||
for (CardView card: cardsView.values()) {
|
||||
orderedList.add(0, card);
|
||||
}
|
||||
|
||||
for (CardView card: orderedList) {
|
||||
if (dontDisplayTapped) {
|
||||
if (card instanceof PermanentView) {
|
||||
((PermanentView)card).overrideTapped(false);
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package mage.client.components.ext;
|
||||
|
||||
import org.mage.card.arcane.UI;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class MageFloatPane extends JEditorPane {
|
||||
|
||||
public MageFloatPane() {
|
||||
UI.setHTMLEditorKit(this);
|
||||
setEditable(false);
|
||||
setBackground(Color.white);
|
||||
JButton jb = new JButton("Done");
|
||||
jb.setLocation(50, 50);
|
||||
jb.setSize(100, 50);
|
||||
add(jb);
|
||||
}
|
||||
|
||||
public void setCard(final String text) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
setText(text);
|
||||
setCaretPosition(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package mage.client.components.ext;
|
||||
|
||||
/**
|
||||
* @author mw, noxx
|
||||
*/
|
||||
public class MessageDlg {
|
||||
|
||||
MessageDlg() {}
|
||||
|
||||
public enum Types {
|
||||
Info, Warning, Error, FlashInfo
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package mage.client.components.ext;
|
||||
|
||||
import mage.client.components.MageRoundPane;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* @author ayratn
|
||||
*/
|
||||
public class TestMageFloatPane {
|
||||
|
||||
public static void main(String... args) {
|
||||
JFrame f = new JFrame();
|
||||
|
||||
f.setSize(600, 400);
|
||||
f.setVisible(true);
|
||||
|
||||
MageFloatPane fp = new MageFloatPane();
|
||||
fp.setCard("Card");
|
||||
|
||||
MageRoundPane popupContainer = new MageRoundPane();
|
||||
popupContainer.setLayout(null);
|
||||
|
||||
popupContainer.add(fp);
|
||||
//popupContainer.setVisible(false);
|
||||
popupContainer.setBounds(0, 0, 320 + 80, 201 + 80);
|
||||
|
||||
|
||||
JDialog floatOnParent = new JDialog(f, false);
|
||||
floatOnParent.setUndecorated(true);
|
||||
floatOnParent.getContentPane().add(popupContainer);
|
||||
|
||||
floatOnParent.setBounds(300, 100, 300, 200);
|
||||
floatOnParent.setVisible(true);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,217 @@
|
|||
package mage.client.components.ext.dlg;
|
||||
|
||||
import mage.client.components.ext.MessageDlg;
|
||||
import mage.client.components.ext.dlg.impl.StackDialog;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
/**
|
||||
* @author mw, noxx
|
||||
*/
|
||||
public class DialogContainer extends JPanel {
|
||||
|
||||
private static int X_OFFSET = 30;
|
||||
private static int Y_OFFSET = 30;
|
||||
private BufferedImage shadow = null;
|
||||
//private DialogManager.MTGDialogs dialogType;
|
||||
//private DlgParams params;
|
||||
private Color backgroundColor = new Color(0, 255, 255, 60);
|
||||
private int alpha = 50;
|
||||
|
||||
private boolean isGradient = false;
|
||||
private TexturePaint tp = null;
|
||||
private Image gradient = null;
|
||||
private BufferedImage b;
|
||||
|
||||
private boolean drawContainer = true;
|
||||
private DialogManager.MTGDialogs dialogType;
|
||||
|
||||
public DialogContainer(DialogManager.MTGDialogs dialogType, DlgParams params) {
|
||||
setOpaque(false);
|
||||
this.dialogType = dialogType;
|
||||
|
||||
setLayout(null);
|
||||
drawContainer = true;
|
||||
|
||||
if (dialogType == DialogManager.MTGDialogs.MessageDialog) {
|
||||
//backgroundColor = new Color(0, 255, 255, 60);
|
||||
if (params.type.equals(MessageDlg.Types.Warning)) {
|
||||
backgroundColor = new Color(255, 0, 0, 90);
|
||||
} else {
|
||||
backgroundColor = new Color(0, 0, 0, 90);
|
||||
}
|
||||
alpha = 0;
|
||||
//MessageDlg dlg = new MessageDlg(params);
|
||||
//add(dlg);
|
||||
//dlg.setLocation(X_OFFSET + 10, Y_OFFSET);
|
||||
//dlg.updateSize(params.rect.width, params.rect.height);
|
||||
} else if (dialogType == DialogManager.MTGDialogs.StackDialog) {
|
||||
//backgroundColor = new Color(0, 255, 255, 60);
|
||||
backgroundColor = new Color(0, 0, 0, 50);
|
||||
alpha = 0;
|
||||
StackDialog dlg = new StackDialog(params);
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
//int width = Math.min(params.rect.width - 80, 600);
|
||||
int width = params.rect.width;
|
||||
int height = params.rect.height - 80;
|
||||
dlg.updateSize(width, height);
|
||||
}
|
||||
/*
|
||||
else if (dialogType == DialogManager.MTGDialogs.CombatDialog) {
|
||||
backgroundColor = new Color(0, 0, 0, 60);
|
||||
alpha = 0;
|
||||
CombatDialog dlg = new CombatDialog(params);
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
|
||||
} else if (dialogType == DialogManager.MTGDialogs.ChoiceDialog) {
|
||||
|
||||
//backgroundColor = new Color(200, 200, 172, 120);
|
||||
//backgroundColor = new Color(180, 150, 200, 120);
|
||||
//backgroundColor = new Color(0, 255, 0, 60);
|
||||
|
||||
//latest:
|
||||
backgroundColor = new Color(139, 46, 173, 20);
|
||||
//backgroundColor = new Color(139, 46, 173, 0);
|
||||
|
||||
alpha = 0;
|
||||
ChoiceDialog dlg = new ChoiceDialog(params);
|
||||
add(dlg);
|
||||
GameManager.getManager().setCurrentChoiceDlg(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
|
||||
} else if (dialogType == DialogManager.MTGDialogs.GraveDialog) {
|
||||
backgroundColor = new Color(20, 20, 20, 120);
|
||||
alpha = 0;
|
||||
GraveDialog dlg = new GraveDialog(params);
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
|
||||
} else if (dialogType == DialogManager.MTGDialogs.RevealDialog) {
|
||||
backgroundColor = new Color(90, 135, 190, 80);
|
||||
alpha = 0;
|
||||
RevealDialog dlg = new RevealDialog(params);
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
|
||||
} else if (dialogType == DialogManager.MTGDialogs.AssignDamageDialog) {
|
||||
backgroundColor = new Color(255, 255, 255, 130);
|
||||
alpha = 0;
|
||||
AssignDamageDialog dlg = new AssignDamageDialog(params);
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
} else if (dialogType == DialogManager.MTGDialogs.ManaChoiceDialog) {
|
||||
backgroundColor = new Color(0, 255, 255, 60);
|
||||
alpha = 20;
|
||||
ManaChoiceDialog dlg = new ManaChoiceDialog(params);
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
dlg.updateSize(params.rect.width - 80, params.rect.height - 80);
|
||||
|
||||
//isGradient = true;
|
||||
gradient = ImageManager.getGradientImage();
|
||||
if (gradient != null) {
|
||||
b = ImageToBufferedImage.toBufferedImage(gradient);
|
||||
b = Transparency.makeImageTranslucent(b, 0.35);
|
||||
Rectangle2D tr = new Rectangle2D.Double(0, 0, params.rect.width, params.rect.height);
|
||||
//gradient = gradient.getScaledInstance(w, h, Image.SCALE_SMOOTH);
|
||||
tp = new TexturePaint(b, tr);
|
||||
}
|
||||
} else if (dialogType == DialogManager.MTGDialogs.ChooseDeckDialog) {
|
||||
MWDeckPanel deckPanel = new MWDeckPanel(params.getDeckList(), params.isAI);
|
||||
deckPanel.setVisible(true);
|
||||
deckPanel.setBounds(0,0,480,320);
|
||||
add(deckPanel);
|
||||
drawContainer = false;
|
||||
} else if (dialogType == DialogManager.MTGDialogs.ChooseCommonDialog) {
|
||||
MWChoosePanel choosePanel = new MWChoosePanel(params.getObjectList(), params.getTitle());
|
||||
choosePanel.setVisible(true);
|
||||
choosePanel.setBounds(0,0,440,240);
|
||||
add(choosePanel);
|
||||
drawContainer = false;
|
||||
} else if (dialogType == DialogManager.MTGDialogs.AboutDialog) {
|
||||
backgroundColor = new Color(255, 255, 255, 120);
|
||||
alpha = 0;
|
||||
AboutDialog dlg = new AboutDialog();
|
||||
add(dlg);
|
||||
dlg.setLocation(X_OFFSET + 10, Y_OFFSET + 10);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
|
||||
if (!drawContainer) {
|
||||
return;
|
||||
}
|
||||
|
||||
int x = X_OFFSET;
|
||||
int y = Y_OFFSET;
|
||||
int w = getWidth() - 2 * X_OFFSET;
|
||||
int h = getHeight() - 2 * Y_OFFSET;
|
||||
int arc = 30;
|
||||
|
||||
Graphics2D g2 = (Graphics2D) g.create();
|
||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
|
||||
if (shadow != null) {
|
||||
int xOffset = (shadow.getWidth() - w) / 2;
|
||||
int yOffset = (shadow.getHeight() - h) / 2;
|
||||
g2.drawImage(shadow, x - xOffset, y - yOffset, null);
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////
|
||||
// fill content
|
||||
|
||||
/**
|
||||
* Add white translucent substrate
|
||||
*/
|
||||
if (alpha != 0) {
|
||||
g2.setColor(new Color(255, 255, 255, alpha));
|
||||
g2.fillRoundRect(x, y, w, h, arc, arc);
|
||||
}
|
||||
|
||||
if (!isGradient) {
|
||||
g2.setColor(backgroundColor);
|
||||
g2.fillRoundRect(x, y, w, h, arc, arc);
|
||||
} else {
|
||||
RoundRectangle2D r = new RoundRectangle2D.Float(x, y, w, h, arc, arc);
|
||||
g2.setPaint(tp);
|
||||
g2.fill(r);
|
||||
}
|
||||
// ////////////////////////////////////////////////////////////////
|
||||
|
||||
// ////////////////////////////////////////////////////////////////
|
||||
// draw border
|
||||
g2.setStroke(new BasicStroke(3f));
|
||||
g2.setColor(Color.BLACK);
|
||||
//g2.setColor(Color.GRAY);
|
||||
g2.drawRoundRect(x, y, w, h, arc, arc);
|
||||
// ////////////////////////////////////////////////////////////////
|
||||
|
||||
g2.dispose();
|
||||
}
|
||||
|
||||
public void showDialog(boolean bShow) {
|
||||
setVisible(bShow);
|
||||
}
|
||||
|
||||
public DialogManager.MTGDialogs getType() {
|
||||
return this.dialogType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default UID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,230 @@
|
|||
package mage.client.components.ext.dlg;
|
||||
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.game.FeedbackPanel;
|
||||
import mage.view.CardsView;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author mw, noxx
|
||||
*/
|
||||
public class DialogManager extends JComponent implements MouseListener,
|
||||
MouseMotionListener {
|
||||
|
||||
private static DialogManager dialogManager = null;
|
||||
//private static final Logger log = Logger.getLogger(DialogManager.class);
|
||||
|
||||
public static DialogManager getManager() {
|
||||
if (dialogManager == null) {
|
||||
dialogManager = new DialogManager();
|
||||
dialogManager.setVisible(true);
|
||||
}
|
||||
return dialogManager;
|
||||
}
|
||||
|
||||
public enum MTGDialogs {
|
||||
none, AboutDialog, MessageDialog, StackDialog, AssignDamageDialog, ManaChoiceDialog, ChoiceDialog, GraveDialog, DialogContainer, CombatDialog,
|
||||
ChooseDeckDialog, ChooseCommonDialog, RevealDialog
|
||||
}
|
||||
|
||||
private MTGDialogs currentDialog = MTGDialogs.none;
|
||||
|
||||
private DialogContainer dialogContainer = null;
|
||||
|
||||
private int screen_width = 0;
|
||||
private int screen_height = 0;
|
||||
|
||||
// /////////////////////////////// *** for drag and drop ***
|
||||
// /////////////////////////////////
|
||||
private boolean bDragged = false;
|
||||
private int dx, dy;
|
||||
private int mx, my;
|
||||
private Rectangle rec, oldRec;
|
||||
private JComponent j;
|
||||
|
||||
public DialogManager() {
|
||||
addMouseListener(this);
|
||||
addMouseMotionListener(this);
|
||||
//addMouseWheelListener(this);
|
||||
}
|
||||
|
||||
public void setScreenWidth(int screen_width) {
|
||||
this.screen_width = screen_width;
|
||||
}
|
||||
|
||||
public void setScreenHeight(int screen_height) {
|
||||
this.screen_height = screen_height;
|
||||
}
|
||||
|
||||
public void showStackDialog(CardsView cards, BigCard bigCard, FeedbackPanel feedbackPanel, UUID gameId) {
|
||||
|
||||
int w = (int) (screen_width * 0.7);
|
||||
//int h = (int) (screen_height * 0.5);
|
||||
int h = 360;
|
||||
|
||||
/*if (h < 200) {
|
||||
h = 200;
|
||||
}*/
|
||||
|
||||
if (w > 800) {
|
||||
w = 800;
|
||||
}
|
||||
|
||||
int height = getHeight();
|
||||
int width = getWidth();
|
||||
|
||||
int x = ((width - w) / 2);
|
||||
int y = ((height - h) / 2);
|
||||
|
||||
DlgParams params = new DlgParams();
|
||||
params.rect = new Rectangle(x, y, w, h);
|
||||
params.bigCard = bigCard;
|
||||
params.gameId = gameId;
|
||||
params.feedbackPanel = feedbackPanel;
|
||||
params.setCards(cards);
|
||||
dialogContainer = new DialogContainer(MTGDialogs.StackDialog, params);
|
||||
dialogContainer.setVisible(true);
|
||||
add(dialogContainer);
|
||||
|
||||
this.currentDialog = MTGDialogs.DialogContainer;
|
||||
|
||||
setDlgBounds(new Rectangle(x, y, w, h));
|
||||
|
||||
dialogContainer.showDialog(true);
|
||||
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
public void setDlgBounds(Rectangle r) {
|
||||
if (currentDialog == MTGDialogs.DialogContainer) {
|
||||
dialogContainer.setBounds(r.x, r.y, r.width, r.height);
|
||||
}
|
||||
}
|
||||
|
||||
public void fadeOut() {
|
||||
|
||||
if (dialogContainer != null) {
|
||||
dialogContainer.showDialog(false);
|
||||
removeAll();
|
||||
}
|
||||
|
||||
this.currentDialog = MTGDialogs.none;
|
||||
|
||||
setVisible(false);
|
||||
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void fadeOut(DialogContainer dc) {
|
||||
//log.debug("start:fadeOut:"+dc.toString());
|
||||
|
||||
dc.showDialog(false);
|
||||
remove(dc);
|
||||
|
||||
Component[] components = getComponents();
|
||||
boolean bFound = false;
|
||||
for (int i = 0; i < components.length; i++) {
|
||||
if (components[i] instanceof DialogContainer) {
|
||||
bFound = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bFound) {
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
//revalidate();
|
||||
validate();
|
||||
}
|
||||
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
if (bDragged == true) {
|
||||
dx = e.getX() - mx;
|
||||
dy = e.getY() - my;
|
||||
|
||||
rec.x += dx;
|
||||
rec.y += dy;
|
||||
mx = e.getX();
|
||||
my = e.getY();
|
||||
if (oldRec == null) {
|
||||
oldRec = new Rectangle(rec);
|
||||
}
|
||||
int i = Math.abs(oldRec.x - rec.x) + Math.abs(oldRec.y - rec.y);
|
||||
if (i > 3) {
|
||||
oldRec = new Rectangle(rec);
|
||||
j.setBounds(oldRec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (e.getButton() == MouseEvent.BUTTON1) {
|
||||
j = (JComponent) getComponentAt(e.getX(), e.getY());
|
||||
|
||||
if (j != null && j instanceof DialogContainer) {
|
||||
rec = j.getBounds();
|
||||
bDragged = true;
|
||||
mx = e.getX();
|
||||
my = e.getY();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
bDragged = false;
|
||||
if (j instanceof DialogManager) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (j != null && rec != null) {
|
||||
j.setBounds(rec);
|
||||
}
|
||||
oldRec = null;
|
||||
if (rec == null)
|
||||
return;
|
||||
if (rec.x < 0) {
|
||||
rec.x = 0;
|
||||
if (j != null)
|
||||
j.setBounds(rec);
|
||||
}
|
||||
if (rec.y < 0) {
|
||||
rec.y = 0;
|
||||
if (j != null)
|
||||
j.setBounds(rec);
|
||||
}
|
||||
j = null;
|
||||
}
|
||||
|
||||
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||
int notches = e.getWheelRotation();
|
||||
System.out.println("outx:"+notches);
|
||||
if (currentDialog != null && currentDialog.equals(MTGDialogs.ChooseCommonDialog)) {
|
||||
System.out.println("out:"+1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Default UID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
package mage.client.components.ext.dlg;
|
||||
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.components.ext.MessageDlg;
|
||||
import mage.client.game.FeedbackPanel;
|
||||
import mage.view.CardsView;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Class is used to save parameters and to send them to dialog.
|
||||
*
|
||||
* @author mw, noxx
|
||||
*/
|
||||
public class DlgParams {
|
||||
|
||||
public Rectangle rect;
|
||||
public MessageDlg.Types type;
|
||||
public BigCard bigCard;
|
||||
public FeedbackPanel feedbackPanel;
|
||||
public UUID gameId;
|
||||
|
||||
private int playerID;
|
||||
|
||||
private CardsView cards;
|
||||
private ArrayList<String> stringList;
|
||||
//private ArrayList<DeckInfo> deckList;
|
||||
private ArrayList<Object> objectList;
|
||||
|
||||
private String title;
|
||||
private int opponentID;
|
||||
boolean isOptional = false;
|
||||
boolean isChooseAbility = false;
|
||||
boolean isCancelStopsPlaying = true;
|
||||
|
||||
boolean isAI = false;
|
||||
|
||||
public HashSet<String> manaChoices = new HashSet<String>();
|
||||
|
||||
public int getPlayerID() {
|
||||
return playerID;
|
||||
}
|
||||
|
||||
public void setPlayerID(int playerID) {
|
||||
this.playerID = playerID;
|
||||
}
|
||||
|
||||
public int getOpponentID() {
|
||||
return opponentID;
|
||||
}
|
||||
|
||||
public void setOpponentID(int opponentID) {
|
||||
this.opponentID = opponentID;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
private String message;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public HashSet<String> getManaChoices() {
|
||||
return manaChoices;
|
||||
}
|
||||
|
||||
public void setManaChoices(HashSet<String> manaChoices) {
|
||||
this.manaChoices = manaChoices;
|
||||
}
|
||||
|
||||
public boolean isOptional() {
|
||||
return isOptional;
|
||||
}
|
||||
|
||||
public void setOptional(boolean isOptional) {
|
||||
this.isOptional = isOptional;
|
||||
}
|
||||
|
||||
public boolean isChooseAbility() {
|
||||
return isChooseAbility;
|
||||
}
|
||||
|
||||
public void setChooseAbility(boolean isChooseAbility) {
|
||||
this.isChooseAbility = isChooseAbility;
|
||||
}
|
||||
|
||||
public ArrayList<String> getStringList() {
|
||||
return stringList;
|
||||
}
|
||||
|
||||
public void setStringList(ArrayList<String> stringList) {
|
||||
this.stringList = stringList;
|
||||
}
|
||||
|
||||
/*public ArrayList<DeckInfo> getDeckList() {
|
||||
return deckList;
|
||||
}
|
||||
|
||||
public void setDeckList(ArrayList<DeckInfo> deckList) {
|
||||
this.deckList = deckList;
|
||||
}*/
|
||||
|
||||
public ArrayList<Object> getObjectList() {
|
||||
return objectList;
|
||||
}
|
||||
|
||||
public void setObjectList(ArrayList<Object> objectList) {
|
||||
this.objectList = objectList;
|
||||
}
|
||||
|
||||
public boolean isAI() {
|
||||
return isAI;
|
||||
}
|
||||
|
||||
public void setAI(boolean isAI) {
|
||||
this.isAI = isAI;
|
||||
}
|
||||
|
||||
public boolean isCancelStopsPlaying() {
|
||||
return isCancelStopsPlaying;
|
||||
}
|
||||
|
||||
public void setCancelStopsPlaying(boolean isCancelStopsPlaying) {
|
||||
this.isCancelStopsPlaying = isCancelStopsPlaying;
|
||||
}
|
||||
|
||||
public CardsView getCards() {
|
||||
return cards;
|
||||
}
|
||||
|
||||
public void setCards(CardsView cards) {
|
||||
this.cards = cards;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package mage.client.components.ext.dlg;
|
||||
|
||||
import mage.client.components.ImageButton;
|
||||
import org.jdesktop.swingx.JXPanel;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author mw, noxx
|
||||
*/
|
||||
abstract public class IDialogPanel extends JXPanel {
|
||||
|
||||
private DlgParams params;
|
||||
|
||||
public DlgParams getDlgParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setDlgParams(DlgParams params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public IDialogPanel(DlgParams params) {
|
||||
super();
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
protected void updateSize(int newWidth, int newHeight) {
|
||||
|
||||
Rectangle r0 = getBounds();
|
||||
|
||||
r0.width = newWidth;
|
||||
r0.height = newHeight;
|
||||
|
||||
setBounds(r0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make inner component transparent.
|
||||
*/
|
||||
protected void makeTransparent() {
|
||||
|
||||
setOpaque(false);
|
||||
|
||||
for (int i = 0; i < getComponentCount(); i++) {
|
||||
Component c = getComponent(i);
|
||||
if (c instanceof AbstractButton && !(c instanceof JButton)) {
|
||||
((AbstractButton) c).setContentAreaFilled(false);
|
||||
} else if (c instanceof ImageButton) {
|
||||
((AbstractButton) c).setContentAreaFilled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void makeTransparent(JLayeredPane jLayeredPane) {
|
||||
|
||||
setOpaque(false);
|
||||
|
||||
for (int i = 0; i < getComponentCount(); i++) {
|
||||
Component c = jLayeredPane.getComponent(i);
|
||||
if (c instanceof AbstractButton && !(c instanceof JButton)) {
|
||||
((AbstractButton) c).setContentAreaFilled(false);
|
||||
} else if (c instanceof ImageButton) {
|
||||
((AbstractButton) c).setContentAreaFilled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Default UID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,188 @@
|
|||
package mage.client.components.ext.dlg.impl;
|
||||
|
||||
import mage.cards.MageCard;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.components.HoverButton;
|
||||
import mage.client.components.ext.dlg.DialogContainer;
|
||||
import mage.client.components.ext.dlg.DialogManager;
|
||||
import mage.client.components.ext.dlg.DlgParams;
|
||||
import mage.client.components.ext.dlg.IDialogPanel;
|
||||
import mage.client.game.FeedbackPanel;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.Command;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.SettingsManager;
|
||||
import mage.view.CardView;
|
||||
import mage.view.CardsView;
|
||||
import mage.view.StackAbilityView;
|
||||
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author mw, noxx
|
||||
*/
|
||||
public class StackDialog extends IDialogPanel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private JLabel jTitle = null;
|
||||
private JLabel jTitle2 = null;
|
||||
private HoverButton jButtonAccept = null;
|
||||
private HoverButton jButtonResponse = null;
|
||||
|
||||
private JLayeredPane jLayeredPane;
|
||||
private FeedbackPanel feedbackPanel;
|
||||
|
||||
private class CustomLabel extends JLabel {
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
Graphics2D g2D = (Graphics2D)g;
|
||||
g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
|
||||
g2D.setColor(Color.black);
|
||||
g2D.drawString(getText(), 1, 11);
|
||||
g2D.setColor(Color.white);
|
||||
g2D.drawString(getText(), 0, 10);
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
};
|
||||
|
||||
/**
|
||||
* This is the default constructor
|
||||
*/
|
||||
public StackDialog(DlgParams params) {
|
||||
super(params);
|
||||
this.feedbackPanel = params.feedbackPanel;
|
||||
initialize();
|
||||
displayStack(params.getCards(), params.gameId, params.bigCard);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes this
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private void initialize() {
|
||||
|
||||
int w = getDlgParams().rect.width;
|
||||
int h = getDlgParams().rect.height;
|
||||
|
||||
jLayeredPane = new JLayeredPane();
|
||||
add(jLayeredPane);
|
||||
jLayeredPane.setSize(w, h);
|
||||
jLayeredPane.setVisible(true);
|
||||
jLayeredPane.setOpaque(false);
|
||||
|
||||
jTitle = new CustomLabel();
|
||||
jTitle.setBounds(new Rectangle(5, 3, w, 16));
|
||||
jTitle.setFont(new Font("Dialog", Font.BOLD, 14));
|
||||
jTitle.setText("Current stack: ");
|
||||
|
||||
/*jTitle2 = new CustomLabel();
|
||||
jTitle2.setBounds(new Rectangle(5, 5 + SettingsManager.getInstance().getCardSize().height + 30, 129, 20));
|
||||
jTitle2.setFont(new Font("Dialog", Font.BOLD, 14));
|
||||
jTitle2.setText("Spell targets:");*/
|
||||
|
||||
this.setLayout(null);
|
||||
jLayeredPane.setLayout(null);
|
||||
|
||||
jLayeredPane.add(jTitle, null);
|
||||
//jLayeredPane.add(jTitle2, null);
|
||||
jLayeredPane.add(getJButtonAccept(), null);
|
||||
jLayeredPane.add(getJButtonResponse(), null);
|
||||
|
||||
makeTransparent(jLayeredPane);
|
||||
}
|
||||
|
||||
private void displayStack(CardsView cards, UUID gameId, BigCard bigCard) {
|
||||
|
||||
if (cards == null || cards.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display spells and theis targets above them
|
||||
*/
|
||||
int dx = (SettingsManager.getInstance().getCardSize().width + 15) * (cards.size() - 1);
|
||||
int dy = 30;
|
||||
|
||||
for (CardView card : cards.values()) {
|
||||
|
||||
if (card instanceof StackAbilityView) {
|
||||
CardView tmp = ((StackAbilityView)card).getSourceCard();
|
||||
tmp.overrideRules(card.getRules());
|
||||
tmp.setIsAbility(true);
|
||||
tmp.overrideTargets(card.getTargets());
|
||||
tmp.overrideId(card.getId());
|
||||
card = tmp;
|
||||
}
|
||||
|
||||
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, getCardDimension(), gameId, true);
|
||||
//cardImg.setBorder(BorderFactory.createLineBorder(Color.red));
|
||||
cardImg.setLocation(dx, dy);
|
||||
|
||||
jLayeredPane.add(cardImg, JLayeredPane.DEFAULT_LAYER, 1);
|
||||
|
||||
dx -= (SettingsManager.getInstance().getCardSize().width + 15);
|
||||
}
|
||||
}
|
||||
|
||||
private Dimension getCardDimension() {
|
||||
if (cardDimension == null) {
|
||||
cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
||||
}
|
||||
return cardDimension;
|
||||
}
|
||||
|
||||
private HoverButton getJButtonAccept() {
|
||||
if (jButtonAccept == null) {
|
||||
jButtonAccept = new HoverButton("", ImageManagerImpl.getInstance().getDlgAcceptButtonImage(),
|
||||
ImageManagerImpl.getInstance().getDlgActiveAcceptButtonImage(),
|
||||
ImageManagerImpl.getInstance().getDlgAcceptButtonImage(),
|
||||
new Rectangle(60, 60));
|
||||
int w = getDlgParams().rect.width - 90;
|
||||
int h = getDlgParams().rect.height - 90;
|
||||
jButtonAccept.setBounds(new Rectangle(w / 2 - 80, h - 50, 60, 60));
|
||||
//jButtonAccept.setBorder(BorderFactory.createLineBorder(Color.red));
|
||||
|
||||
jButtonAccept.setObserver(new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
DialogManager.getManager().fadeOut((DialogContainer)getParent());
|
||||
//GameManager.getInputControl().getInput().selectButtonOK();
|
||||
StackDialog.this.feedbackPanel.doClick();
|
||||
}
|
||||
private static final long serialVersionUID = 1L;
|
||||
});
|
||||
}
|
||||
return jButtonAccept;
|
||||
}
|
||||
|
||||
private HoverButton getJButtonResponse() {
|
||||
if (jButtonResponse == null) {
|
||||
jButtonResponse = new HoverButton("", ImageManagerImpl.getInstance().getDlgCancelButtonImage(),
|
||||
ImageManagerImpl.getInstance().getDlgActiveCancelButtonImage(),
|
||||
ImageManagerImpl.getInstance().getDlgCancelButtonImage(),
|
||||
new Rectangle(60, 60));
|
||||
int w = getDlgParams().rect.width - 90;
|
||||
int h = getDlgParams().rect.height - 90;
|
||||
jButtonResponse.setBounds(new Rectangle(w / 2 + 5, h - 48, 60, 60));
|
||||
|
||||
jButtonResponse.setObserver(new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
DialogManager.getManager().fadeOut((DialogContainer)getParent());
|
||||
}
|
||||
private static final long serialVersionUID = 1L;
|
||||
});
|
||||
}
|
||||
return jButtonResponse;
|
||||
}
|
||||
|
||||
private Dimension cardDimension;
|
||||
}
|
|
@ -36,8 +36,10 @@ package mage.client.game;
|
|||
|
||||
import mage.Constants;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.chat.ChatPanel;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.components.ext.dlg.DialogManager;
|
||||
import mage.client.dialog.*;
|
||||
import mage.client.game.FeedbackPanel.FeedbackMode;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
|
@ -85,6 +87,8 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
private JLayeredPane jLayeredPane;
|
||||
private String chosenHandKey = "You";
|
||||
private boolean smallMode = false;
|
||||
|
||||
private int cachedStackSize;
|
||||
|
||||
/** Creates new form GamePanel */
|
||||
public GamePanel() {
|
||||
|
@ -204,6 +208,10 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
DialogManager.getManager().setScreenWidth(rect.width);
|
||||
DialogManager.getManager().setScreenHeight(rect.height);
|
||||
DialogManager.getManager().setBounds(0, 0, rect.width, rect.height);
|
||||
}
|
||||
|
||||
public synchronized void showGame(UUID gameId, UUID playerId) {
|
||||
|
@ -399,6 +407,7 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
|
||||
this.stack.loadCards(game.getStack(), bigCard, gameId, null);
|
||||
GameManager.getInstance().setStackSize(game.getStack().size());
|
||||
displayStack(game, bigCard, feedbackPanel, gameId);
|
||||
|
||||
for (ExileView exile: game.getExile()) {
|
||||
if (!exiles.containsKey(exile.getId())) {
|
||||
|
@ -421,6 +430,30 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
this.repaint();
|
||||
}
|
||||
|
||||
private void displayStack(GameView game, BigCard bigCard, FeedbackPanel feedbackPanel, UUID gameId) {
|
||||
if (game.getStack().size() > 0) {
|
||||
if (game.getStack().size() != cachedStackSize) {
|
||||
boolean allPaid = true;
|
||||
for (CardView cardView : game.getStack().values()) {
|
||||
if (!cardView.isPaid()) {
|
||||
allPaid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allPaid) {
|
||||
DialogManager.getManager().fadeOut();
|
||||
cachedStackSize = game.getStack().size();
|
||||
DialogManager.getManager().showStackDialog(game.getStack(), bigCard, feedbackPanel, gameId);
|
||||
}
|
||||
} else {
|
||||
// do nothing
|
||||
}
|
||||
} else {
|
||||
cachedStackSize = game.getStack().size();
|
||||
DialogManager.getManager().fadeOut();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update phase buttons\labels.
|
||||
*/
|
||||
|
@ -946,6 +979,7 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
public void installComponents() {
|
||||
jLayeredPane.setOpaque(false);
|
||||
jLayeredPane.add(abilityPicker);
|
||||
jLayeredPane.add(DialogManager.getManager(), JLayeredPane.MODAL_LAYER, 0);
|
||||
abilityPicker.setVisible(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package mage.client.util;
|
||||
|
||||
|
||||
import org.mage.card.arcane.CardPanel;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
|
@ -36,6 +38,10 @@ public class SettingsManager {
|
|||
this.screenHeight = screenHeight;
|
||||
}
|
||||
|
||||
public Rectangle getCardSize() {
|
||||
return cardSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get centered component position. Depends on screen width and height.
|
||||
*
|
||||
|
@ -63,4 +69,5 @@ public class SettingsManager {
|
|||
private int screenWidth;
|
||||
private int screenHeight;
|
||||
|
||||
private Rectangle cardSize = CardPanel.CARD_SIZE_FULL;
|
||||
}
|
||||
|
|
|
@ -6,4 +6,9 @@ public interface ImageManager {
|
|||
public Image getSicknessImage();
|
||||
public Image getDayImage();
|
||||
public Image getNightImage();
|
||||
|
||||
public Image getDlgAcceptButtonImage();
|
||||
public Image getDlgActiveAcceptButtonImage();
|
||||
public Image getDlgCancelButtonImage();
|
||||
public Image getDlgActiveCancelButtonImage();
|
||||
}
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
package org.mage.plugins.card.utils.impl;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.CropImageFilter;
|
||||
import java.awt.image.FilteredImageSource;
|
||||
import java.net.URL;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import mage.client.util.gui.BufferedImageBuilder;
|
||||
import org.mage.plugins.card.utils.ImageManager;
|
||||
import org.mage.plugins.card.utils.Transparency;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.CropImageFilter;
|
||||
import java.awt.image.FilteredImageSource;
|
||||
import java.net.URL;
|
||||
|
||||
public class ImageManagerImpl implements ImageManager {
|
||||
|
||||
private static ImageManagerImpl fInstance = new ImageManagerImpl();
|
||||
|
@ -52,7 +48,39 @@ public class ImageManagerImpl implements ImageManager {
|
|||
return imageNight;
|
||||
}
|
||||
|
||||
protected static Image getImageFromResourceTransparent(String path, Color mask, Rectangle rec) {
|
||||
@Override
|
||||
public Image getDlgCancelButtonImage() {
|
||||
if (imageDlgCancelButton == null) {
|
||||
imageDlgCancelButton = getBufferedImageFromResource("/dlg/dlg.cancel.png");
|
||||
}
|
||||
return imageDlgCancelButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getDlgActiveCancelButtonImage() {
|
||||
if (imageDlgActiveCancelButton == null) {
|
||||
imageDlgActiveCancelButton = getBufferedImageFromResource("/dlg/dlg.cancel.hover.png");
|
||||
}
|
||||
return imageDlgActiveCancelButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getDlgAcceptButtonImage() {
|
||||
if (imageDlgAcceptButton == null) {
|
||||
imageDlgAcceptButton = getBufferedImageFromResource("/dlg/dlg.ok.png");
|
||||
}
|
||||
return imageDlgAcceptButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getDlgActiveAcceptButtonImage() {
|
||||
if (imageDlgActiveAcceptButton == null) {
|
||||
imageDlgActiveAcceptButton = getBufferedImageFromResource("/dlg/dlg.ok.hover.png");
|
||||
}
|
||||
return imageDlgActiveAcceptButton;
|
||||
}
|
||||
|
||||
protected static Image getImageFromResourceTransparent(String path, Color mask, Rectangle rec) {
|
||||
BufferedImage image = null;
|
||||
Image imageCardTransparent = null;
|
||||
Image resized = null;
|
||||
|
@ -71,7 +99,25 @@ public class ImageManagerImpl implements ImageManager {
|
|||
return resized;
|
||||
}
|
||||
|
||||
private static BufferedImage imageSickness = null;
|
||||
private static BufferedImage imageDay = null;
|
||||
private static BufferedImage imageNight = null;
|
||||
protected static BufferedImage getBufferedImageFromResource(String path) {
|
||||
URL imageURL = ImageManager.class.getResource(path);
|
||||
BufferedImage image = null;
|
||||
|
||||
try {
|
||||
image = ImageIO.read(imageURL);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
private static BufferedImage imageSickness;
|
||||
private static BufferedImage imageDay;
|
||||
private static BufferedImage imageNight;
|
||||
|
||||
private static BufferedImage imageDlgAcceptButton;
|
||||
private static BufferedImage imageDlgActiveAcceptButton;
|
||||
private static BufferedImage imageDlgCancelButton;
|
||||
private static BufferedImage imageDlgActiveCancelButton;
|
||||
}
|
||||
|
|
BIN
Mage.Client/src/main/resources/dlg/dlg.cancel.hover.png
Normal file
After Width: | Height: | Size: 8.1 KiB |
BIN
Mage.Client/src/main/resources/dlg/dlg.cancel.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
Mage.Client/src/main/resources/dlg/dlg.next.hover.png
Normal file
After Width: | Height: | Size: 7 KiB |
BIN
Mage.Client/src/main/resources/dlg/dlg.next.png
Normal file
After Width: | Height: | Size: 6 KiB |
BIN
Mage.Client/src/main/resources/dlg/dlg.ok.hover.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
Mage.Client/src/main/resources/dlg/dlg.ok.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
Mage.Client/src/main/resources/dlg/dlg.prev.hover.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
Mage.Client/src/main/resources/dlg/dlg.prev.png
Normal file
After Width: | Height: | Size: 6 KiB |
|
@ -77,6 +77,7 @@ public class CardView extends SimpleCardView {
|
|||
protected List<UUID> targets;
|
||||
|
||||
protected UUID pairedCard;
|
||||
protected boolean paid;
|
||||
|
||||
public CardView(Card card, UUID cardId) {
|
||||
this(card);
|
||||
|
@ -389,4 +390,12 @@ public class CardView extends SimpleCardView {
|
|||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean isPaid() {
|
||||
return paid;
|
||||
}
|
||||
|
||||
public void setPaid(boolean paid) {
|
||||
this.paid = paid;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import mage.Constants;
|
|||
import mage.Constants.PhaseStep;
|
||||
import mage.Constants.TurnPhase;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.cards.Card;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
|
@ -90,6 +91,7 @@ public class GameView implements Serializable {
|
|||
if (card.canTransform()) {
|
||||
updateLatestCardView(game, card, stackObject.getId());
|
||||
}
|
||||
checkPaid(stackObject.getId(), (StackAbility)stackObject);
|
||||
} else if (object != null) {
|
||||
StackAbility stackAbility = ((StackAbility)object);
|
||||
stackAbility.newId();
|
||||
|
@ -103,10 +105,12 @@ public class GameView implements Serializable {
|
|||
}
|
||||
|
||||
stack.put(stackObject.getId(), new CardView(stackAbility));
|
||||
checkPaid(stackObject.getId(), stackAbility);
|
||||
}
|
||||
}
|
||||
else {
|
||||
stack.put(stackObject.getId(), new CardView((Spell)stackObject));
|
||||
checkPaid(stackObject.getId(), (Spell)stackObject);
|
||||
}
|
||||
//stackOrder.add(stackObject.getId());
|
||||
}
|
||||
|
@ -134,6 +138,31 @@ public class GameView implements Serializable {
|
|||
this.special = state.getSpecialActions().getControlledBy(state.getPriorityPlayerId()).size() > 0;
|
||||
}
|
||||
|
||||
private void checkPaid(UUID uuid, StackAbility stackAbility) {
|
||||
for (Cost cost : stackAbility.getManaCostsToPay()) {
|
||||
if (!cost.isPaid()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
CardView cardView = stack.get(uuid);
|
||||
cardView.paid = true;
|
||||
}
|
||||
|
||||
private void checkPaid(UUID uuid, Spell spell) {
|
||||
for (Cost cost : spell.getSpellAbility().getManaCostsToPay()) {
|
||||
if (!cost.isPaid()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
CardView cardView = stack.get(uuid);
|
||||
cardView.paid = true;
|
||||
}
|
||||
|
||||
private void setPaid(UUID uuid) {
|
||||
CardView cardView = stack.get(uuid);
|
||||
cardView.paid = true;
|
||||
}
|
||||
|
||||
private void updateLatestCardView(Game game, Card card, UUID stackId) {
|
||||
if (!card.canTransform()) {
|
||||
return;
|
||||
|
|