forked from External/mage
[refactoring][minor] Replaced all tabs with four spaces.
This commit is contained in:
parent
e646e4768d
commit
239a4fb100
2891 changed files with 79411 additions and 79411 deletions
|
|
@ -47,54 +47,54 @@ import java.util.UUID;
|
|||
*/
|
||||
public class AbilityPicker extends JPopupMenu implements PopupMenuListener {
|
||||
|
||||
private Session session;
|
||||
private UUID gameId;
|
||||
private Session session;
|
||||
private UUID gameId;
|
||||
|
||||
public AbilityPicker() {
|
||||
this.addPopupMenuListener(this);
|
||||
}
|
||||
public AbilityPicker() {
|
||||
this.addPopupMenuListener(this);
|
||||
}
|
||||
|
||||
public void init(Session session, UUID gameId) {
|
||||
this.session = session;
|
||||
this.gameId = gameId;
|
||||
}
|
||||
public void init(Session session, UUID gameId) {
|
||||
this.session = session;
|
||||
this.gameId = gameId;
|
||||
}
|
||||
|
||||
public void show(AbilityPickerView choices, Point p) {
|
||||
if (p == null) return;
|
||||
this.removeAll();
|
||||
for (Entry<UUID, String> choice: choices.getChoices().entrySet()) {
|
||||
this.add(new AbilityPickerAction(choice.getKey(), choice.getValue()));
|
||||
}
|
||||
this.show(MageFrame.getDesktop(), p.x, p.y);
|
||||
GuiDisplayUtil.keepComponentInsideScreen(p.x, p.y, this);
|
||||
}
|
||||
public void show(AbilityPickerView choices, Point p) {
|
||||
if (p == null) return;
|
||||
this.removeAll();
|
||||
for (Entry<UUID, String> choice: choices.getChoices().entrySet()) {
|
||||
this.add(new AbilityPickerAction(choice.getKey(), choice.getValue()));
|
||||
}
|
||||
this.show(MageFrame.getDesktop(), p.x, p.y);
|
||||
GuiDisplayUtil.keepComponentInsideScreen(p.x, p.y, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { }
|
||||
@Override
|
||||
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { }
|
||||
|
||||
@Override
|
||||
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { }
|
||||
@Override
|
||||
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { }
|
||||
|
||||
@Override
|
||||
public void popupMenuCanceled(PopupMenuEvent e) {
|
||||
session.sendPlayerBoolean(gameId, false);
|
||||
}
|
||||
@Override
|
||||
public void popupMenuCanceled(PopupMenuEvent e) {
|
||||
session.sendPlayerBoolean(gameId, false);
|
||||
}
|
||||
|
||||
private class AbilityPickerAction extends AbstractAction {
|
||||
private class AbilityPickerAction extends AbstractAction {
|
||||
|
||||
private UUID id;
|
||||
private UUID id;
|
||||
|
||||
public AbilityPickerAction(UUID id, String choice) {
|
||||
this.id = id;
|
||||
putValue(Action.NAME, choice);
|
||||
}
|
||||
public AbilityPickerAction(UUID id, String choice) {
|
||||
this.id = id;
|
||||
putValue(Action.NAME, choice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
session.sendPlayerUUID(gameId, id);
|
||||
setVisible(false);
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
session.sendPlayerUUID(gameId, id);
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,26 +57,26 @@ import java.util.Map.Entry;
|
|||
*/
|
||||
public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
||||
|
||||
private Map<UUID, MagePermanent> permanents = new HashMap<UUID, MagePermanent>();
|
||||
private UUID gameId;
|
||||
private BigCard bigCard;
|
||||
private Map<String, JComponent> ui = new HashMap<String, JComponent>();
|
||||
private Map<UUID, MagePermanent> permanents = new HashMap<UUID, MagePermanent>();
|
||||
private UUID gameId;
|
||||
private BigCard bigCard;
|
||||
private Map<String, JComponent> ui = new HashMap<String, JComponent>();
|
||||
|
||||
protected Map<UUID, PermanentView> battlefield;
|
||||
private Dimension cardDimension;
|
||||
protected Map<UUID, PermanentView> battlefield;
|
||||
private Dimension cardDimension;
|
||||
|
||||
private JComponent jPanel;
|
||||
private JScrollPane jScrollPane;
|
||||
private int width;
|
||||
|
||||
|
||||
private static int i = 0;
|
||||
|
||||
|
||||
/** Creates new form BattlefieldPanel */
|
||||
public BattlefieldPanel() {
|
||||
ui.put("battlefieldPanel", this);
|
||||
ui.put("battlefieldPanel", this);
|
||||
initComponents();
|
||||
ui.put("jPanel", jPanel);
|
||||
|
||||
|
||||
addComponentListener(new ComponentAdapter() {
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
|
|
@ -89,193 +89,193 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
});
|
||||
}
|
||||
|
||||
public void init(UUID gameId, BigCard bigCard) {
|
||||
this.gameId = gameId;
|
||||
this.bigCard = bigCard;
|
||||
}
|
||||
public void init(UUID gameId, BigCard bigCard) {
|
||||
this.gameId = gameId;
|
||||
this.bigCard = bigCard;
|
||||
}
|
||||
|
||||
public void update(Map<UUID, PermanentView> battlefield) {
|
||||
public void update(Map<UUID, PermanentView> battlefield) {
|
||||
boolean changed = false;
|
||||
|
||||
List<PermanentView> permanentsToAdd = new ArrayList<PermanentView>();
|
||||
for (PermanentView permanent: battlefield.values()) {
|
||||
if (!permanents.containsKey(permanent.getId())) {
|
||||
permanentsToAdd.add(permanent);
|
||||
changed = true;
|
||||
} else {
|
||||
MagePermanent p = permanents.get(permanent.getId());
|
||||
if (!changed) {
|
||||
int s1 = permanent.getAttachments() == null ? 0 : permanent.getAttachments().size();
|
||||
int s2 = p.getLinks().size();
|
||||
if (s1 != s2) {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
permanents.get(permanent.getId()).update(permanent);
|
||||
}
|
||||
}
|
||||
for (PermanentView permanent: battlefield.values()) {
|
||||
if (!permanents.containsKey(permanent.getId())) {
|
||||
permanentsToAdd.add(permanent);
|
||||
changed = true;
|
||||
} else {
|
||||
MagePermanent p = permanents.get(permanent.getId());
|
||||
if (!changed) {
|
||||
int s1 = permanent.getAttachments() == null ? 0 : permanent.getAttachments().size();
|
||||
int s2 = p.getLinks().size();
|
||||
if (s1 != s2) {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
permanents.get(permanent.getId()).update(permanent);
|
||||
}
|
||||
}
|
||||
int count = permanentsToAdd.size();
|
||||
for (PermanentView permanent : permanentsToAdd) {
|
||||
addPermanent(permanent, count);
|
||||
}
|
||||
|
||||
for (Iterator<Entry<UUID, MagePermanent>> i = permanents.entrySet().iterator(); i.hasNext();) {
|
||||
Entry<UUID, MagePermanent> entry = i.next();
|
||||
if (!battlefield.containsKey(entry.getKey())) {
|
||||
removePermanent(entry.getKey(), 1);
|
||||
i.remove();
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
this.battlefield = battlefield;
|
||||
sortLayout();
|
||||
}
|
||||
}
|
||||
for (Iterator<Entry<UUID, MagePermanent>> i = permanents.entrySet().iterator(); i.hasNext();) {
|
||||
Entry<UUID, MagePermanent> entry = i.next();
|
||||
if (!battlefield.containsKey(entry.getKey())) {
|
||||
removePermanent(entry.getKey(), 1);
|
||||
i.remove();
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: review sorting stuff
|
||||
public void sortLayout() {
|
||||
int height = Plugins.getInstance().sortPermanents(ui, permanents.values());
|
||||
if (changed) {
|
||||
this.battlefield = battlefield;
|
||||
sortLayout();
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: review sorting stuff
|
||||
public void sortLayout() {
|
||||
int height = Plugins.getInstance().sortPermanents(ui, permanents.values());
|
||||
BattlefieldPanel.this.jPanel.setPreferredSize(new Dimension(width - 30, height));
|
||||
this.jScrollPane.repaint();
|
||||
this.jScrollPane.revalidate();
|
||||
|
||||
if (battlefield == null) {return;}
|
||||
|
||||
for (PermanentView permanent: battlefield.values()) {
|
||||
if (permanent.getAttachments() != null) {
|
||||
groupAttachments(permanent);
|
||||
}
|
||||
}
|
||||
|
||||
invalidate();
|
||||
repaint();
|
||||
}
|
||||
if (battlefield == null) {return;}
|
||||
|
||||
private void addPermanent(PermanentView permanent, final int count) {
|
||||
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()) {
|
||||
perm.setBounds(findEmptySpace(new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight)));
|
||||
} else {
|
||||
//perm.setAlpha(0);
|
||||
}
|
||||
permanents.put(permanent.getId(), perm);
|
||||
|
||||
BattlefieldPanel.this.jPanel.add(perm, 10);
|
||||
for (PermanentView permanent: battlefield.values()) {
|
||||
if (permanent.getAttachments() != null) {
|
||||
groupAttachments(permanent);
|
||||
}
|
||||
}
|
||||
|
||||
invalidate();
|
||||
repaint();
|
||||
}
|
||||
|
||||
private void addPermanent(PermanentView permanent, final int count) {
|
||||
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()) {
|
||||
perm.setBounds(findEmptySpace(new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight)));
|
||||
} else {
|
||||
//perm.setAlpha(0);
|
||||
}
|
||||
permanents.put(permanent.getId(), perm);
|
||||
|
||||
BattlefieldPanel.this.jPanel.add(perm, 10);
|
||||
//this.jPanel.add(perm);
|
||||
if (!Plugins.getInstance().isCardPluginLoaded()) {
|
||||
moveToFront(perm);
|
||||
perm.update(permanent);
|
||||
} else {
|
||||
if (!Plugins.getInstance().isCardPluginLoaded()) {
|
||||
moveToFront(perm);
|
||||
perm.update(permanent);
|
||||
} else {
|
||||
moveToFront(jPanel);
|
||||
Plugins.getInstance().onAddCard(perm, 1);
|
||||
/*Thread t = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Plugins.getInstance().onAddCard(perm, count);
|
||||
}
|
||||
});
|
||||
synchronized (this) {
|
||||
threads.add(t);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
private void groupAttachments(PermanentView permanent) {
|
||||
MagePermanent perm = permanents.get(permanent.getId());
|
||||
if (perm == null) return;
|
||||
int position = getPosition(perm);
|
||||
perm.getLinks().clear();
|
||||
Rectangle r = perm.getBounds();
|
||||
if (!Plugins.getInstance().isCardPluginLoaded()) {
|
||||
for (UUID attachmentId: permanent.getAttachments()) {
|
||||
MagePermanent link = permanents.get(attachmentId);
|
||||
if (link != null) {
|
||||
perm.getLinks().add(link);
|
||||
r.translate(20, 20);
|
||||
link.setBounds(r);
|
||||
setPosition(link, ++position);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/*Thread t = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Plugins.getInstance().onAddCard(perm, count);
|
||||
}
|
||||
});
|
||||
synchronized (this) {
|
||||
threads.add(t);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
private void groupAttachments(PermanentView permanent) {
|
||||
MagePermanent perm = permanents.get(permanent.getId());
|
||||
if (perm == null) return;
|
||||
int position = getPosition(perm);
|
||||
perm.getLinks().clear();
|
||||
Rectangle r = perm.getBounds();
|
||||
if (!Plugins.getInstance().isCardPluginLoaded()) {
|
||||
for (UUID attachmentId: permanent.getAttachments()) {
|
||||
MagePermanent link = permanents.get(attachmentId);
|
||||
if (link != null) {
|
||||
perm.getLinks().add(link);
|
||||
r.translate(20, 20);
|
||||
link.setBounds(r);
|
||||
setPosition(link, ++position);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int index = permanent.getAttachments().size();
|
||||
for (UUID attachmentId: permanent.getAttachments()) {
|
||||
MagePermanent link = permanents.get(attachmentId);
|
||||
if (link != null) {
|
||||
link.setBounds(r);
|
||||
perm.getLinks().add(link);
|
||||
r.translate(8, 10);
|
||||
perm.setBounds(r);
|
||||
moveToFront(link);
|
||||
moveToFront(perm);
|
||||
for (UUID attachmentId: permanent.getAttachments()) {
|
||||
MagePermanent link = permanents.get(attachmentId);
|
||||
if (link != null) {
|
||||
link.setBounds(r);
|
||||
perm.getLinks().add(link);
|
||||
r.translate(8, 10);
|
||||
perm.setBounds(r);
|
||||
moveToFront(link);
|
||||
moveToFront(perm);
|
||||
jPanel.setComponentZOrder(link, index);
|
||||
index--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
jPanel.setComponentZOrder(perm, index);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void removePermanent(UUID permanentId, final int count) {
|
||||
}
|
||||
|
||||
private void removePermanent(UUID permanentId, final int count) {
|
||||
for (Component c: this.jPanel.getComponents()) {
|
||||
final Component comp = c;
|
||||
if (comp instanceof Permanent) {
|
||||
if (((Permanent)comp).getPermanentId().equals(permanentId)) {
|
||||
comp.setVisible(false);
|
||||
final Component comp = c;
|
||||
if (comp instanceof Permanent) {
|
||||
if (((Permanent)comp).getPermanentId().equals(permanentId)) {
|
||||
comp.setVisible(false);
|
||||
this.jPanel.remove(comp);
|
||||
}
|
||||
} else if (comp instanceof MagePermanent) {
|
||||
if (((MagePermanent)comp).getOriginal().getId().equals(permanentId)) {
|
||||
Thread t = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Plugins.getInstance().onRemoveCard((MagePermanent)comp, count);
|
||||
} else if (comp instanceof MagePermanent) {
|
||||
if (((MagePermanent)comp).getOriginal().getId().equals(permanentId)) {
|
||||
Thread t = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Plugins.getInstance().onRemoveCard((MagePermanent)comp, count);
|
||||
comp.setVisible(false);
|
||||
BattlefieldPanel.this.jPanel.remove(comp);
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
}
|
||||
}
|
||||
BattlefieldPanel.this.jPanel.remove(comp);
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Rectangle findEmptySpace(Dimension size) {
|
||||
int battlefieldWidth = this.getWidth();
|
||||
Rectangle r = new Rectangle(size);
|
||||
boolean intersects;
|
||||
while (true) {
|
||||
intersects = false;
|
||||
for (MagePermanent perm: permanents.values()) {
|
||||
Rectangle pr = perm.getBounds();
|
||||
if (r.intersects(pr)) {
|
||||
intersects = true;
|
||||
if (pr.x + pr.width + r.width > battlefieldWidth)
|
||||
r.setLocation(0, pr.y + pr.height + 1);
|
||||
else
|
||||
r.translate(pr.x + pr.width - r.x, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!intersects)
|
||||
break;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
private Rectangle findEmptySpace(Dimension size) {
|
||||
int battlefieldWidth = this.getWidth();
|
||||
Rectangle r = new Rectangle(size);
|
||||
boolean intersects;
|
||||
while (true) {
|
||||
intersects = false;
|
||||
for (MagePermanent perm: permanents.values()) {
|
||||
Rectangle pr = perm.getBounds();
|
||||
if (r.intersects(pr)) {
|
||||
intersects = true;
|
||||
if (pr.x + pr.width + r.width > battlefieldWidth)
|
||||
r.setLocation(0, pr.y + pr.height + 1);
|
||||
else
|
||||
r.translate(pr.x + pr.width - r.x, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!intersects)
|
||||
break;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOptimizedDrawingEnabled () {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Map<UUID, MagePermanent> getPermanents() {
|
||||
return permanents;
|
||||
}
|
||||
@Override
|
||||
public boolean isOptimizedDrawingEnabled () {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Map<UUID, MagePermanent> getPermanents() {
|
||||
return permanents;
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
setOpaque(false);
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ import java.util.UUID;
|
|||
*/
|
||||
public class CombatGroup extends javax.swing.JPanel {
|
||||
|
||||
private UUID gameId;
|
||||
private BigCard bigCard;
|
||||
private UUID gameId;
|
||||
private BigCard bigCard;
|
||||
|
||||
/** Creates new form CombatGroup */
|
||||
public CombatGroup() {
|
||||
|
|
@ -55,20 +55,20 @@ public class CombatGroup extends javax.swing.JPanel {
|
|||
attackers.setDontDisplayTapped(true);
|
||||
}
|
||||
|
||||
public void init(UUID gameId, BigCard bigCard) {
|
||||
this.gameId = gameId;
|
||||
this.bigCard = bigCard;
|
||||
}
|
||||
public void init(UUID gameId, BigCard bigCard) {
|
||||
this.gameId = gameId;
|
||||
this.bigCard = bigCard;
|
||||
}
|
||||
|
||||
public void update(CombatGroupView combatGroup) {
|
||||
this.lblDefender.setText(combatGroup.getDefenderName());
|
||||
this.attackers.loadCards(combatGroup.getAttackers(), bigCard, gameId, null);
|
||||
// attackers.setPreferredSize(new Dimension(Config.dimensions.frameWidth + 6, Config.dimensions.frameHeight + 6));
|
||||
this.blockers.loadCards(combatGroup.getBlockers(), bigCard, gameId, null);
|
||||
// blockers.setPreferredSize(new Dimension(Config.dimensions.frameWidth + 6, Config.dimensions.frameHeight + 6));
|
||||
this.attackers.setVisible(true);
|
||||
this.blockers.setVisible(true);
|
||||
}
|
||||
public void update(CombatGroupView combatGroup) {
|
||||
this.lblDefender.setText(combatGroup.getDefenderName());
|
||||
this.attackers.loadCards(combatGroup.getAttackers(), bigCard, gameId, null);
|
||||
// attackers.setPreferredSize(new Dimension(Config.dimensions.frameWidth + 6, Config.dimensions.frameHeight + 6));
|
||||
this.blockers.loadCards(combatGroup.getBlockers(), bigCard, gameId, null);
|
||||
// blockers.setPreferredSize(new Dimension(Config.dimensions.frameWidth + 6, Config.dimensions.frameHeight + 6));
|
||||
this.attackers.setVisible(true);
|
||||
this.blockers.setVisible(true);
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
|
|
|
|||
|
|
@ -56,140 +56,140 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class FeedbackPanel extends javax.swing.JPanel {
|
||||
|
||||
private final static Logger logger = Logger.getLogger(FeedbackPanel.class);
|
||||
private final static Logger logger = Logger.getLogger(FeedbackPanel.class);
|
||||
|
||||
public enum FeedbackMode {
|
||||
INFORM, QUESTION, CONFIRM, CANCEL, SELECT, END
|
||||
}
|
||||
public enum FeedbackMode {
|
||||
INFORM, QUESTION, CONFIRM, CANCEL, SELECT, END
|
||||
}
|
||||
|
||||
private boolean selected = false;
|
||||
private UUID gameId;
|
||||
private Session session;
|
||||
private FeedbackMode mode;
|
||||
private MageDialog connectedDialog;
|
||||
private ChatPanel connectedChatPanel;
|
||||
private boolean selected = false;
|
||||
private UUID gameId;
|
||||
private Session session;
|
||||
private FeedbackMode mode;
|
||||
private MageDialog connectedDialog;
|
||||
private ChatPanel connectedChatPanel;
|
||||
|
||||
/** Creates new form FeedbackPanel */
|
||||
public FeedbackPanel() {
|
||||
//initComponents();
|
||||
customInitComponents();
|
||||
}
|
||||
/** Creates new form FeedbackPanel */
|
||||
public FeedbackPanel() {
|
||||
//initComponents();
|
||||
customInitComponents();
|
||||
}
|
||||
|
||||
public void init(UUID gameId) {
|
||||
this.gameId = gameId;
|
||||
session = MageFrame.getSession();
|
||||
}
|
||||
public void init(UUID gameId) {
|
||||
this.gameId = gameId;
|
||||
session = MageFrame.getSession();
|
||||
}
|
||||
|
||||
public void getFeedback(FeedbackMode mode, String message, boolean special, Map<String, Serializable> options) {
|
||||
logger.info("text: " + message);
|
||||
this.lblMessage.setText(message);
|
||||
this.selected = false;
|
||||
this.mode = mode;
|
||||
switch (this.mode) {
|
||||
case INFORM:
|
||||
this.btnLeft.setVisible(false);
|
||||
this.btnRight.setVisible(false);
|
||||
this.helper.setState("", false, "", false);
|
||||
break;
|
||||
case QUESTION:
|
||||
this.btnLeft.setVisible(true);
|
||||
this.btnLeft.setText("Yes");
|
||||
this.btnRight.setVisible(true);
|
||||
this.btnRight.setText("No");
|
||||
this.helper.setState("Yes", true, "Yes", true);
|
||||
break;
|
||||
case CONFIRM:
|
||||
this.btnLeft.setVisible(true);
|
||||
this.btnLeft.setText("OK");
|
||||
this.btnRight.setVisible(true);
|
||||
this.btnRight.setText("Cancel");
|
||||
this.helper.setState("Ok", true, "Cancel", true);
|
||||
break;
|
||||
case CANCEL:
|
||||
this.btnLeft.setVisible(false);
|
||||
this.btnRight.setVisible(true);
|
||||
this.btnRight.setText("Cancel");
|
||||
this.helper.setState("", false, "Cancel", true);
|
||||
break;
|
||||
case SELECT:
|
||||
this.btnLeft.setVisible(false);
|
||||
this.btnRight.setVisible(true);
|
||||
this.btnRight.setText("Done");
|
||||
this.helper.setState("", false, "Done", true);
|
||||
break;
|
||||
public void getFeedback(FeedbackMode mode, String message, boolean special, Map<String, Serializable> options) {
|
||||
logger.info("text: " + message);
|
||||
this.lblMessage.setText(message);
|
||||
this.selected = false;
|
||||
this.mode = mode;
|
||||
switch (this.mode) {
|
||||
case INFORM:
|
||||
this.btnLeft.setVisible(false);
|
||||
this.btnRight.setVisible(false);
|
||||
this.helper.setState("", false, "", false);
|
||||
break;
|
||||
case QUESTION:
|
||||
this.btnLeft.setVisible(true);
|
||||
this.btnLeft.setText("Yes");
|
||||
this.btnRight.setVisible(true);
|
||||
this.btnRight.setText("No");
|
||||
this.helper.setState("Yes", true, "Yes", true);
|
||||
break;
|
||||
case CONFIRM:
|
||||
this.btnLeft.setVisible(true);
|
||||
this.btnLeft.setText("OK");
|
||||
this.btnRight.setVisible(true);
|
||||
this.btnRight.setText("Cancel");
|
||||
this.helper.setState("Ok", true, "Cancel", true);
|
||||
break;
|
||||
case CANCEL:
|
||||
this.btnLeft.setVisible(false);
|
||||
this.btnRight.setVisible(true);
|
||||
this.btnRight.setText("Cancel");
|
||||
this.helper.setState("", false, "Cancel", true);
|
||||
break;
|
||||
case SELECT:
|
||||
this.btnLeft.setVisible(false);
|
||||
this.btnRight.setVisible(true);
|
||||
this.btnRight.setText("Done");
|
||||
this.helper.setState("", false, "Done", true);
|
||||
break;
|
||||
case END:
|
||||
this.btnLeft.setVisible(false);
|
||||
this.btnRight.setVisible(true);
|
||||
this.btnRight.setText("OK");
|
||||
this.helper.setState("", false, "Done", true);
|
||||
break;
|
||||
}
|
||||
this.btnSpecial.setVisible(special);
|
||||
this.btnSpecial.setText("Special");
|
||||
this.helper.setSpecial("Special", special);
|
||||
if (message.contains("P}")) {
|
||||
this.btnSpecial.setVisible(true);
|
||||
this.btnSpecial.setText("Pay 2 life");
|
||||
this.helper.setSpecial("Pay 2 life", true);
|
||||
}
|
||||
this.btnLeft.setVisible(false);
|
||||
this.btnRight.setVisible(true);
|
||||
this.btnRight.setText("OK");
|
||||
this.helper.setState("", false, "Done", true);
|
||||
break;
|
||||
}
|
||||
this.btnSpecial.setVisible(special);
|
||||
this.btnSpecial.setText("Special");
|
||||
this.helper.setSpecial("Special", special);
|
||||
if (message.contains("P}")) {
|
||||
this.btnSpecial.setVisible(true);
|
||||
this.btnSpecial.setText("Pay 2 life");
|
||||
this.helper.setSpecial("Pay 2 life", true);
|
||||
}
|
||||
|
||||
requestFocusIfPossible();
|
||||
handleOptions(options);
|
||||
requestFocusIfPossible();
|
||||
handleOptions(options);
|
||||
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
this.helper.setLinks(btnLeft, btnRight, btnSpecial);
|
||||
// if (modal) {
|
||||
// this.helper.setVisible(false);
|
||||
// startModal();
|
||||
// } else {
|
||||
this.helper.setVisible(true);
|
||||
// }
|
||||
}
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
this.helper.setLinks(btnLeft, btnRight, btnSpecial);
|
||||
// if (modal) {
|
||||
// this.helper.setVisible(false);
|
||||
// startModal();
|
||||
// } else {
|
||||
this.helper.setVisible(true);
|
||||
// }
|
||||
}
|
||||
|
||||
private void handleOptions(Map<String, Serializable> options) {
|
||||
if (options != null) {
|
||||
if (options.containsKey("UI.right.btn.text")) {
|
||||
this.btnRight.setText((String)options.get("UI.right.btn.text"));
|
||||
this.helper.setRight((String)options.get("UI.right.btn.text"), true);
|
||||
}
|
||||
if (options.containsKey("dialog")) {
|
||||
connectedDialog = (MageDialog) options.get("dialog");
|
||||
}
|
||||
}
|
||||
}
|
||||
private void handleOptions(Map<String, Serializable> options) {
|
||||
if (options != null) {
|
||||
if (options.containsKey("UI.right.btn.text")) {
|
||||
this.btnRight.setText((String)options.get("UI.right.btn.text"));
|
||||
this.helper.setRight((String)options.get("UI.right.btn.text"), true);
|
||||
}
|
||||
if (options.containsKey("dialog")) {
|
||||
connectedDialog = (MageDialog) options.get("dialog");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Issue 256: Chat+Feedback panel: request focus prevents players from chatting
|
||||
private void requestFocusIfPossible() {
|
||||
boolean requestFocusAllowed = true;
|
||||
if (connectedChatPanel != null && connectedChatPanel.getTxtMessageInputComponent() != null) {
|
||||
if (connectedChatPanel.getTxtMessageInputComponent().hasFocus()) {
|
||||
requestFocusAllowed = false;
|
||||
}
|
||||
}
|
||||
if (requestFocusAllowed) {
|
||||
this.btnRight.requestFocus();
|
||||
}
|
||||
}
|
||||
// Issue 256: Chat+Feedback panel: request focus prevents players from chatting
|
||||
private void requestFocusIfPossible() {
|
||||
boolean requestFocusAllowed = true;
|
||||
if (connectedChatPanel != null && connectedChatPanel.getTxtMessageInputComponent() != null) {
|
||||
if (connectedChatPanel.getTxtMessageInputComponent().hasFocus()) {
|
||||
requestFocusAllowed = false;
|
||||
}
|
||||
}
|
||||
if (requestFocusAllowed) {
|
||||
this.btnRight.requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
public void doClick() {
|
||||
this.btnRight.doClick();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
// stopModal();
|
||||
this.btnLeft.setVisible(false);
|
||||
this.btnRight.setVisible(false);
|
||||
this.btnSpecial.setVisible(false);
|
||||
this.lblMessage.setText("");
|
||||
logger.debug("feedback - clear");
|
||||
}
|
||||
public void clear() {
|
||||
// stopModal();
|
||||
this.btnLeft.setVisible(false);
|
||||
this.btnRight.setVisible(false);
|
||||
this.btnSpecial.setVisible(false);
|
||||
this.lblMessage.setText("");
|
||||
logger.debug("feedback - clear");
|
||||
}
|
||||
|
||||
// public void clear0() {
|
||||
// stopModal();
|
||||
// }
|
||||
// public void clear0() {
|
||||
// stopModal();
|
||||
// }
|
||||
|
||||
// private synchronized void startModal() {
|
||||
// private synchronized void startModal() {
|
||||
//
|
||||
// try {
|
||||
// if (SwingUtilities.isEventDispatchThread()) {
|
||||
|
|
@ -215,7 +215,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
// } else if (source instanceof MenuComponent) {
|
||||
// ((MenuComponent) source).dispatchEvent(event);
|
||||
// } else {
|
||||
// logger.warn("Unable to dispatch: " + event);
|
||||
// logger.warn("Unable to dispatch: " + event);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
|
@ -232,7 +232,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
// private synchronized void stopModal() {
|
||||
// notifyAll();
|
||||
// }
|
||||
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
|
|
@ -365,42 +365,42 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
add(jlabel2, BorderLayout.PAGE_END);
|
||||
}
|
||||
|
||||
private void btnRightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRightActionPerformed
|
||||
this.selected = true;
|
||||
// clear0();
|
||||
if (connectedDialog != null) {
|
||||
connectedDialog.hideDialog();
|
||||
}
|
||||
if (mode == FeedbackMode.SELECT && (evt.getModifiers() & ActionEvent.CTRL_MASK) == ActionEvent.CTRL_MASK) {
|
||||
session.sendPlayerInteger(gameId, 0);
|
||||
private void btnRightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRightActionPerformed
|
||||
this.selected = true;
|
||||
// clear0();
|
||||
if (connectedDialog != null) {
|
||||
connectedDialog.hideDialog();
|
||||
}
|
||||
if (mode == FeedbackMode.SELECT && (evt.getModifiers() & ActionEvent.CTRL_MASK) == ActionEvent.CTRL_MASK) {
|
||||
session.sendPlayerInteger(gameId, 0);
|
||||
} else if (mode == FeedbackMode.END) {
|
||||
MageFrame.getGame(gameId).hideGame();
|
||||
} else {
|
||||
session.sendPlayerBoolean(gameId, false);
|
||||
}
|
||||
}//GEN-LAST:event_btnRightActionPerformed
|
||||
} else {
|
||||
session.sendPlayerBoolean(gameId, false);
|
||||
}
|
||||
}//GEN-LAST:event_btnRightActionPerformed
|
||||
|
||||
private void btnLeftActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLeftActionPerformed
|
||||
this.selected = true;
|
||||
// clear0();
|
||||
session.sendPlayerBoolean(gameId, true);
|
||||
}//GEN-LAST:event_btnLeftActionPerformed
|
||||
private void btnLeftActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLeftActionPerformed
|
||||
this.selected = true;
|
||||
// clear0();
|
||||
session.sendPlayerBoolean(gameId, true);
|
||||
}//GEN-LAST:event_btnLeftActionPerformed
|
||||
|
||||
private void btnSpecialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSpecialActionPerformed
|
||||
session.sendPlayerString(gameId, "special");
|
||||
}//GEN-LAST:event_btnSpecialActionPerformed
|
||||
private void btnSpecialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSpecialActionPerformed
|
||||
session.sendPlayerString(gameId, "special");
|
||||
}//GEN-LAST:event_btnSpecialActionPerformed
|
||||
|
||||
public void setHelperPanel(HelperPanel helper) {
|
||||
this.helper = helper;
|
||||
}
|
||||
|
||||
public FeedbackMode getMode() {
|
||||
return this.mode;
|
||||
}
|
||||
public FeedbackMode getMode() {
|
||||
return this.mode;
|
||||
}
|
||||
|
||||
public void setConnectedChatPanel(ChatPanel chatPanel) {
|
||||
this.connectedChatPanel = chatPanel;
|
||||
}
|
||||
public void setConnectedChatPanel(ChatPanel chatPanel) {
|
||||
this.connectedChatPanel = chatPanel;
|
||||
}
|
||||
|
||||
private javax.swing.JButton btnLeft;
|
||||
private javax.swing.JButton btnRight;
|
||||
|
|
|
|||
|
|
@ -48,34 +48,34 @@ public class GamePane extends MagePane {
|
|||
/** Creates new form GamePane */
|
||||
public GamePane() {
|
||||
initComponents();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
gamePanel.setJLayeredPane(getLayeredPane());
|
||||
gamePanel.installComponents();
|
||||
}
|
||||
});
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
gamePanel.setJLayeredPane(getLayeredPane());
|
||||
gamePanel.installComponents();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void showGame(UUID gameId, UUID playerId) {
|
||||
this.setTitle("Game " + gameId);
|
||||
gamePanel.showGame(gameId, playerId);
|
||||
}
|
||||
public void showGame(UUID gameId, UUID playerId) {
|
||||
this.setTitle("Game " + gameId);
|
||||
gamePanel.showGame(gameId, playerId);
|
||||
}
|
||||
|
||||
public void hideGame() {
|
||||
gamePanel.hideGame();
|
||||
}
|
||||
|
||||
public void watchGame(UUID gameId) {
|
||||
this.setTitle("Watching " + gameId);
|
||||
gamePanel.watchGame(gameId);
|
||||
}
|
||||
public void hideGame() {
|
||||
gamePanel.hideGame();
|
||||
}
|
||||
|
||||
public void replayGame(UUID gameId) {
|
||||
this.setTitle("Replaying " + gameId);
|
||||
gamePanel.replayGame(gameId);
|
||||
}
|
||||
public void watchGame(UUID gameId) {
|
||||
this.setTitle("Watching " + gameId);
|
||||
gamePanel.watchGame(gameId);
|
||||
}
|
||||
|
||||
public void replayGame(UUID gameId) {
|
||||
this.setTitle("Replaying " + gameId);
|
||||
gamePanel.replayGame(gameId);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void initComponents() {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -22,10 +22,10 @@ public class HandPanel extends JPanel {
|
|||
|
||||
private static final int CARD_WIDTH = 75;
|
||||
private static final double ASPECT_RATIO = 3.5 / 2.5;
|
||||
|
||||
private boolean smallMode = false;
|
||||
|
||||
private boolean smallMode = false;
|
||||
private Dimension handCardDimensionBig;
|
||||
private Dimension handCardDimension;
|
||||
private Dimension handCardDimension;
|
||||
|
||||
public HandPanel() {
|
||||
double factor = 1;
|
||||
|
|
@ -35,7 +35,7 @@ public class HandPanel extends JPanel {
|
|||
|
||||
public void initComponents() {
|
||||
hand = new mage.client.cards.Cards(true);
|
||||
hand.setCardDimension(getHandCardDimension());
|
||||
hand.setCardDimension(getHandCardDimension());
|
||||
jPanel = new JPanel();
|
||||
jScrollPane1 = new JScrollPane(jPanel);
|
||||
jScrollPane1.getViewport().setBackground(new Color(0,0,0,0));
|
||||
|
|
@ -44,14 +44,14 @@ public class HandPanel extends JPanel {
|
|||
jPanel.setBackground(new Color(0,0,0,0));
|
||||
jPanel.add(hand);
|
||||
|
||||
setOpaque(false);
|
||||
jPanel.setOpaque(false);
|
||||
jScrollPane1.setOpaque(false);
|
||||
setOpaque(false);
|
||||
jPanel.setOpaque(false);
|
||||
jScrollPane1.setOpaque(false);
|
||||
|
||||
jPanel.setBorder(emptyBorder);
|
||||
jScrollPane1.setBorder(emptyBorder);
|
||||
jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
|
||||
jScrollPane1.getHorizontalScrollBar().setUnitIncrement(8);
|
||||
jPanel.setBorder(emptyBorder);
|
||||
jScrollPane1.setBorder(emptyBorder);
|
||||
jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
|
||||
jScrollPane1.getHorizontalScrollBar().setUnitIncrement(8);
|
||||
|
||||
setLayout(new BorderLayout());
|
||||
add(jScrollPane1, BorderLayout.CENTER);
|
||||
|
|
@ -59,14 +59,14 @@ public class HandPanel extends JPanel {
|
|||
hand.setHScrollSpeed(8);
|
||||
hand.setBackgroundColor(new Color(0, 0, 0, 100));
|
||||
hand.setVisibleIfEmpty(false);
|
||||
hand.setBorder(emptyBorder);
|
||||
hand.setBorder(emptyBorder);
|
||||
hand.setZone(Constants.Zone.HAND.toString());
|
||||
}
|
||||
|
||||
public void loadCards(SimpleCardsView cards, BigCard bigCard, UUID gameId) {
|
||||
hand.loadCards(cards, bigCard, gameId);
|
||||
hand.loadCards(cards, bigCard, gameId);
|
||||
hand.sizeCards(getHandCardDimension());
|
||||
}
|
||||
}
|
||||
|
||||
private Dimension getHandCardDimension() {
|
||||
String useBigCards = MageFrame.getPreferences().get(PreferencesDialog.KEY_HAND_USE_BIG_CARDS, "false");
|
||||
|
|
@ -82,13 +82,13 @@ public class HandPanel extends JPanel {
|
|||
int bigWidth = (int)(Config.handScalingFactor * CARD_WIDTH);
|
||||
handCardDimension = new Dimension(width, (int)(width * ASPECT_RATIO));
|
||||
handCardDimensionBig = new Dimension(bigWidth, (int)(bigWidth * ASPECT_RATIO));
|
||||
hand.setCardDimension(getHandCardDimension());
|
||||
hand.setCardDimension(getHandCardDimension());
|
||||
hand.sizeCards(getHandCardDimension());
|
||||
}
|
||||
|
||||
|
||||
private JPanel jPanel;
|
||||
private JScrollPane jScrollPane1;
|
||||
private Border emptyBorder = new EmptyBorder(0,0,0,0);
|
||||
private Border emptyBorder = new EmptyBorder(0,0,0,0);
|
||||
private mage.client.cards.Cards hand;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class HelperPanel extends JPanel {
|
|||
setState("",false,"",false);
|
||||
setSpecial("", false);
|
||||
linkLeft.doClick();
|
||||
}}
|
||||
}}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -47,14 +47,14 @@ public class ManaPool extends javax.swing.JPanel {
|
|||
initComponents();
|
||||
}
|
||||
|
||||
public void update(ManaPoolView pool) {
|
||||
this.btnBlack.setText(Integer.toString(pool.getBlack()));
|
||||
this.btnRed.setText(Integer.toString(pool.getRed()));
|
||||
this.btnWhite.setText(Integer.toString(pool.getWhite()));
|
||||
this.btnGreen.setText(Integer.toString(pool.getGreen()));
|
||||
this.btnBlue.setText(Integer.toString(pool.getBlue()));
|
||||
this.btnColorless.setText(Integer.toString(pool.getColorless()));
|
||||
}
|
||||
public void update(ManaPoolView pool) {
|
||||
this.btnBlack.setText(Integer.toString(pool.getBlack()));
|
||||
this.btnRed.setText(Integer.toString(pool.getRed()));
|
||||
this.btnWhite.setText(Integer.toString(pool.getWhite()));
|
||||
this.btnGreen.setText(Integer.toString(pool.getGreen()));
|
||||
this.btnBlue.setText(Integer.toString(pool.getBlue()));
|
||||
this.btnColorless.setText(Integer.toString(pool.getColorless()));
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
|
|
|
|||
|
|
@ -44,48 +44,48 @@ import java.util.UUID;
|
|||
*/
|
||||
public class PlayAreaPanel extends javax.swing.JPanel {
|
||||
|
||||
private UUID playerId;
|
||||
private UUID gameId;
|
||||
private UUID playerId;
|
||||
private UUID gameId;
|
||||
|
||||
/** Creates new form PlayAreaPanel */
|
||||
public PlayAreaPanel() {
|
||||
initComponents();
|
||||
setOpaque(false);
|
||||
setOpaque(false);
|
||||
//jScrollPane1.setOpaque(false);
|
||||
//jScrollPane1.getViewport().setOpaque(false);
|
||||
battlefieldPanel.setOpaque(false);
|
||||
}
|
||||
}
|
||||
|
||||
public PlayAreaPanel(PlayerView player, BigCard bigCard, UUID gameId, boolean me) {
|
||||
this();
|
||||
init(player, bigCard, gameId);
|
||||
update(player);
|
||||
}
|
||||
public PlayAreaPanel(PlayerView player, BigCard bigCard, UUID gameId, boolean me) {
|
||||
this();
|
||||
init(player, bigCard, gameId);
|
||||
update(player);
|
||||
}
|
||||
|
||||
public final void init(PlayerView player, BigCard bigCard, UUID gameId) {
|
||||
this.playerPanel.init(gameId, player.getPlayerId(), bigCard);
|
||||
this.battlefieldPanel.init(gameId, bigCard);
|
||||
if (MageFrame.getSession().isTestMode()) {
|
||||
this.playerId = player.getPlayerId();
|
||||
this.gameId = gameId;
|
||||
this.btnCheat.setVisible(true);
|
||||
}
|
||||
else {
|
||||
this.btnCheat.setVisible(false);
|
||||
}
|
||||
}
|
||||
public final void init(PlayerView player, BigCard bigCard, UUID gameId) {
|
||||
this.playerPanel.init(gameId, player.getPlayerId(), bigCard);
|
||||
this.battlefieldPanel.init(gameId, bigCard);
|
||||
if (MageFrame.getSession().isTestMode()) {
|
||||
this.playerId = player.getPlayerId();
|
||||
this.gameId = gameId;
|
||||
this.btnCheat.setVisible(true);
|
||||
}
|
||||
else {
|
||||
this.btnCheat.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
public final void update(PlayerView player) {
|
||||
this.playerPanel.update(player);
|
||||
this.battlefieldPanel.update(player.getBattlefield());
|
||||
}
|
||||
public final void update(PlayerView player) {
|
||||
this.playerPanel.update(player);
|
||||
this.battlefieldPanel.update(player.getBattlefield());
|
||||
}
|
||||
|
||||
public mage.client.game.BattlefieldPanel getBattlefieldPanel() {
|
||||
return battlefieldPanel;
|
||||
}
|
||||
public mage.client.game.BattlefieldPanel getBattlefieldPanel() {
|
||||
return battlefieldPanel;
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
setBorder(BorderFactory.createLineBorder(new Color(0,0,0,0)));
|
||||
setBorder(BorderFactory.createLineBorder(new Color(0,0,0,0)));
|
||||
playerPanel = new PlayerPanelExt();
|
||||
btnCheat = new javax.swing.JButton();
|
||||
//jScrollPane1 = new javax.swing.JScrollPane();
|
||||
|
|
@ -101,46 +101,46 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
});
|
||||
|
||||
//jScrollPane1.setViewportView(battlefieldPanel);
|
||||
//Border empty = new EmptyBorder(0,0,0,0);
|
||||
//jScrollPane1.setBorder(empty);
|
||||
//jScrollPane1.setViewportBorder(empty);
|
||||
//Border empty = new EmptyBorder(0,0,0,0);
|
||||
//jScrollPane1.setBorder(empty);
|
||||
//jScrollPane1.setViewportBorder(empty);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createSequentialGroup()
|
||||
.addComponent(playerPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(battlefieldPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
layout.createSequentialGroup()
|
||||
.addComponent(playerPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(battlefieldPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(playerPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(battlefieldPanel, GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE)
|
||||
layout.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(playerPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(battlefieldPanel, GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE)
|
||||
);
|
||||
this.setLayout(layout);
|
||||
}
|
||||
|
||||
public void sizePlayer(boolean smallMode) {
|
||||
this.playerPanel.sizePlayerPanel(smallMode);
|
||||
if (smallMode) {
|
||||
this.playerPanel.setPreferredSize(new Dimension(92, 160));
|
||||
//this.jScrollPane1.setPreferredSize(new Dimension(160, 160));
|
||||
this.playerPanel.sizePlayerPanel(smallMode);
|
||||
if (smallMode) {
|
||||
this.playerPanel.setPreferredSize(new Dimension(92, 160));
|
||||
//this.jScrollPane1.setPreferredSize(new Dimension(160, 160));
|
||||
this.battlefieldPanel.setPreferredSize(new Dimension(160, 160));
|
||||
}
|
||||
else {
|
||||
this.playerPanel.setPreferredSize(new Dimension(92, 212));
|
||||
//this.jScrollPane1.setPreferredSize(new Dimension(160, 212));
|
||||
}
|
||||
else {
|
||||
this.playerPanel.setPreferredSize(new Dimension(92, 212));
|
||||
//this.jScrollPane1.setPreferredSize(new Dimension(160, 212));
|
||||
this.battlefieldPanel.setPreferredSize(new Dimension(160, 212));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCheatActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
MageFrame.getSession().cheat(gameId, playerId, DeckImporterUtil.importDeck("cheat.dck"));
|
||||
}
|
||||
|
||||
|
||||
private void btnCheatActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
MageFrame.getSession().cheat(gameId, playerId, DeckImporterUtil.importDeck("cheat.dck"));
|
||||
}
|
||||
|
||||
|
||||
private mage.client.game.BattlefieldPanel battlefieldPanel;
|
||||
private javax.swing.JButton btnCheat;
|
||||
private javax.swing.JButton btnCheat;
|
||||
//private javax.swing.JScrollPane jScrollPane1;
|
||||
private PlayerPanelExt playerPanel;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,43 +49,43 @@ import mage.view.PlayerView;
|
|||
*/
|
||||
public class PlayerPanel extends javax.swing.JPanel {
|
||||
|
||||
private UUID playerId;
|
||||
private UUID gameId;
|
||||
private Session session;
|
||||
private PlayerView player;
|
||||
private UUID playerId;
|
||||
private UUID gameId;
|
||||
private Session session;
|
||||
private PlayerView player;
|
||||
|
||||
private ShowCardsDialog graveyard;
|
||||
private BigCard bigCard;
|
||||
private ShowCardsDialog graveyard;
|
||||
private BigCard bigCard;
|
||||
|
||||
/** Creates new form PlayerPanel */
|
||||
public PlayerPanel() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
public void init(UUID gameId, UUID playerId, BigCard bigCard) {
|
||||
this.gameId = gameId;
|
||||
this.playerId = playerId;
|
||||
this.bigCard = bigCard;
|
||||
session = MageFrame.getSession();
|
||||
}
|
||||
public void init(UUID gameId, UUID playerId, BigCard bigCard) {
|
||||
this.gameId = gameId;
|
||||
this.playerId = playerId;
|
||||
this.bigCard = bigCard;
|
||||
session = MageFrame.getSession();
|
||||
}
|
||||
|
||||
public void update(PlayerView player) {
|
||||
this.player = player;
|
||||
this.txtLife.setText(Integer.toString(player.getLife()));
|
||||
this.txtHand.setText(Integer.toString(player.getHandCount()));
|
||||
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);
|
||||
}
|
||||
}
|
||||
public void update(PlayerView player) {
|
||||
this.player = player;
|
||||
this.txtLife.setText(Integer.toString(player.getLife()));
|
||||
this.txtHand.setText(Integer.toString(player.getHandCount()));
|
||||
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
|
||||
* initialize the form.
|
||||
|
|
@ -192,16 +192,16 @@ public class PlayerPanel extends javax.swing.JPanel {
|
|||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void btnPlayerNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPlayerNameActionPerformed
|
||||
session.sendPlayerUUID(gameId, playerId);
|
||||
}//GEN-LAST:event_btnPlayerNameActionPerformed
|
||||
private void btnPlayerNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPlayerNameActionPerformed
|
||||
session.sendPlayerUUID(gameId, playerId);
|
||||
}//GEN-LAST:event_btnPlayerNameActionPerformed
|
||||
|
||||
private void btnGraveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGraveActionPerformed
|
||||
if (graveyard == null) {
|
||||
graveyard = new ShowCardsDialog();
|
||||
}
|
||||
graveyard.loadCards(player.getName() + " graveyard", player.getGraveyard(), bigCard, Config.dimensions, gameId, false);
|
||||
}//GEN-LAST:event_btnGraveActionPerformed
|
||||
private void btnGraveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGraveActionPerformed
|
||||
if (graveyard == null) {
|
||||
graveyard = new ShowCardsDialog();
|
||||
}
|
||||
graveyard.loadCards(player.getName() + " graveyard", player.getGraveyard(), bigCard, Config.dimensions, gameId, false);
|
||||
}//GEN-LAST:event_btnGraveActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
|
|
|||
|
|
@ -76,45 +76,45 @@ import java.util.UUID;
|
|||
*/
|
||||
public class PlayerPanelExt extends javax.swing.JPanel {
|
||||
|
||||
private UUID playerId;
|
||||
private UUID gameId;
|
||||
private Session session;
|
||||
private PlayerView player;
|
||||
private UUID playerId;
|
||||
private UUID gameId;
|
||||
private Session session;
|
||||
private PlayerView player;
|
||||
|
||||
private ShowCardsDialog graveyard;
|
||||
private BigCard bigCard;
|
||||
private ShowCardsDialog graveyard;
|
||||
private BigCard bigCard;
|
||||
|
||||
private static final int AVATAR_COUNT = 77;
|
||||
private static final int AVATAR_COUNT = 77;
|
||||
|
||||
private static final Border greenBorder = new LineBorder(Color.red, 3);
|
||||
private static final Border redBorder = new LineBorder(Color.red, 2);
|
||||
private static final Border emptyBorder = BorderFactory.createEmptyBorder(0,0,0,0);
|
||||
private static final Border greenBorder = new LineBorder(Color.red, 3);
|
||||
private static final Border redBorder = new LineBorder(Color.red, 2);
|
||||
private static final Border emptyBorder = BorderFactory.createEmptyBorder(0,0,0,0);
|
||||
|
||||
private static final Dimension topCardDimension = new Dimension(40, 56);
|
||||
private static final Dimension topCardDimension = new Dimension(40, 56);
|
||||
|
||||
private int avatarId = -1;
|
||||
private int avatarId = -1;
|
||||
|
||||
/** Creates new form PlayerPanel */
|
||||
public PlayerPanelExt() {
|
||||
setPreferredSize(new Dimension(94, 212));
|
||||
setPreferredSize(new Dimension(94, 212));
|
||||
initComponents();
|
||||
}
|
||||
|
||||
public void init(UUID gameId, UUID playerId, BigCard bigCard) {
|
||||
this.gameId = gameId;
|
||||
this.playerId = playerId;
|
||||
this.bigCard = bigCard;
|
||||
session = MageFrame.getSession();
|
||||
cheat.setVisible(session.isTestMode());
|
||||
}
|
||||
public void init(UUID gameId, UUID playerId, BigCard bigCard) {
|
||||
this.gameId = gameId;
|
||||
this.playerId = playerId;
|
||||
this.bigCard = bigCard;
|
||||
session = MageFrame.getSession();
|
||||
cheat.setVisible(session.isTestMode());
|
||||
}
|
||||
|
||||
public void update(PlayerView player) {
|
||||
this.player = player;
|
||||
lifeLabel.setText(Integer.toString(player.getLife()));
|
||||
poisonLabel.setText(Integer.toString(player.getPoison()));
|
||||
handLabel.setText(Integer.toString(player.getHandCount()));
|
||||
libraryLabel.setText(Integer.toString(player.getLibraryCount()));
|
||||
graveLabel.setText(Integer.toString(player.getGraveyard().size()));
|
||||
public void update(PlayerView player) {
|
||||
this.player = player;
|
||||
lifeLabel.setText(Integer.toString(player.getLife()));
|
||||
poisonLabel.setText(Integer.toString(player.getPoison()));
|
||||
handLabel.setText(Integer.toString(player.getHandCount()));
|
||||
libraryLabel.setText(Integer.toString(player.getLibraryCount()));
|
||||
graveLabel.setText(Integer.toString(player.getGraveyard().size()));
|
||||
|
||||
if (!MageFrame.isLite()) {
|
||||
int id = player.getUserData().getAvatarId();
|
||||
|
|
@ -133,49 +133,49 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
this.avatar.update("player", resized, resized, resized, resized, r);
|
||||
}
|
||||
}
|
||||
this.avatar.setText(player.getName());
|
||||
this.btnPlayer.setText(player.getName());
|
||||
if (player.isActive()) {
|
||||
this.avatar.setBorder(greenBorder);
|
||||
this.btnPlayer.setBorder(greenBorder);
|
||||
} else if (player.hasLeft()) {
|
||||
this.avatar.setBorder(redBorder);
|
||||
this.btnPlayer.setBorder(redBorder);
|
||||
} else {
|
||||
this.avatar.setBorder(emptyBorder);
|
||||
this.btnPlayer.setBorder(emptyBorder);
|
||||
}
|
||||
this.avatar.setText(player.getName());
|
||||
this.btnPlayer.setText(player.getName());
|
||||
if (player.isActive()) {
|
||||
this.avatar.setBorder(greenBorder);
|
||||
this.btnPlayer.setBorder(greenBorder);
|
||||
} else if (player.hasLeft()) {
|
||||
this.avatar.setBorder(redBorder);
|
||||
this.btnPlayer.setBorder(redBorder);
|
||||
} else {
|
||||
this.avatar.setBorder(emptyBorder);
|
||||
this.btnPlayer.setBorder(emptyBorder);
|
||||
}
|
||||
|
||||
synchronized (this) {
|
||||
if (player.getTopCard() != null) {
|
||||
if (topCard == null || !topCard.getId().equals(player.getTopCard().getId())) {
|
||||
if (topCard == null) {
|
||||
topCardPanel.setVisible(true);
|
||||
}
|
||||
topCard = player.getTopCard();
|
||||
topCardPanel.update(topCard);
|
||||
topCardPanel.updateImage();
|
||||
ActionCallback callback = Plugins.getInstance().getActionCallback();
|
||||
((MageActionCallback)callback).refreshSession();
|
||||
topCardPanel.updateCallback(callback, gameId);
|
||||
}
|
||||
} else if (topCard != null) {
|
||||
topCard = null;
|
||||
topCardPanel.setVisible(false);
|
||||
}
|
||||
}
|
||||
synchronized (this) {
|
||||
if (player.getTopCard() != null) {
|
||||
if (topCard == null || !topCard.getId().equals(player.getTopCard().getId())) {
|
||||
if (topCard == null) {
|
||||
topCardPanel.setVisible(true);
|
||||
}
|
||||
topCard = player.getTopCard();
|
||||
topCardPanel.update(topCard);
|
||||
topCardPanel.updateImage();
|
||||
ActionCallback callback = Plugins.getInstance().getActionCallback();
|
||||
((MageActionCallback)callback).refreshSession();
|
||||
topCardPanel.updateCallback(callback, gameId);
|
||||
}
|
||||
} else if (topCard != null) {
|
||||
topCard = null;
|
||||
topCardPanel.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
update(player.getManaPool());
|
||||
}
|
||||
update(player.getManaPool());
|
||||
}
|
||||
|
||||
protected void update(ManaPoolView pool) {
|
||||
manaLabels.get("B").setText(Integer.toString(pool.getBlack()));
|
||||
manaLabels.get("R").setText(Integer.toString(pool.getRed()));
|
||||
manaLabels.get("W").setText(Integer.toString(pool.getWhite()));
|
||||
manaLabels.get("G").setText(Integer.toString(pool.getGreen()));
|
||||
manaLabels.get("U").setText(Integer.toString(pool.getBlue()));
|
||||
manaLabels.get("X").setText(Integer.toString(pool.getColorless()));
|
||||
}
|
||||
protected void update(ManaPoolView pool) {
|
||||
manaLabels.get("B").setText(Integer.toString(pool.getBlack()));
|
||||
manaLabels.get("R").setText(Integer.toString(pool.getRed()));
|
||||
manaLabels.get("W").setText(Integer.toString(pool.getWhite()));
|
||||
manaLabels.get("G").setText(Integer.toString(pool.getGreen()));
|
||||
manaLabels.get("U").setText(Integer.toString(pool.getBlue()));
|
||||
manaLabels.get("X").setText(Integer.toString(pool.getColorless()));
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
|
|
@ -184,313 +184,313 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void initComponents() {
|
||||
|
||||
panelBackground = new MageRoundPane();
|
||||
panelBackground.setPreferredSize(new Dimension(92, 212));
|
||||
Rectangle r = new Rectangle(80, 80);
|
||||
lifeLabel = new JLabel();
|
||||
handLabel = new JLabel();
|
||||
poisonLabel = new JLabel();
|
||||
libraryLabel = new JLabel();
|
||||
setOpaque(false);
|
||||
|
||||
panelBackground.setXOffset(3);
|
||||
panelBackground.setYOffset(3);
|
||||
panelBackground = new MageRoundPane();
|
||||
panelBackground.setPreferredSize(new Dimension(92, 212));
|
||||
Rectangle r = new Rectangle(80, 80);
|
||||
lifeLabel = new JLabel();
|
||||
handLabel = new JLabel();
|
||||
poisonLabel = new JLabel();
|
||||
libraryLabel = new JLabel();
|
||||
setOpaque(false);
|
||||
|
||||
panelBackground.setXOffset(3);
|
||||
panelBackground.setYOffset(3);
|
||||
panelBackground.setVisible(true);
|
||||
|
||||
// Avatar
|
||||
Image image = ImageHelper.getImageFromResources("/avatars/unknown.jpg");
|
||||
// Avatar
|
||||
Image image = ImageHelper.getImageFromResources("/avatars/unknown.jpg");
|
||||
|
||||
topCardPanel = Plugins.getInstance().getMageCard(new CardView(Sets.findCard("Forest")), bigCard, topCardDimension, gameId, true);
|
||||
topCardPanel.setVisible(false);
|
||||
panelBackground.add(topCardPanel);
|
||||
topCardPanel.setVisible(false);
|
||||
panelBackground.add(topCardPanel);
|
||||
|
||||
BufferedImage resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
||||
avatar = new HoverButton("player", resized, resized, resized, r);
|
||||
avatar.setObserver(new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
session.sendPlayerUUID(gameId, playerId);
|
||||
}
|
||||
});
|
||||
r = new Rectangle(18, 18);
|
||||
lifeLabel.setToolTipText("Life");
|
||||
Image imageLife = ImageHelper.getImageFromResources("/info/life.png");
|
||||
BufferedImage resizedLife = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageLife, BufferedImage.TYPE_INT_ARGB), r);
|
||||
life = new ImagePanel(resizedLife, ImagePanel.ACTUAL);
|
||||
life.setToolTipText("Life");
|
||||
life.setOpaque(false);
|
||||
r = new Rectangle(18, 18);
|
||||
handLabel.setToolTipText("Hand");
|
||||
Image imageHand = ImageHelper.getImageFromResources("/info/hand.png");
|
||||
BufferedImage resizedHand = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageHand, BufferedImage.TYPE_INT_ARGB), r);
|
||||
hand = new ImagePanel(resizedHand, ImagePanel.ACTUAL);
|
||||
hand.setToolTipText("Hand");
|
||||
hand.setOpaque(false);
|
||||
BufferedImage resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
||||
avatar = new HoverButton("player", resized, resized, resized, r);
|
||||
avatar.setObserver(new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
session.sendPlayerUUID(gameId, playerId);
|
||||
}
|
||||
});
|
||||
r = new Rectangle(18, 18);
|
||||
lifeLabel.setToolTipText("Life");
|
||||
Image imageLife = ImageHelper.getImageFromResources("/info/life.png");
|
||||
BufferedImage resizedLife = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageLife, BufferedImage.TYPE_INT_ARGB), r);
|
||||
life = new ImagePanel(resizedLife, ImagePanel.ACTUAL);
|
||||
life.setToolTipText("Life");
|
||||
life.setOpaque(false);
|
||||
r = new Rectangle(18, 18);
|
||||
handLabel.setToolTipText("Hand");
|
||||
Image imageHand = ImageHelper.getImageFromResources("/info/hand.png");
|
||||
BufferedImage resizedHand = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageHand, BufferedImage.TYPE_INT_ARGB), r);
|
||||
hand = new ImagePanel(resizedHand, ImagePanel.ACTUAL);
|
||||
hand.setToolTipText("Hand");
|
||||
hand.setOpaque(false);
|
||||
|
||||
// Poison count
|
||||
poisonLabel.setText("0");
|
||||
r = new Rectangle(14, 14);
|
||||
poisonLabel.setToolTipText("Poison");
|
||||
Image imagePoison = ImageHelper.getImageFromResources("/info/poison.png");
|
||||
BufferedImage resizedPoison = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imagePoison, BufferedImage.TYPE_INT_ARGB), r);
|
||||
poison = new ImagePanel(resizedPoison, ImagePanel.ACTUAL);
|
||||
poison.setToolTipText("Poison");
|
||||
poison.setOpaque(false);
|
||||
r = new Rectangle(19, 19);
|
||||
libraryLabel.setToolTipText("Library");
|
||||
Image imageLibrary = ImageHelper.getImageFromResources("/info/library.png");
|
||||
BufferedImage resizedLibrary = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageLibrary, BufferedImage.TYPE_INT_ARGB), r);
|
||||
library = new ImagePanel(resizedLibrary, ImagePanel.ACTUAL);
|
||||
library.setToolTipText("Library");
|
||||
library.setOpaque(false);
|
||||
// Poison count
|
||||
poisonLabel.setText("0");
|
||||
r = new Rectangle(14, 14);
|
||||
poisonLabel.setToolTipText("Poison");
|
||||
Image imagePoison = ImageHelper.getImageFromResources("/info/poison.png");
|
||||
BufferedImage resizedPoison = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imagePoison, BufferedImage.TYPE_INT_ARGB), r);
|
||||
poison = new ImagePanel(resizedPoison, ImagePanel.ACTUAL);
|
||||
poison.setToolTipText("Poison");
|
||||
poison.setOpaque(false);
|
||||
r = new Rectangle(19, 19);
|
||||
libraryLabel.setToolTipText("Library");
|
||||
Image imageLibrary = ImageHelper.getImageFromResources("/info/library.png");
|
||||
BufferedImage resizedLibrary = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageLibrary, BufferedImage.TYPE_INT_ARGB), r);
|
||||
library = new ImagePanel(resizedLibrary, ImagePanel.ACTUAL);
|
||||
library.setToolTipText("Library");
|
||||
library.setOpaque(false);
|
||||
|
||||
// Grave count and open graveyard button
|
||||
graveLabel = new JLabel();
|
||||
r = new Rectangle(21, 21);
|
||||
graveLabel.setToolTipText("Graveyard");
|
||||
Image imageGrave = ImageHelper.getImageFromResources("/info/grave.png");
|
||||
BufferedImage resizedGrave = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageGrave, BufferedImage.TYPE_INT_ARGB), r);
|
||||
grave = new HoverButton(null, resizedGrave, resizedGrave, resizedGrave, r);
|
||||
grave.setToolTipText("Graveyard");
|
||||
grave.setOpaque(false);
|
||||
grave.setObserver(new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
btnGraveActionPerformed(null);
|
||||
}
|
||||
});
|
||||
// Grave count and open graveyard button
|
||||
graveLabel = new JLabel();
|
||||
r = new Rectangle(21, 21);
|
||||
graveLabel.setToolTipText("Graveyard");
|
||||
Image imageGrave = ImageHelper.getImageFromResources("/info/grave.png");
|
||||
BufferedImage resizedGrave = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageGrave, BufferedImage.TYPE_INT_ARGB), r);
|
||||
grave = new HoverButton(null, resizedGrave, resizedGrave, resizedGrave, r);
|
||||
grave.setToolTipText("Graveyard");
|
||||
grave.setOpaque(false);
|
||||
grave.setObserver(new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
btnGraveActionPerformed(null);
|
||||
}
|
||||
});
|
||||
|
||||
// Cheat button
|
||||
r = new Rectangle(25, 21);
|
||||
image = ImageHelper.getImageFromResources("/info/cheat.png");
|
||||
resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
||||
cheat = new JButton();
|
||||
cheat.setIcon(new ImageIcon(resized));
|
||||
cheat.setToolTipText("Cheat button");
|
||||
cheat.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
btnCheatActionPerformed(e);
|
||||
}
|
||||
});
|
||||
// Cheat button
|
||||
r = new Rectangle(25, 21);
|
||||
image = ImageHelper.getImageFromResources("/info/cheat.png");
|
||||
resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
||||
cheat = new JButton();
|
||||
cheat.setIcon(new ImageIcon(resized));
|
||||
cheat.setToolTipText("Cheat button");
|
||||
cheat.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
btnCheatActionPerformed(e);
|
||||
}
|
||||
});
|
||||
|
||||
btnPlayer = new JButton();
|
||||
btnPlayer.setText("Player");
|
||||
btnPlayer.setVisible(false);
|
||||
btnPlayer.setToolTipText("Player");
|
||||
btnPlayer.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
session.sendPlayerUUID(gameId, playerId);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Add mana symbols
|
||||
BufferedImage imageManaW = ManaSymbols.getManaSymbolImageSmall("W");
|
||||
ImagePanel manaW = new ImagePanel(imageManaW, ImagePanel.ACTUAL);
|
||||
manaW.setOpaque(false);
|
||||
JLabel manaCountLabelW = new JLabel();
|
||||
manaCountLabelW.setText("0");
|
||||
manaLabels.put("W", manaCountLabelW);
|
||||
btnPlayer = new JButton();
|
||||
btnPlayer.setText("Player");
|
||||
btnPlayer.setVisible(false);
|
||||
btnPlayer.setToolTipText("Player");
|
||||
btnPlayer.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
session.sendPlayerUUID(gameId, playerId);
|
||||
}
|
||||
});
|
||||
|
||||
BufferedImage imageManaU = ManaSymbols.getManaSymbolImageSmall("U");
|
||||
ImagePanel manaU = new ImagePanel(imageManaU, ImagePanel.ACTUAL);
|
||||
manaU.setOpaque(false);
|
||||
JLabel manaCountLabelU = new JLabel();
|
||||
manaCountLabelU.setText("0");
|
||||
manaLabels.put("U", manaCountLabelU);
|
||||
|
||||
BufferedImage imageManaB = ManaSymbols.getManaSymbolImageSmall("B");
|
||||
ImagePanel manaB = new ImagePanel(imageManaB, ImagePanel.ACTUAL);
|
||||
manaB.setOpaque(false);
|
||||
JLabel manaCountLabelB = new JLabel();
|
||||
manaCountLabelB.setText("0");
|
||||
manaLabels.put("B", manaCountLabelB);
|
||||
// Add mana symbols
|
||||
BufferedImage imageManaW = ManaSymbols.getManaSymbolImageSmall("W");
|
||||
ImagePanel manaW = new ImagePanel(imageManaW, ImagePanel.ACTUAL);
|
||||
manaW.setOpaque(false);
|
||||
JLabel manaCountLabelW = new JLabel();
|
||||
manaCountLabelW.setText("0");
|
||||
manaLabels.put("W", manaCountLabelW);
|
||||
|
||||
BufferedImage imageManaR = ManaSymbols.getManaSymbolImageSmall("R");
|
||||
ImagePanel manaR = new ImagePanel(imageManaR, ImagePanel.ACTUAL);
|
||||
manaR.setOpaque(false);
|
||||
JLabel manaCountLabelR = new JLabel();
|
||||
manaCountLabelR.setText("0");
|
||||
manaLabels.put("R", manaCountLabelR);
|
||||
BufferedImage imageManaU = ManaSymbols.getManaSymbolImageSmall("U");
|
||||
ImagePanel manaU = new ImagePanel(imageManaU, ImagePanel.ACTUAL);
|
||||
manaU.setOpaque(false);
|
||||
JLabel manaCountLabelU = new JLabel();
|
||||
manaCountLabelU.setText("0");
|
||||
manaLabels.put("U", manaCountLabelU);
|
||||
|
||||
BufferedImage imageManaG = ManaSymbols.getManaSymbolImageSmall("G");
|
||||
ImagePanel manaG = new ImagePanel(imageManaG, ImagePanel.ACTUAL);
|
||||
manaG.setOpaque(false);
|
||||
JLabel manaCountLabelG = new JLabel();
|
||||
manaCountLabelG.setText("0");
|
||||
manaLabels.put("G", manaCountLabelG);
|
||||
BufferedImage imageManaB = ManaSymbols.getManaSymbolImageSmall("B");
|
||||
ImagePanel manaB = new ImagePanel(imageManaB, ImagePanel.ACTUAL);
|
||||
manaB.setOpaque(false);
|
||||
JLabel manaCountLabelB = new JLabel();
|
||||
manaCountLabelB.setText("0");
|
||||
manaLabels.put("B", manaCountLabelB);
|
||||
|
||||
BufferedImage imageManaX = ManaSymbols.getManaSymbolImageSmall("X");
|
||||
ImagePanel manaX = new ImagePanel(imageManaX, ImagePanel.ACTUAL);
|
||||
manaX.setOpaque(false);
|
||||
JLabel manaCountLabelX = new JLabel();
|
||||
manaCountLabelX.setText("0");
|
||||
manaLabels.put("X", manaCountLabelX);
|
||||
GroupLayout gl_panelBackground = new GroupLayout(panelBackground);
|
||||
gl_panelBackground.setHorizontalGroup(
|
||||
gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(9)
|
||||
.addComponent(life, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(3)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(18)
|
||||
.addComponent(hand, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lifeLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(4)
|
||||
.addComponent(handLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(9)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(3)
|
||||
.addComponent(poison, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(manaW, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(manaU, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(manaB, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(grave, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(18)
|
||||
.addComponent(library, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(poisonLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(20)
|
||||
.addComponent(manaR, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(manaCountLabelW, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(3)
|
||||
.addComponent(manaCountLabelR, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(manaCountLabelB, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(19)
|
||||
.addComponent(manaX, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(5)
|
||||
.addComponent(manaCountLabelX, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(20)
|
||||
.addComponent(manaG, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(40)
|
||||
.addComponent(manaCountLabelG, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(40)
|
||||
.addComponent(libraryLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(18)
|
||||
.addComponent(cheat, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(5)
|
||||
.addComponent(graveLabel, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(manaCountLabelU, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(btnPlayer, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(avatar, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE))
|
||||
.addGap(14))
|
||||
);
|
||||
gl_panelBackground.setVerticalGroup(
|
||||
gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addComponent(avatar, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(btnPlayer)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(life, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(hand, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lifeLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(handLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(1)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(4)
|
||||
.addComponent(poison, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(4)
|
||||
.addComponent(manaW, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(2)
|
||||
.addComponent(manaU, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(2)
|
||||
.addComponent(manaB, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(5)
|
||||
.addComponent(grave, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(library, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(poisonLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(2)
|
||||
.addComponent(manaR, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(14)
|
||||
.addComponent(manaCountLabelW, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(14)
|
||||
.addComponent(manaCountLabelR, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(4)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(manaCountLabelB, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(8)
|
||||
.addComponent(manaX, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(manaCountLabelX, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(39)
|
||||
.addComponent(manaG, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(31)
|
||||
.addComponent(manaCountLabelG, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(libraryLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(76)
|
||||
.addComponent(cheat, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(76)
|
||||
.addComponent(graveLabel, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(31)
|
||||
.addComponent(manaCountLabelU, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))))
|
||||
);
|
||||
panelBackground.setLayout(gl_panelBackground);
|
||||
GroupLayout groupLayout = new GroupLayout(this);
|
||||
groupLayout.setHorizontalGroup(
|
||||
groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(panelBackground, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
groupLayout.setVerticalGroup(
|
||||
groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(panelBackground, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
setLayout(groupLayout);
|
||||
BufferedImage imageManaR = ManaSymbols.getManaSymbolImageSmall("R");
|
||||
ImagePanel manaR = new ImagePanel(imageManaR, ImagePanel.ACTUAL);
|
||||
manaR.setOpaque(false);
|
||||
JLabel manaCountLabelR = new JLabel();
|
||||
manaCountLabelR.setText("0");
|
||||
manaLabels.put("R", manaCountLabelR);
|
||||
|
||||
BufferedImage imageManaG = ManaSymbols.getManaSymbolImageSmall("G");
|
||||
ImagePanel manaG = new ImagePanel(imageManaG, ImagePanel.ACTUAL);
|
||||
manaG.setOpaque(false);
|
||||
JLabel manaCountLabelG = new JLabel();
|
||||
manaCountLabelG.setText("0");
|
||||
manaLabels.put("G", manaCountLabelG);
|
||||
|
||||
BufferedImage imageManaX = ManaSymbols.getManaSymbolImageSmall("X");
|
||||
ImagePanel manaX = new ImagePanel(imageManaX, ImagePanel.ACTUAL);
|
||||
manaX.setOpaque(false);
|
||||
JLabel manaCountLabelX = new JLabel();
|
||||
manaCountLabelX.setText("0");
|
||||
manaLabels.put("X", manaCountLabelX);
|
||||
GroupLayout gl_panelBackground = new GroupLayout(panelBackground);
|
||||
gl_panelBackground.setHorizontalGroup(
|
||||
gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(9)
|
||||
.addComponent(life, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(3)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(18)
|
||||
.addComponent(hand, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lifeLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(4)
|
||||
.addComponent(handLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(9)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(3)
|
||||
.addComponent(poison, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(manaW, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(manaU, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(manaB, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(grave, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(18)
|
||||
.addComponent(library, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(poisonLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(20)
|
||||
.addComponent(manaR, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(manaCountLabelW, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(3)
|
||||
.addComponent(manaCountLabelR, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(manaCountLabelB, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(19)
|
||||
.addComponent(manaX, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(5)
|
||||
.addComponent(manaCountLabelX, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(20)
|
||||
.addComponent(manaG, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(40)
|
||||
.addComponent(manaCountLabelG, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(40)
|
||||
.addComponent(libraryLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(18)
|
||||
.addComponent(cheat, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(5)
|
||||
.addComponent(graveLabel, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(manaCountLabelU, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(btnPlayer, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(avatar, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE))
|
||||
.addGap(14))
|
||||
);
|
||||
gl_panelBackground.setVerticalGroup(
|
||||
gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addComponent(avatar, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(btnPlayer)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(life, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(hand, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lifeLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(handLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(1)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(4)
|
||||
.addComponent(poison, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(4)
|
||||
.addComponent(manaW, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(2)
|
||||
.addComponent(manaU, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(2)
|
||||
.addComponent(manaB, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(5)
|
||||
.addComponent(grave, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(library, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(poisonLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(2)
|
||||
.addComponent(manaR, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(14)
|
||||
.addComponent(manaCountLabelW, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(14)
|
||||
.addComponent(manaCountLabelR, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(4)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(manaCountLabelB, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(8)
|
||||
.addComponent(manaX, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(manaCountLabelX, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(39)
|
||||
.addComponent(manaG, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(31)
|
||||
.addComponent(manaCountLabelG, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(libraryLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(76)
|
||||
.addComponent(cheat, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(76)
|
||||
.addComponent(graveLabel, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(31)
|
||||
.addComponent(manaCountLabelU, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))))
|
||||
);
|
||||
panelBackground.setLayout(gl_panelBackground);
|
||||
GroupLayout groupLayout = new GroupLayout(this);
|
||||
groupLayout.setHorizontalGroup(
|
||||
groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(panelBackground, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
groupLayout.setVerticalGroup(
|
||||
groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(panelBackground, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
setLayout(groupLayout);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -502,42 +502,42 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
panelBackground.setBounds(0, 0, 92, 160);
|
||||
}
|
||||
else {
|
||||
avatar.setVisible(true);
|
||||
btnPlayer.setVisible(false);
|
||||
panelBackground.setPreferredSize(new Dimension(92, 212));
|
||||
panelBackground.setBounds(0, 0, 92, 212);
|
||||
avatar.setVisible(true);
|
||||
btnPlayer.setVisible(false);
|
||||
panelBackground.setPreferredSize(new Dimension(92, 212));
|
||||
panelBackground.setBounds(0, 0, 92, 212);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnGraveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGraveActionPerformed
|
||||
if (graveyard == null) {
|
||||
graveyard = new ShowCardsDialog();
|
||||
}
|
||||
graveyard.loadCards(player.getName() + " graveyard", player.getGraveyard(), bigCard, Config.dimensions, gameId, false);
|
||||
}
|
||||
private void btnGraveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGraveActionPerformed
|
||||
if (graveyard == null) {
|
||||
graveyard = new ShowCardsDialog();
|
||||
}
|
||||
graveyard.loadCards(player.getName() + " graveyard", player.getGraveyard(), bigCard, Config.dimensions, gameId, false);
|
||||
}
|
||||
|
||||
private void btnCheatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheatActionPerformed
|
||||
DckDeckImporter deckImporter = new DckDeckImporter();
|
||||
session.cheat(gameId, playerId, deckImporter.importDeck("cheat.dck"));
|
||||
}
|
||||
private void btnCheatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheatActionPerformed
|
||||
DckDeckImporter deckImporter = new DckDeckImporter();
|
||||
session.cheat(gameId, playerId, deckImporter.importDeck("cheat.dck"));
|
||||
}
|
||||
|
||||
private HoverButton avatar;
|
||||
private JButton btnPlayer;
|
||||
private ImagePanel life;
|
||||
private ImagePanel poison;
|
||||
private ImagePanel hand;
|
||||
private HoverButton grave;
|
||||
private ImagePanel library;
|
||||
private CardView topCard;
|
||||
private MageCard topCardPanel;
|
||||
private JButton cheat;
|
||||
private MageRoundPane panelBackground;
|
||||
private HoverButton avatar;
|
||||
private JButton btnPlayer;
|
||||
private ImagePanel life;
|
||||
private ImagePanel poison;
|
||||
private ImagePanel hand;
|
||||
private HoverButton grave;
|
||||
private ImagePanel library;
|
||||
private CardView topCard;
|
||||
private MageCard topCardPanel;
|
||||
private JButton cheat;
|
||||
private MageRoundPane panelBackground;
|
||||
|
||||
private JLabel lifeLabel;
|
||||
private JLabel handLabel;
|
||||
private JLabel libraryLabel;
|
||||
private JLabel poisonLabel;
|
||||
private JLabel graveLabel;
|
||||
private JLabel lifeLabel;
|
||||
private JLabel handLabel;
|
||||
private JLabel libraryLabel;
|
||||
private JLabel poisonLabel;
|
||||
private JLabel graveLabel;
|
||||
|
||||
private Map<String, JLabel> manaLabels = new HashMap<String, JLabel>();
|
||||
private Map<String, JLabel> manaLabels = new HashMap<String, JLabel>();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue