topCardPanel = Plugins.getInstance().getMageCard(new CardView(CardRepository.instance.findCard("Forest").getMockCard()), bigCard, topCardDimension, gameId, true);
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);
String showPlayerNamePermanently = MageFrame.getPreferences().get(PreferencesDialog.KEY_SHOW_PLAYER_NAMES_PERMANENTLY, "true");
if (showPlayerNamePermanently.equals("true")) {
avatar.setTextAlwaysVisible(true);
}
avatar.setTextOffsetButtonY(10);
avatar.setObserver(new Command() {
@Override
public void execute() {
session.sendPlayerUUID(gameId, playerId);
}
});
// timer area /small layout)
timerLabel.setToolTipText("Time left");
timerLabel.setSize(80,12);
timerLabel.setHorizontalAlignment(SwingConstants.CENTER);
// life area
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);
// hand area
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);
// Library
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);
}
});
exileLabel = new JLabel();
exileLabel.setToolTipText("Exile");
image = ImageHelper.getImageFromResources("/info/exile.png");
r = new Rectangle(21, 21);
resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
exileZone = new HoverButton(null, resized, resized, resized, r);
exileZone.setToolTipText("Exile");
exileZone.setOpaque(false);
exileZone.setObserver(new Command() {
@Override
public void execute() {
btnExileZoneActionPerformed(null);
}
});
exileZone.setBounds(25, 0, 21, 21);
// 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);
}
});
zonesPanel = new JPanel();
zonesPanel.setPreferredSize(new Dimension(100, 20));
zonesPanel.setSize(100, 20);
zonesPanel.setLayout(null);
image = ImageHelper.getImageFromResources("/info/command_zone.png");
r = new Rectangle(21, 21);
resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
commandZone = new HoverButton(null, resized, resized, resized, r);
commandZone.setToolTipText("Command Zone (Commander and Emblems)");
commandZone.setOpaque(false);
commandZone.setObserver(new Command() {
@Override
public void execute() {
btnCommandZoneActionPerformed(null);
}
});
commandZone.setBounds(5, 0, 21, 21);
zonesPanel.add(commandZone);
cheat.setBounds(28, 0, 25, 21);
zonesPanel.add(cheat);
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
JLabel manaCountLabelW = new JLabel();
manaCountLabelW.setToolTipText("White mana");
manaCountLabelW.setText("0");
manaLabels.put("W", manaCountLabelW);
r = new Rectangle(12, 12);
BufferedImage imageManaW = ManaSymbols.getManaSymbolImageSmall("W");
HoverButton btnWhiteMana = new HoverButton(null, imageManaW, imageManaW, imageManaW, r);
btnWhiteMana.setToolTipText("White mana");
btnWhiteMana.setOpaque(false);
btnWhiteMana.setObserver(new Command() {
@Override
public void execute() {
btnManaActionPerformed(ManaType.WHITE);
}
});
JLabel manaCountLabelU = new JLabel();
manaCountLabelU.setToolTipText("Blue mana");
manaCountLabelU.setText("0");
manaLabels.put("U", manaCountLabelU);
r = new Rectangle(12, 12);
BufferedImage imageManaU = ManaSymbols.getManaSymbolImageSmall("U");
HoverButton btnBlueMana = new HoverButton(null, imageManaU, imageManaU, imageManaU, r);
btnBlueMana.setToolTipText("Blue mana");
btnBlueMana.setOpaque(false);
btnBlueMana.setObserver(new Command() {
@Override
public void execute() {
btnManaActionPerformed(ManaType.BLUE);
}
});
JLabel manaCountLabelB = new JLabel();
manaCountLabelB.setToolTipText("Black mana");
manaCountLabelB.setText("0");
manaLabels.put("B", manaCountLabelB);
r = new Rectangle(12, 12);
BufferedImage imageManaB = ManaSymbols.getManaSymbolImageSmall("B");
HoverButton btnBlackMana = new HoverButton(null, imageManaB, imageManaB, imageManaB, r);
btnBlackMana.setToolTipText("Black mana");
btnBlackMana.setOpaque(false);
btnBlackMana.setObserver(new Command() {
@Override
public void execute() {
btnManaActionPerformed(ManaType.BLACK);
}
});
JLabel manaCountLabelR = new JLabel();
manaCountLabelR.setToolTipText("Red mana");
manaCountLabelR.setText("0");
manaLabels.put("R", manaCountLabelR);
r = new Rectangle(12, 12);
BufferedImage imageManaR = ManaSymbols.getManaSymbolImageSmall("R");
HoverButton btnRedMana = new HoverButton(null, imageManaR, imageManaR, imageManaR, r);
btnRedMana.setToolTipText("Red mana");
btnRedMana.setOpaque(false);
btnRedMana.setObserver(new Command() {
@Override
public void execute() {
btnManaActionPerformed(ManaType.RED);
}
});
JLabel manaCountLabelG = new JLabel();
manaCountLabelG.setToolTipText("Green mana");
manaCountLabelG.setText("0");
manaLabels.put("G", manaCountLabelG);
r = new Rectangle(12, 12);
BufferedImage imageManaG = ManaSymbols.getManaSymbolImageSmall("G");
HoverButton btnGreenMana = new HoverButton(null, imageManaG, imageManaG, imageManaG, r);
btnGreenMana.setToolTipText("Green mana");
btnGreenMana.setOpaque(false);
btnGreenMana.setObserver(new Command() {
@Override
public void execute() {
btnManaActionPerformed(ManaType.GREEN);
}
});
JLabel manaCountLabelX = new JLabel();
manaCountLabelX.setToolTipText("Colorless mana");
manaCountLabelX.setText("0");
manaLabels.put("X", manaCountLabelX);
r = new Rectangle(12, 12);
BufferedImage imageManaX = ManaSymbols.getManaSymbolImageSmall("X");
HoverButton btnColorlessMana = new HoverButton(null, imageManaX, imageManaX, imageManaX, r);
btnColorlessMana.setToolTipText("Colorless mana");
btnColorlessMana.setOpaque(false);
btnColorlessMana.setObserver(new Command() {
@Override
public void execute() {
btnManaActionPerformed(ManaType.COLORLESS);
}
});