mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* UI: improves for player's panel:
* added cards count for commander zone icon; * added colorized text for non empty mana pool; * added colorized text for playable/chooseable cards in grave/exile/command zones;
This commit is contained in:
parent
6ab76ce91d
commit
efbd36963d
3 changed files with 163 additions and 75 deletions
|
@ -714,7 +714,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
players.get(player.getPlayerId()).update(player);
|
players.get(player.getPlayerId()).update(game, player, targets);
|
||||||
if (player.getPlayerId().equals(playerId)) {
|
if (player.getPlayerId().equals(playerId)) {
|
||||||
skipButtons.updateFromPlayer(player);
|
skipButtons.updateFromPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import mage.client.cards.BigCard;
|
||||||
import mage.client.dialog.PreferencesDialog;
|
import mage.client.dialog.PreferencesDialog;
|
||||||
import mage.client.util.GUISizeHelper;
|
import mage.client.util.GUISizeHelper;
|
||||||
import mage.constants.PlayerAction;
|
import mage.constants.PlayerAction;
|
||||||
|
import mage.view.GameView;
|
||||||
import mage.view.PlayerView;
|
import mage.view.PlayerView;
|
||||||
import mage.view.UserRequestMessage;
|
import mage.view.UserRequestMessage;
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ import javax.swing.event.ChangeListener;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static mage.client.dialog.PreferencesDialog.*;
|
import static mage.client.dialog.PreferencesDialog.*;
|
||||||
|
@ -70,7 +72,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
setGUISize();
|
setGUISize();
|
||||||
|
|
||||||
init(player, bigCard, gameId, priorityTime);
|
init(player, bigCard, gameId, priorityTime);
|
||||||
update(player);
|
update(null, player, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CleanUp() {
|
public void CleanUp() {
|
||||||
|
@ -503,8 +505,8 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void update(PlayerView player) {
|
public final void update(GameView game, PlayerView player, Set<UUID> possibleTargets) {
|
||||||
this.playerPanel.update(player);
|
this.playerPanel.update(game, player, possibleTargets);
|
||||||
this.battlefieldPanel.update(player.getBattlefield());
|
this.battlefieldPanel.update(player.getBattlefield());
|
||||||
if (this.allowViewHandCardsMenuItem != null) {
|
if (this.allowViewHandCardsMenuItem != null) {
|
||||||
this.allowViewHandCardsMenuItem.setSelected(player.getUserData().isAllowRequestHandToAll());
|
this.allowViewHandCardsMenuItem.setSelected(player.getUserData().isAllowRequestHandToAll());
|
||||||
|
|
|
@ -1,34 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PlayerPanel.java
|
|
||||||
*
|
|
||||||
* Created on Nov 18, 2009, 3:01:31 PM
|
|
||||||
*/
|
|
||||||
package mage.client.game;
|
package mage.client.game;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.Font;
|
|
||||||
import java.awt.Image;
|
|
||||||
import java.awt.Rectangle;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.GroupLayout;
|
|
||||||
import javax.swing.GroupLayout.Alignment;
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
|
||||||
import javax.swing.SwingConstants;
|
|
||||||
import javax.swing.border.Border;
|
|
||||||
import javax.swing.border.LineBorder;
|
|
||||||
import mage.cards.decks.importer.DckDeckImporter;
|
import mage.cards.decks.importer.DckDeckImporter;
|
||||||
import mage.client.MageFrame;
|
import mage.client.MageFrame;
|
||||||
import mage.client.SessionHandler;
|
import mage.client.SessionHandler;
|
||||||
|
@ -44,26 +15,34 @@ import mage.client.util.gui.countryBox.CountryUtil;
|
||||||
import mage.components.ImagePanel;
|
import mage.components.ImagePanel;
|
||||||
import mage.components.ImagePanelStyle;
|
import mage.components.ImagePanelStyle;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import static mage.constants.Constants.DEFAULT_AVATAR_ID;
|
|
||||||
import static mage.constants.Constants.MAX_AVATAR_ID;
|
|
||||||
import static mage.constants.Constants.MIN_AVATAR_ID;
|
|
||||||
import mage.constants.ManaType;
|
import mage.constants.ManaType;
|
||||||
import mage.counters.Counter;
|
import mage.counters.Counter;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.designations.DesignationType;
|
import mage.designations.DesignationType;
|
||||||
import mage.utils.timer.PriorityTimer;
|
import mage.utils.timer.PriorityTimer;
|
||||||
import mage.view.CardView;
|
import mage.view.*;
|
||||||
import mage.view.ManaPoolView;
|
|
||||||
import mage.view.PlayerView;
|
|
||||||
import org.mage.card.arcane.ManaSymbols;
|
import org.mage.card.arcane.ManaSymbols;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.GroupLayout.Alignment;
|
||||||
|
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||||
|
import javax.swing.border.Border;
|
||||||
|
import javax.swing.border.LineBorder;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import static mage.constants.Constants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enhanced player pane.
|
* Enhanced player pane.
|
||||||
*
|
*
|
||||||
* @author nantuko
|
* @author nantuko, JayDi85
|
||||||
*/
|
*/
|
||||||
public class PlayerPanelExt extends javax.swing.JPanel {
|
public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
|
|
||||||
|
// TODO: *.form file was lost, panel must be reworks in designer
|
||||||
|
|
||||||
private UUID playerId;
|
private UUID playerId;
|
||||||
private UUID gameId;
|
private UUID gameId;
|
||||||
private PlayerView player;
|
private PlayerView player;
|
||||||
|
@ -84,6 +63,10 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
private final Color activeBackgroundColor = new Color(200, 255, 200, 200);
|
private final Color activeBackgroundColor = new Color(200, 255, 200, 200);
|
||||||
private final Color deadBackgroundColor = new Color(131, 94, 83, 200);
|
private final Color deadBackgroundColor = new Color(131, 94, 83, 200);
|
||||||
|
|
||||||
|
private final Color activeValueColor = new Color(244, 9, 47);
|
||||||
|
private final Font fontValuesZero = this.getFont().deriveFont(Font.PLAIN);
|
||||||
|
private final Font fontValuesNonZero = this.getFont().deriveFont(Font.BOLD);
|
||||||
|
|
||||||
private int avatarId = -1;
|
private int avatarId = -1;
|
||||||
private String flagName;
|
private String flagName;
|
||||||
private String basicTooltipText;
|
private String basicTooltipText;
|
||||||
|
@ -140,15 +123,44 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTextForLabel(JLabel label, int amount, boolean alwaysBlack) {
|
private void setTextForLabel(JLabel label, int amount, boolean alwaysBlack) {
|
||||||
|
setTextForLabel(label, amount, alwaysBlack, Color.BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTextForLabel(JLabel label, int amount, boolean alwaysBlack, Color fontColor) {
|
||||||
label.setText(Integer.toString(amount));
|
label.setText(Integer.toString(amount));
|
||||||
if (amount != 0 || alwaysBlack) {
|
if (amount != 0 || alwaysBlack) {
|
||||||
label.setForeground(Color.BLACK);
|
label.setForeground(fontColor);
|
||||||
|
label.setFont(fontValuesNonZero);
|
||||||
} else {
|
} else {
|
||||||
label.setForeground(new Color(100, 100, 100));
|
label.setForeground(new Color(100, 100, 100));
|
||||||
|
label.setFont(fontValuesZero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(PlayerView player) {
|
private boolean isCardsPlayable(Collection<CardView> cards, GameView gameView, Set<UUID> possibleTargets) {
|
||||||
|
if (cards != null) {
|
||||||
|
// can play
|
||||||
|
if (gameView != null && gameView.getCanPlayObjects() != null && gameView.getCanPlayObjects().size() > 0) {
|
||||||
|
for (CardView card : cards) {
|
||||||
|
if (gameView.getCanPlayObjects().contains(card.getId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// can select
|
||||||
|
if (possibleTargets != null && possibleTargets.size() > 0) {
|
||||||
|
for (CardView card : cards) {
|
||||||
|
if (possibleTargets.contains(card.getId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(GameView game, PlayerView player, Set<UUID> possibleTargets) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
int pastLife = player.getLife();
|
int pastLife = player.getLife();
|
||||||
if (playerLives != null) {
|
if (playerLives != null) {
|
||||||
|
@ -220,10 +232,26 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
graveLabel.setFont(font);
|
graveLabel.setFont(font);
|
||||||
changedFontGrave = false;
|
changedFontGrave = false;
|
||||||
}
|
}
|
||||||
setTextForLabel(graveLabel, graveCards, false);
|
|
||||||
|
Color graveColor = isCardsPlayable(player.getGraveyard().values(), game, possibleTargets) ? activeValueColor : Color.BLACK;
|
||||||
|
setTextForLabel(graveLabel, graveCards, false, graveColor);
|
||||||
graveLabel.setToolTipText("Card Types: " + qtyCardTypes(player.getGraveyard()));
|
graveLabel.setToolTipText("Card Types: " + qtyCardTypes(player.getGraveyard()));
|
||||||
|
|
||||||
|
Color commandColor = Color.BLACK;
|
||||||
|
for (CommandObjectView com : player.getCommandObjectList()) {
|
||||||
|
if (game != null && game.getCanPlayObjects() != null && game.getCanPlayObjects().contains(com.getId())) {
|
||||||
|
commandColor = activeValueColor;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (possibleTargets != null && possibleTargets.contains(com.getId())) {
|
||||||
|
commandColor = activeValueColor;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setTextForLabel(commandLabel, player.getCommandObjectList().size(), false, commandColor);
|
||||||
|
|
||||||
int exileCards = player.getExile().size();
|
int exileCards = player.getExile().size();
|
||||||
|
Color excileColor = isCardsPlayable(player.getExile().values(), game, possibleTargets) ? activeValueColor : Color.BLACK;
|
||||||
if (exileCards > 99) {
|
if (exileCards > 99) {
|
||||||
if (!changedFontExile) {
|
if (!changedFontExile) {
|
||||||
Font font = exileLabel.getFont();
|
Font font = exileLabel.getFont();
|
||||||
|
@ -237,7 +265,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
exileLabel.setFont(font);
|
exileLabel.setFont(font);
|
||||||
changedFontExile = false;
|
changedFontExile = false;
|
||||||
}
|
}
|
||||||
setTextForLabel(exileLabel, exileCards, false);
|
setTextForLabel(exileLabel, exileCards, false, excileColor);
|
||||||
|
|
||||||
if (!MageFrame.isLite()) {
|
if (!MageFrame.isLite()) {
|
||||||
int id = player.getUserData().getAvatarId();
|
int id = player.getUserData().getAvatarId();
|
||||||
|
@ -246,12 +274,12 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
if (id != avatarId) {
|
if (id != avatarId) {
|
||||||
avatarId = id;
|
avatarId = id;
|
||||||
String path = "/avatars/" + String.valueOf(avatarId) + ".jpg";
|
String path = "/avatars/" + avatarId + ".jpg";
|
||||||
if (avatarId == 64) {
|
if (avatarId == 64) {
|
||||||
path = "/avatars/i64.jpg";
|
path = "/avatars/i64.jpg";
|
||||||
} else if (avatarId >= 1000) {
|
} else if (avatarId >= 1000) {
|
||||||
avatarId = avatarId - 1000;
|
avatarId = avatarId - 1000;
|
||||||
path = "/avatars/special/" + String.valueOf(avatarId) + ".gif";
|
path = "/avatars/special/" + avatarId + ".gif";
|
||||||
}
|
}
|
||||||
Image image = ImageHelper.getImageFromResources(path);
|
Image image = ImageHelper.getImageFromResources(path);
|
||||||
Rectangle r = new Rectangle(80, 80);
|
Rectangle r = new Rectangle(80, 80);
|
||||||
|
@ -364,15 +392,41 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void update(ManaPoolView pool) {
|
protected void update(ManaPoolView pool) {
|
||||||
setTextForLabel(manaLabels.get("B"), pool.getBlack(), false);
|
for (Map.Entry<JLabel, ManaType> mana : manaLabels.entrySet()) {
|
||||||
setTextForLabel(manaLabels.get("R"), pool.getRed(), false);
|
switch (mana.getValue()) {
|
||||||
setTextForLabel(manaLabels.get("W"), pool.getWhite(), false);
|
case BLACK:
|
||||||
setTextForLabel(manaLabels.get("G"), pool.getGreen(), false);
|
setTextForLabel(mana.getKey(), pool.getBlack(), false, activeValueColor);
|
||||||
setTextForLabel(manaLabels.get("U"), pool.getBlue(), false);
|
break;
|
||||||
setTextForLabel(manaLabels.get("X"), pool.getColorless(), false);
|
case RED:
|
||||||
|
setTextForLabel(mana.getKey(), pool.getRed(), false, activeValueColor);
|
||||||
|
break;
|
||||||
|
case WHITE:
|
||||||
|
setTextForLabel(mana.getKey(), pool.getWhite(), false, activeValueColor);
|
||||||
|
break;
|
||||||
|
case GREEN:
|
||||||
|
setTextForLabel(mana.getKey(), pool.getGreen(), false, activeValueColor);
|
||||||
|
break;
|
||||||
|
case BLUE:
|
||||||
|
setTextForLabel(mana.getKey(), pool.getBlue(), false, activeValueColor);
|
||||||
|
break;
|
||||||
|
case COLORLESS:
|
||||||
|
setTextForLabel(mana.getKey(), pool.getColorless(), false, activeValueColor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HoverButton btn = manaButtons.get(mana.getKey());
|
||||||
|
//mana.getKey().setOpaque(true);
|
||||||
|
//mana.getKey().setBackground(Color.green);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called from within the constructor to initialize the form.
|
||||||
|
* WARNING: Do NOT modify this code. The content of this method is always
|
||||||
|
* regenerated by the Form Editor.
|
||||||
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|
||||||
panelBackground = new MageRoundPane();
|
panelBackground = new MageRoundPane();
|
||||||
|
@ -387,6 +441,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
energyLabel = new JLabel();
|
energyLabel = new JLabel();
|
||||||
experienceLabel = new JLabel();
|
experienceLabel = new JLabel();
|
||||||
graveLabel = new JLabel();
|
graveLabel = new JLabel();
|
||||||
|
commandLabel = new JLabel();
|
||||||
libraryLabel = new JLabel();
|
libraryLabel = new JLabel();
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
|
|
||||||
|
@ -482,6 +537,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
cheat.addActionListener(e -> btnCheatActionPerformed(e));
|
cheat.addActionListener(e -> btnCheatActionPerformed(e));
|
||||||
|
|
||||||
zonesPanel = new JPanel();
|
zonesPanel = new JPanel();
|
||||||
|
//zonesPanel.setBorder(BorderFactory.createLineBorder(Color.red));
|
||||||
zonesPanel.setPreferredSize(new Dimension(100, 60));
|
zonesPanel.setPreferredSize(new Dimension(100, 60));
|
||||||
zonesPanel.setSize(100, 60);
|
zonesPanel.setSize(100, 60);
|
||||||
zonesPanel.setLayout(null);
|
zonesPanel.setLayout(null);
|
||||||
|
@ -491,13 +547,17 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
r = new Rectangle(21, 21);
|
r = new Rectangle(21, 21);
|
||||||
resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
||||||
commandZone = new HoverButton(null, resized, resized, resized, r);
|
commandZone = new HoverButton(null, resized, resized, resized, r);
|
||||||
commandZone.setToolTipText("Command Zone (Commander and Emblems)");
|
commandZone.setToolTipText("Command Zone (Commanders, Emblems and Planes)");
|
||||||
commandZone.setOpaque(false);
|
commandZone.setOpaque(false);
|
||||||
commandZone.setObserver(() -> btnCommandZoneActionPerformed(null));
|
commandZone.setObserver(() -> btnCommandZoneActionPerformed(null));
|
||||||
commandZone.setBounds(5, 0, 21, 21);
|
commandZone.setBounds(3, 0, 21, 21);
|
||||||
zonesPanel.add(commandZone);
|
zonesPanel.add(commandZone);
|
||||||
|
|
||||||
cheat.setBounds(28, 0, 25, 21);
|
commandLabel.setToolTipText("Command zone");
|
||||||
|
commandLabel.setBounds(25, 0, 21, 21);
|
||||||
|
zonesPanel.add(commandLabel);
|
||||||
|
|
||||||
|
cheat.setBounds(40, 2, 25, 21);
|
||||||
zonesPanel.add(cheat);
|
zonesPanel.add(cheat);
|
||||||
|
|
||||||
energyExperiencePanel = new JPanel();
|
energyExperiencePanel = new JPanel();
|
||||||
|
@ -533,72 +593,99 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
btnPlayer.addActionListener(e -> SessionHandler.sendPlayerUUID(gameId, playerId));
|
btnPlayer.addActionListener(e -> SessionHandler.sendPlayerUUID(gameId, playerId));
|
||||||
|
|
||||||
// Add mana symbols
|
// Add mana symbols
|
||||||
|
// TODO: replace "button + label" to label on rework
|
||||||
|
/*
|
||||||
|
MouseAdapter manaMouseAdapter = new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent evt) {
|
||||||
|
JLabel label = (JLabel) evt.getSource();
|
||||||
|
if (manaLabels.containsKey(label)) {
|
||||||
|
btnManaActionPerformed(manaLabels.get(label));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
JLabel manaCountLabelW = new JLabel();
|
JLabel manaCountLabelW = new JLabel();
|
||||||
manaCountLabelW.setToolTipText("White mana");
|
manaCountLabelW.setToolTipText("White mana");
|
||||||
setTextForLabel(manaCountLabelW, 0, false);
|
setTextForLabel(manaCountLabelW, 0, false);
|
||||||
manaLabels.put("W", manaCountLabelW);
|
manaCountLabelW.setIcon(new ImageIcon(ManaSymbols.getSizedManaSymbol("W", 15)));
|
||||||
|
manaCountLabelW.addMouseListener(manaMouseAdapter);
|
||||||
|
manaLabels.put(manaCountLabelW, ManaType.WHITE);l
|
||||||
|
//*/
|
||||||
|
|
||||||
|
///*
|
||||||
|
JLabel manaCountLabelW = new JLabel();
|
||||||
|
manaCountLabelW.setToolTipText("White mana");
|
||||||
|
setTextForLabel(manaCountLabelW, 0, false);
|
||||||
|
manaLabels.put(manaCountLabelW, ManaType.WHITE);
|
||||||
r = new Rectangle(15, 15);
|
r = new Rectangle(15, 15);
|
||||||
BufferedImage imageManaW = ManaSymbols.getSizedManaSymbol("W", 15);
|
BufferedImage imageManaW = ManaSymbols.getSizedManaSymbol("W", 15);
|
||||||
HoverButton btnWhiteMana = new HoverButton(null, imageManaW, imageManaW, imageManaW, r);
|
HoverButton btnWhiteMana = new HoverButton(null, imageManaW, imageManaW, imageManaW, r);
|
||||||
|
|
||||||
btnWhiteMana.setToolTipText("White mana");
|
btnWhiteMana.setToolTipText("White mana");
|
||||||
btnWhiteMana.setOpaque(false);
|
btnWhiteMana.setOpaque(false);
|
||||||
btnWhiteMana.setObserver(() -> btnManaActionPerformed(ManaType.WHITE));
|
btnWhiteMana.setObserver(() -> btnManaActionPerformed(ManaType.WHITE));
|
||||||
|
manaButtons.put(manaCountLabelW, btnWhiteMana);
|
||||||
|
//*/
|
||||||
|
|
||||||
JLabel manaCountLabelU = new JLabel();
|
JLabel manaCountLabelU = new JLabel();
|
||||||
manaCountLabelU.setToolTipText("Blue mana");
|
manaCountLabelU.setToolTipText("Blue mana");
|
||||||
setTextForLabel(manaCountLabelU, 0, false);
|
setTextForLabel(manaCountLabelU, 0, false);
|
||||||
manaLabels.put("U", manaCountLabelU);
|
manaLabels.put(manaCountLabelU, ManaType.BLUE);
|
||||||
r = new Rectangle(15, 15);
|
r = new Rectangle(15, 15);
|
||||||
BufferedImage imageManaU = ManaSymbols.getSizedManaSymbol("U", 15);
|
BufferedImage imageManaU = ManaSymbols.getSizedManaSymbol("U", 15);
|
||||||
HoverButton btnBlueMana = new HoverButton(null, imageManaU, imageManaU, imageManaU, r);
|
HoverButton btnBlueMana = new HoverButton(null, imageManaU, imageManaU, imageManaU, r);
|
||||||
btnBlueMana.setToolTipText("Blue mana");
|
btnBlueMana.setToolTipText("Blue mana");
|
||||||
btnBlueMana.setOpaque(false);
|
btnBlueMana.setOpaque(false);
|
||||||
btnBlueMana.setObserver(() -> btnManaActionPerformed(ManaType.BLUE));
|
btnBlueMana.setObserver(() -> btnManaActionPerformed(ManaType.BLUE));
|
||||||
|
manaButtons.put(manaCountLabelU, btnBlueMana);
|
||||||
|
|
||||||
JLabel manaCountLabelB = new JLabel();
|
JLabel manaCountLabelB = new JLabel();
|
||||||
manaCountLabelB.setToolTipText("Black mana");
|
manaCountLabelB.setToolTipText("Black mana");
|
||||||
setTextForLabel(manaCountLabelB, 0, false);
|
setTextForLabel(manaCountLabelB, 0, false);
|
||||||
manaLabels.put("B", manaCountLabelB);
|
manaLabels.put(manaCountLabelB, ManaType.BLACK);
|
||||||
r = new Rectangle(15, 15);
|
r = new Rectangle(15, 15);
|
||||||
BufferedImage imageManaB = ManaSymbols.getSizedManaSymbol("B", 15);
|
BufferedImage imageManaB = ManaSymbols.getSizedManaSymbol("B", 15);
|
||||||
HoverButton btnBlackMana = new HoverButton(null, imageManaB, imageManaB, imageManaB, r);
|
HoverButton btnBlackMana = new HoverButton(null, imageManaB, imageManaB, imageManaB, r);
|
||||||
btnBlackMana.setToolTipText("Black mana");
|
btnBlackMana.setToolTipText("Black mana");
|
||||||
btnBlackMana.setOpaque(false);
|
btnBlackMana.setOpaque(false);
|
||||||
btnBlackMana.setObserver(() -> btnManaActionPerformed(ManaType.BLACK));
|
btnBlackMana.setObserver(() -> btnManaActionPerformed(ManaType.BLACK));
|
||||||
|
manaButtons.put(manaCountLabelB, btnBlackMana);
|
||||||
|
|
||||||
JLabel manaCountLabelR = new JLabel();
|
JLabel manaCountLabelR = new JLabel();
|
||||||
manaCountLabelR.setToolTipText("Red mana");
|
manaCountLabelR.setToolTipText("Red mana");
|
||||||
setTextForLabel(manaCountLabelR, 0, false);
|
setTextForLabel(manaCountLabelR, 0, false);
|
||||||
manaLabels.put("R", manaCountLabelR);
|
manaLabels.put(manaCountLabelR, ManaType.RED);
|
||||||
r = new Rectangle(15, 15);
|
r = new Rectangle(15, 15);
|
||||||
BufferedImage imageManaR = ManaSymbols.getSizedManaSymbol("R", 15);
|
BufferedImage imageManaR = ManaSymbols.getSizedManaSymbol("R", 15);
|
||||||
HoverButton btnRedMana = new HoverButton(null, imageManaR, imageManaR, imageManaR, r);
|
HoverButton btnRedMana = new HoverButton(null, imageManaR, imageManaR, imageManaR, r);
|
||||||
btnRedMana.setToolTipText("Red mana");
|
btnRedMana.setToolTipText("Red mana");
|
||||||
btnRedMana.setOpaque(false);
|
btnRedMana.setOpaque(false);
|
||||||
btnRedMana.setObserver(() -> btnManaActionPerformed(ManaType.RED));
|
btnRedMana.setObserver(() -> btnManaActionPerformed(ManaType.RED));
|
||||||
|
manaButtons.put(manaCountLabelR, btnRedMana);
|
||||||
|
|
||||||
JLabel manaCountLabelG = new JLabel();
|
JLabel manaCountLabelG = new JLabel();
|
||||||
manaCountLabelG.setToolTipText("Green mana");
|
manaCountLabelG.setToolTipText("Green mana");
|
||||||
setTextForLabel(manaCountLabelG, 0, false);
|
setTextForLabel(manaCountLabelG, 0, false);
|
||||||
manaLabels.put("G", manaCountLabelG);
|
manaLabels.put(manaCountLabelG, ManaType.GREEN);
|
||||||
r = new Rectangle(15, 15);
|
r = new Rectangle(15, 15);
|
||||||
BufferedImage imageManaG = ManaSymbols.getSizedManaSymbol("G", 15);
|
BufferedImage imageManaG = ManaSymbols.getSizedManaSymbol("G", 15);
|
||||||
HoverButton btnGreenMana = new HoverButton(null, imageManaG, imageManaG, imageManaG, r);
|
HoverButton btnGreenMana = new HoverButton(null, imageManaG, imageManaG, imageManaG, r);
|
||||||
btnGreenMana.setToolTipText("Green mana");
|
btnGreenMana.setToolTipText("Green mana");
|
||||||
btnGreenMana.setOpaque(false);
|
btnGreenMana.setOpaque(false);
|
||||||
btnGreenMana.setObserver(() -> btnManaActionPerformed(ManaType.GREEN));
|
btnGreenMana.setObserver(() -> btnManaActionPerformed(ManaType.GREEN));
|
||||||
|
manaButtons.put(manaCountLabelG, btnGreenMana);
|
||||||
|
|
||||||
JLabel manaCountLabelX = new JLabel();
|
JLabel manaCountLabelX = new JLabel();
|
||||||
manaCountLabelX.setToolTipText("Colorless mana");
|
manaCountLabelX.setToolTipText("Colorless mana");
|
||||||
setTextForLabel(manaCountLabelX, 0, false);
|
setTextForLabel(manaCountLabelX, 0, false);
|
||||||
manaLabels.put("X", manaCountLabelX);
|
manaLabels.put(manaCountLabelX, ManaType.COLORLESS);
|
||||||
r = new Rectangle(15, 15);
|
r = new Rectangle(15, 15);
|
||||||
BufferedImage imageManaX = ManaSymbols.getSizedManaSymbol("C", 15);
|
BufferedImage imageManaX = ManaSymbols.getSizedManaSymbol("C", 15);
|
||||||
HoverButton btnColorlessMana = new HoverButton(null, imageManaX, imageManaX, imageManaX, r);
|
HoverButton btnColorlessMana = new HoverButton(null, imageManaX, imageManaX, imageManaX, r);
|
||||||
btnColorlessMana.setToolTipText("Colorless mana");
|
btnColorlessMana.setToolTipText("Colorless mana");
|
||||||
btnColorlessMana.setOpaque(false);
|
btnColorlessMana.setOpaque(false);
|
||||||
btnColorlessMana.setObserver(() -> btnManaActionPerformed(ManaType.COLORLESS));
|
btnColorlessMana.setObserver(() -> btnManaActionPerformed(ManaType.COLORLESS));
|
||||||
|
manaButtons.put(manaCountLabelX, btnColorlessMana);
|
||||||
|
|
||||||
GroupLayout gl_panelBackground = new GroupLayout(panelBackground);
|
GroupLayout gl_panelBackground = new GroupLayout(panelBackground);
|
||||||
gl_panelBackground.setHorizontalGroup(
|
gl_panelBackground.setHorizontalGroup(
|
||||||
|
@ -674,9 +761,6 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||||
.addGap(40)
|
.addGap(40)
|
||||||
.addComponent(experienceLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
|
.addComponent(experienceLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
|
||||||
/*.addGroup(gl_panelBackground.createSequentialGroup()
|
|
||||||
.addGap(18)
|
|
||||||
.addComponent(cheat, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))*/
|
|
||||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||||
.addGap(18)
|
.addGap(18)
|
||||||
.addComponent(exileZone, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)
|
.addComponent(exileZone, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)
|
||||||
|
@ -776,9 +860,6 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
.addGap(31)
|
.addGap(31)
|
||||||
.addComponent(manaCountLabelG, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
|
.addComponent(manaCountLabelG, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
|
||||||
.addComponent(experienceLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
|
.addComponent(experienceLabel, 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()
|
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||||
.addGap(76)
|
.addGap(76)
|
||||||
.addComponent(exileZone, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
|
.addComponent(exileZone, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
|
||||||
|
@ -812,7 +893,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
);
|
);
|
||||||
setLayout(groupLayout);
|
setLayout(groupLayout);
|
||||||
|
|
||||||
}
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
protected void sizePlayerPanel(boolean smallMode) {
|
protected void sizePlayerPanel(boolean smallMode) {
|
||||||
if (smallMode) {
|
if (smallMode) {
|
||||||
|
@ -850,7 +931,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
DialogManager.getManager(gameId).showExileDialog(player.getExile(), bigCard, gameId);
|
DialogManager.getManager(gameId).showExileDialog(player.getExile(), bigCard, gameId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnCheatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheatActionPerformed
|
private void btnCheatActionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
DckDeckImporter deckImporter = new DckDeckImporter();
|
DckDeckImporter deckImporter = new DckDeckImporter();
|
||||||
SessionHandler.cheat(gameId, playerId, deckImporter.importDeck("cheat.dck"));
|
SessionHandler.cheat(gameId, playerId, deckImporter.importDeck("cheat.dck"));
|
||||||
}
|
}
|
||||||
|
@ -875,6 +956,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private HoverButton avatar;
|
private HoverButton avatar;
|
||||||
private JButton btnPlayer;
|
private JButton btnPlayer;
|
||||||
private ImagePanel life;
|
private ImagePanel life;
|
||||||
|
@ -895,16 +977,20 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
private JLabel energyLabel;
|
private JLabel energyLabel;
|
||||||
private JLabel experienceLabel;
|
private JLabel experienceLabel;
|
||||||
private JLabel graveLabel;
|
private JLabel graveLabel;
|
||||||
|
private JLabel commandLabel;
|
||||||
private JLabel exileLabel;
|
private JLabel exileLabel;
|
||||||
private boolean changedFontLibrary;
|
|
||||||
private boolean changedFontLife;
|
|
||||||
private boolean changedFontGrave;
|
|
||||||
private boolean changedFontExile;
|
|
||||||
|
|
||||||
private JPanel zonesPanel;
|
private JPanel zonesPanel;
|
||||||
private JPanel energyExperiencePanel;
|
private JPanel energyExperiencePanel;
|
||||||
private HoverButton exileZone;
|
private HoverButton exileZone;
|
||||||
private HoverButton commandZone;
|
private HoverButton commandZone;
|
||||||
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
|
private boolean changedFontLibrary;
|
||||||
|
private boolean changedFontLife;
|
||||||
|
private boolean changedFontGrave;
|
||||||
|
private boolean changedFontExile;
|
||||||
|
private final Map<JLabel, ManaType> manaLabels = new HashMap<>();
|
||||||
|
private final Map<JLabel, HoverButton> manaButtons = new HashMap<>();
|
||||||
|
|
||||||
private final Map<String, JLabel> manaLabels = new HashMap<>();
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue