mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- Card Overlays option added to Game menu.
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -14989,6 +14989,7 @@ src/main/java/forge/gui/match/controllers/CPlayers.java -text
|
|||||||
src/main/java/forge/gui/match/controllers/CStack.java -text
|
src/main/java/forge/gui/match/controllers/CStack.java -text
|
||||||
src/main/java/forge/gui/match/controllers/package-info.java svneol=native#text/plain
|
src/main/java/forge/gui/match/controllers/package-info.java svneol=native#text/plain
|
||||||
src/main/java/forge/gui/match/menus/CMatchUIMenus.java -text
|
src/main/java/forge/gui/match/menus/CMatchUIMenus.java -text
|
||||||
|
src/main/java/forge/gui/match/menus/CardOverlaysMenu.java -text
|
||||||
src/main/java/forge/gui/match/menus/DevModeMenu.java -text
|
src/main/java/forge/gui/match/menus/DevModeMenu.java -text
|
||||||
src/main/java/forge/gui/match/menus/GameMenu.java -text
|
src/main/java/forge/gui/match/menus/GameMenu.java -text
|
||||||
src/main/java/forge/gui/match/nonsingleton/CCommand.java -text
|
src/main/java/forge/gui/match/nonsingleton/CCommand.java -text
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ import forge.gui.toolbox.FSkin;
|
|||||||
import forge.gui.toolbox.special.PhaseLabel;
|
import forge.gui.toolbox.special.PhaseLabel;
|
||||||
import forge.item.InventoryItem;
|
import forge.item.InventoryItem;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
|
import forge.view.arcane.CardPanel;
|
||||||
import forge.view.arcane.PlayArea;
|
import forge.view.arcane.PlayArea;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -430,4 +431,23 @@ public enum CMatchUI implements ICDoc, IMenuProvider {
|
|||||||
@Override
|
@Override
|
||||||
public void update() { }
|
public void update() { }
|
||||||
|
|
||||||
|
public void repaintCardOverlays() {
|
||||||
|
List<CardPanel> panels = getVisibleCardPanels();
|
||||||
|
for (CardPanel panel : panels) {
|
||||||
|
panel.repaintOverlays();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private List<CardPanel> getVisibleCardPanels() {
|
||||||
|
List<CardPanel> panels = new ArrayList<CardPanel>();
|
||||||
|
for (VHand h : view.getHands()) {
|
||||||
|
panels.addAll(h.getHandArea().getCardPanels());
|
||||||
|
}
|
||||||
|
for (VField f : view.getFieldViews()) {
|
||||||
|
panels.addAll(f.getTabletop().getCardPanels());
|
||||||
|
}
|
||||||
|
for (VCommand c : view.getCommandViews()) {
|
||||||
|
panels.addAll(c.getTabletop().getCardPanels());
|
||||||
|
}
|
||||||
|
return panels;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
107
src/main/java/forge/gui/match/menus/CardOverlaysMenu.java
Normal file
107
src/main/java/forge/gui/match/menus/CardOverlaysMenu.java
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
package forge.gui.match.menus;
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
|
||||||
|
import javax.swing.JCheckBoxMenuItem;
|
||||||
|
import javax.swing.JMenu;
|
||||||
|
import javax.swing.JMenuItem;
|
||||||
|
import javax.swing.JPopupMenu;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
import forge.Singletons;
|
||||||
|
import forge.gui.match.CMatchUI;
|
||||||
|
import forge.gui.menubar.MenuUtil;
|
||||||
|
import forge.properties.ForgePreferences;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
|
|
||||||
|
public final class CardOverlaysMenu {
|
||||||
|
private CardOverlaysMenu() { }
|
||||||
|
|
||||||
|
private static ForgePreferences prefs = Singletons.getModel().getPreferences();
|
||||||
|
private static boolean showOverlays = prefs.getPrefBoolean(FPref.UI_SHOW_CARD_OVERLAYS);
|
||||||
|
|
||||||
|
public static JMenu getMenu(boolean showMenuIcons) {
|
||||||
|
JMenu menu = new JMenu("Card Overlays");
|
||||||
|
menu.add(getMenuItem_ShowOverlays());
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.add(getMenuItem_CardOverlay("Card Name", FPref.UI_OVERLAY_CARD_NAME));
|
||||||
|
menu.add(getMenuItem_CardOverlay("Mana Cost", FPref.UI_OVERLAY_CARD_MANA_COST));
|
||||||
|
menu.add(getMenuItem_CardOverlay("Power/Toughness", FPref.UI_OVERLAY_CARD_POWER));
|
||||||
|
menu.add(getMenuItem_CardOverlay("Card Id", FPref.UI_OVERLAY_CARD_ID));
|
||||||
|
return menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JMenuItem getMenuItem_CardOverlay(String menuCaption, FPref pref) {
|
||||||
|
JCheckBoxMenuItem menu = new JCheckBoxMenuItem(menuCaption);
|
||||||
|
menu.setState(prefs.getPrefBoolean(pref));
|
||||||
|
menu.setEnabled(showOverlays);
|
||||||
|
menu.addActionListener(getCardOverlaysAction(pref));
|
||||||
|
return menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JMenuItem getMenuItem_ShowOverlays() {
|
||||||
|
JCheckBoxMenuItem menu = new JCheckBoxMenuItem("Show");
|
||||||
|
menu.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_O));
|
||||||
|
menu.setState(prefs.getPrefBoolean(FPref.UI_SHOW_CARD_OVERLAYS));
|
||||||
|
menu.addActionListener(getShowOverlaysAction());
|
||||||
|
return menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ActionListener getShowOverlaysAction() {
|
||||||
|
return new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
toggleCardOverlayDisplay((JMenuItem)e.getSource());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void toggleCardOverlayDisplay(JMenuItem showMenu) {
|
||||||
|
toggleShowOverlaySetting();
|
||||||
|
repaintCardOverlays();
|
||||||
|
// Enable/disable overlay menu items based on state of "Show" menu.
|
||||||
|
for (Component c : ((JPopupMenu)showMenu.getParent()).getComponents()) {
|
||||||
|
if (c instanceof JMenuItem) {
|
||||||
|
JMenuItem m = (JMenuItem)c;
|
||||||
|
if (m != showMenu) {
|
||||||
|
m.setEnabled(prefs.getPrefBoolean(FPref.UI_SHOW_CARD_OVERLAYS));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void toggleShowOverlaySetting() {
|
||||||
|
boolean isOverlayEnabled = !prefs.getPrefBoolean(FPref.UI_SHOW_CARD_OVERLAYS);
|
||||||
|
prefs.setPref(FPref.UI_SHOW_CARD_OVERLAYS, isOverlayEnabled);
|
||||||
|
prefs.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ActionListener getCardOverlaysAction(final FPref overlaySetting) {
|
||||||
|
return new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
toggleOverlaySetting(overlaySetting);
|
||||||
|
repaintCardOverlays();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void toggleOverlaySetting(FPref overlaySetting) {
|
||||||
|
boolean isOverlayEnabled = !prefs.getPrefBoolean(overlaySetting);
|
||||||
|
prefs.setPref(overlaySetting, isOverlayEnabled);
|
||||||
|
prefs.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void repaintCardOverlays() {
|
||||||
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
CMatchUI.SINGLETON_INSTANCE.repaintCardOverlays();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,6 +40,8 @@ public final class GameMenu {
|
|||||||
menu.add(getMenuItem_AlphaStrike());
|
menu.add(getMenuItem_AlphaStrike());
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
menu.add(getMenuItem_TargetingArcs());
|
menu.add(getMenuItem_TargetingArcs());
|
||||||
|
menu.add(CardOverlaysMenu.getMenu(showMenuIcons));
|
||||||
|
menu.addSeparator();
|
||||||
menu.add(getMenuItem_GameSoundEffects());
|
menu.add(getMenuItem_GameSoundEffects());
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
menu.add(getMenuItem_ViewDeckList());
|
menu.add(getMenuItem_ViewDeckList());
|
||||||
|
|||||||
@@ -39,9 +39,11 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
|
|||||||
UI_RANDOM_FOIL ("false"),
|
UI_RANDOM_FOIL ("false"),
|
||||||
UI_SMOOTH_LAND ("false"),
|
UI_SMOOTH_LAND ("false"),
|
||||||
UI_AVATARS ("0,1"),
|
UI_AVATARS ("0,1"),
|
||||||
|
UI_SHOW_CARD_OVERLAYS ("true"),
|
||||||
UI_OVERLAY_CARD_NAME ("true"),
|
UI_OVERLAY_CARD_NAME ("true"),
|
||||||
UI_OVERLAY_CARD_POWER ("true"),
|
UI_OVERLAY_CARD_POWER ("true"),
|
||||||
UI_OVERLAY_CARD_MANA_COST ("true"),
|
UI_OVERLAY_CARD_MANA_COST ("true"),
|
||||||
|
UI_OVERLAY_CARD_ID ("true"),
|
||||||
UI_UPLOAD_DRAFT ("false"),
|
UI_UPLOAD_DRAFT ("false"),
|
||||||
UI_SCALE_LARGER ("true"),
|
UI_SCALE_LARGER ("true"),
|
||||||
UI_MAX_STACK ("3"),
|
UI_MAX_STACK ("3"),
|
||||||
|
|||||||
@@ -115,11 +115,12 @@ public class CardPanel extends JPanel implements CardContainer {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private final ScaledImagePanel imagePanel;
|
private ScaledImagePanel imagePanel;
|
||||||
|
|
||||||
private final OutlinedLabel titleText;
|
private OutlinedLabel titleText;
|
||||||
private final OutlinedLabel ptText;
|
private OutlinedLabel ptText;
|
||||||
private final OutlinedLabel damageText;
|
private OutlinedLabel damageText;
|
||||||
|
private OutlinedLabel cardIdText;
|
||||||
private final List<CardPanel> imageLoadListeners = new ArrayList<CardPanel>(2);
|
private final List<CardPanel> imageLoadListeners = new ArrayList<CardPanel>(2);
|
||||||
private boolean displayEnabled = true;
|
private boolean displayEnabled = true;
|
||||||
private boolean isAnimationPanel;
|
private boolean isAnimationPanel;
|
||||||
@@ -135,31 +136,20 @@ public class CardPanel extends JPanel implements CardContainer {
|
|||||||
* a {@link forge.Card} object.
|
* a {@link forge.Card} object.
|
||||||
*/
|
*/
|
||||||
public CardPanel(final Card newGameCard) {
|
public CardPanel(final Card newGameCard) {
|
||||||
this.setGameCard(newGameCard);
|
this.gameCard = newGameCard;
|
||||||
|
|
||||||
this.setBackground(Color.black);
|
this.setBackground(Color.black);
|
||||||
this.setOpaque(false);
|
this.setOpaque(false);
|
||||||
|
|
||||||
this.titleText = new OutlinedLabel();
|
createCardNameOverlay();
|
||||||
this.titleText.setFont(this.getFont().deriveFont(Font.BOLD, 13f));
|
createPTOverlay();
|
||||||
this.titleText.setForeground(Color.white);
|
createCardIdOverlay();
|
||||||
this.titleText.setGlow(Color.black);
|
createScaleImagePanel();
|
||||||
this.titleText.setWrap(true);
|
|
||||||
this.add(this.titleText);
|
|
||||||
|
|
||||||
this.ptText = new OutlinedLabel();
|
|
||||||
this.ptText.setFont(this.getFont().deriveFont(Font.BOLD, 13f));
|
|
||||||
this.ptText.setForeground(Color.white);
|
|
||||||
this.ptText.setGlow(Color.black);
|
|
||||||
this.add(this.ptText);
|
|
||||||
|
|
||||||
this.damageText = new OutlinedLabel();
|
|
||||||
this.damageText.setFont(this.getFont().deriveFont(Font.BOLD, 15f));
|
|
||||||
this.damageText.setForeground(new Color(160,0,0));
|
|
||||||
this.damageText.setGlow(Color.white);
|
|
||||||
this.add(this.damageText);
|
|
||||||
|
|
||||||
|
this.setCard(newGameCard);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createScaleImagePanel() {
|
||||||
this.imagePanel = new ScaledImagePanel();
|
this.imagePanel = new ScaledImagePanel();
|
||||||
this.add(this.imagePanel);
|
this.add(this.imagePanel);
|
||||||
this.addComponentListener(new ComponentAdapter() {
|
this.addComponentListener(new ComponentAdapter() {
|
||||||
@@ -167,14 +157,43 @@ public class CardPanel extends JPanel implements CardContainer {
|
|||||||
public void componentShown(final ComponentEvent e) {
|
public void componentShown(final ComponentEvent e) {
|
||||||
CardPanel.this.setCard(CardPanel.this.getGameCard());
|
CardPanel.this.setCard(CardPanel.this.getGameCard());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentResized(final ComponentEvent e) {
|
public void componentResized(final ComponentEvent e) {
|
||||||
CardPanel.this.setCard(CardPanel.this.getGameCard());
|
CardPanel.this.setCard(CardPanel.this.getGameCard());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.setCard(newGameCard);
|
private void createCardNameOverlay() {
|
||||||
|
this.titleText = new OutlinedLabel();
|
||||||
|
this.titleText.setFont(this.getFont().deriveFont(Font.BOLD, 13f));
|
||||||
|
this.titleText.setForeground(Color.white);
|
||||||
|
this.titleText.setGlow(Color.black);
|
||||||
|
this.titleText.setWrap(true);
|
||||||
|
this.add(this.titleText);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createPTOverlay() {
|
||||||
|
// Power
|
||||||
|
this.ptText = new OutlinedLabel();
|
||||||
|
this.ptText.setFont(this.getFont().deriveFont(Font.BOLD, 13f));
|
||||||
|
this.ptText.setForeground(Color.white);
|
||||||
|
this.ptText.setGlow(Color.black);
|
||||||
|
this.add(this.ptText);
|
||||||
|
// Toughness
|
||||||
|
this.damageText = new OutlinedLabel();
|
||||||
|
this.damageText.setFont(this.getFont().deriveFont(Font.BOLD, 15f));
|
||||||
|
this.damageText.setForeground(new Color(160,0,0));
|
||||||
|
this.damageText.setGlow(Color.white);
|
||||||
|
this.add(this.damageText);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createCardIdOverlay() {
|
||||||
|
this.cardIdText = new OutlinedLabel();
|
||||||
|
this.cardIdText.setFont(this.getFont().deriveFont(Font.BOLD, 11f));
|
||||||
|
this.cardIdText.setForeground(Color.LIGHT_GRAY);
|
||||||
|
this.cardIdText.setGlow(Color.black);
|
||||||
|
this.add(this.cardIdText);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -436,31 +455,53 @@ public class CardPanel extends JPanel implements CardContainer {
|
|||||||
this.imagePanel.setSize(imgSize);
|
this.imagePanel.setSize(imgSize);
|
||||||
|
|
||||||
final int fontHeight = Math.round(this.cardHeight * (27f / 680));
|
final int fontHeight = Math.round(this.cardHeight * (27f / 680));
|
||||||
final boolean showText = !this.imagePanel.hasImage() || (!this.isAnimationPanel && (fontHeight < 12));
|
boolean showText = !this.imagePanel.hasImage() || (!this.isAnimationPanel && (fontHeight < 12));
|
||||||
this.titleText.setVisible(showText);
|
|
||||||
this.ptText.setVisible(showText);
|
|
||||||
this.damageText.setVisible(showText);
|
|
||||||
|
|
||||||
final int titleX = Math.round(imgSize.width * (24f / 480));
|
displayCardNameOverlay(showText && showCardNameOverlay(), imgSize, imgPos);
|
||||||
final int titleY = Math.round(imgSize.height * (54f / 640)) - 15;
|
displayPTOverlay(showText && showCardPowerOverlay(), imgSize, imgPos);
|
||||||
final int titleH = Math.round(imgSize.height * (360f / 640));
|
displayCardIdOverlay(showText && showCardIdOverlay(), imgSize, imgPos);
|
||||||
this.titleText.setBounds(imgPos.x + titleX, imgPos.y + titleY, imgSize.width - 2 * titleX, titleH - titleY);
|
|
||||||
|
|
||||||
final int rightLine = Math.round(imgSize.width * (412f / 480));
|
|
||||||
|
|
||||||
final Dimension ptSize = this.ptText.getPreferredSize();
|
|
||||||
this.ptText.setSize(ptSize.width, ptSize.height);
|
|
||||||
final int ptX = rightLine - ptSize.width/2;
|
|
||||||
final int ptY = Math.round(imgSize.height * (650f / 680)) - 13;
|
|
||||||
this.ptText.setLocation(imgPos.x + ptX, imgPos.y + ptY);
|
|
||||||
|
|
||||||
final Dimension dmgSize = this.damageText.getPreferredSize();
|
|
||||||
this.damageText.setSize(dmgSize.width, dmgSize.height);
|
|
||||||
final int dmgX = rightLine - dmgSize.width / 2;
|
|
||||||
final int dmgY = ptY - 16;
|
|
||||||
this.damageText.setLocation(imgPos.x + dmgX, imgPos.y + dmgY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void displayCardIdOverlay(boolean isVisible, Dimension imgSize, Point imgPos) {
|
||||||
|
if (isVisible) {
|
||||||
|
final Dimension idSize = this.cardIdText.getPreferredSize();
|
||||||
|
this.cardIdText.setSize(idSize.width, idSize.height);
|
||||||
|
final int idX = Math.round(imgSize.width * (24f / 480));
|
||||||
|
final int idY = Math.round(imgSize.height * (650f / 680)) - 8;
|
||||||
|
this.cardIdText.setLocation(imgPos.x + idX, imgPos.y + idY);
|
||||||
|
}
|
||||||
|
this.cardIdText.setVisible(isVisible);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void displayPTOverlay(boolean isVisible, Dimension imgSize, Point imgPos) {
|
||||||
|
if (isVisible) {
|
||||||
|
final int rightLine = Math.round(imgSize.width * (412f / 480)) + 3;
|
||||||
|
// Power
|
||||||
|
final Dimension ptSize = this.ptText.getPreferredSize();
|
||||||
|
this.ptText.setSize(ptSize.width, ptSize.height);
|
||||||
|
final int ptX = rightLine - ptSize.width/2;
|
||||||
|
final int ptY = Math.round(imgSize.height * (650f / 680)) - 10;
|
||||||
|
this.ptText.setLocation(imgPos.x + ptX, imgPos.y + ptY);
|
||||||
|
// Toughness
|
||||||
|
final Dimension dmgSize = this.damageText.getPreferredSize();
|
||||||
|
this.damageText.setSize(dmgSize.width, dmgSize.height);
|
||||||
|
final int dmgX = rightLine - dmgSize.width / 2;
|
||||||
|
final int dmgY = ptY - 16;
|
||||||
|
this.damageText.setLocation(imgPos.x + dmgX, imgPos.y + dmgY);
|
||||||
|
}
|
||||||
|
this.ptText.setVisible(isVisible);
|
||||||
|
this.damageText.setVisible(isVisible);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void displayCardNameOverlay(boolean isVisible, Dimension imgSize, Point imgPos) {
|
||||||
|
if (isVisible) {
|
||||||
|
final int titleX = Math.round(imgSize.width * (24f / 480));
|
||||||
|
final int titleY = Math.round(imgSize.height * (54f / 640)) - 15;
|
||||||
|
final int titleH = Math.round(imgSize.height * (360f / 640));
|
||||||
|
this.titleText.setBounds(imgPos.x + titleX, imgPos.y + titleY + 2, imgSize.width - 2 * titleX, titleH - titleY);
|
||||||
|
}
|
||||||
|
this.titleText.setVisible(isVisible);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final String toString() {
|
public final String toString() {
|
||||||
@@ -585,30 +626,31 @@ public class CardPanel extends JPanel implements CardContainer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Card name overlay
|
||||||
if (card.isFaceDown()) {
|
if (card.isFaceDown()) {
|
||||||
this.titleText.setText("");
|
this.titleText.setText("");
|
||||||
} else {
|
} else {
|
||||||
if (showCardNameOverlay()) {
|
this.titleText.setText(card.getName());
|
||||||
this.titleText.setText(card.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showCardPowerOverlay()) {
|
// P/T overlay
|
||||||
String sPt = "";
|
String sPt = "";
|
||||||
if (card.isCreature() && card.isPlaneswalker()) {
|
if (card.isCreature() && card.isPlaneswalker()) {
|
||||||
sPt = String.format("%d/%d (%d)", card.getNetAttack(), card.getNetDefense(), card.getCounters(CounterType.LOYALTY));
|
sPt = String.format("%d/%d (%d)", card.getNetAttack(), card.getNetDefense(), card.getCounters(CounterType.LOYALTY));
|
||||||
} else if (card.isCreature()) {
|
} else if (card.isCreature()) {
|
||||||
sPt = String.format("%d/%d", card.getNetAttack(), card.getNetDefense());
|
sPt = String.format("%d/%d", card.getNetAttack(), card.getNetDefense());
|
||||||
} else if (card.isPlaneswalker()) {
|
} else if (card.isPlaneswalker()) {
|
||||||
int loyalty = card.getCounters(CounterType.LOYALTY);
|
int loyalty = card.getCounters(CounterType.LOYALTY);
|
||||||
sPt = String.valueOf(loyalty == 0 ? card.getBaseLoyalty() : loyalty);
|
sPt = String.valueOf(loyalty == 0 ? card.getBaseLoyalty() : loyalty);
|
||||||
}
|
|
||||||
this.ptText.setText(sPt);
|
|
||||||
}
|
}
|
||||||
|
this.ptText.setText(sPt);
|
||||||
|
|
||||||
int damage = card.getDamage();
|
int damage = card.getDamage();
|
||||||
this.damageText.setText(damage > 0 ? "\u00BB " + String.valueOf(damage) + " \u00AB" : "");
|
this.damageText.setText(damage > 0 ? "\u00BB " + String.valueOf(damage) + " \u00AB" : "");
|
||||||
|
|
||||||
|
// Card Id overlay
|
||||||
|
this.cardIdText.setText(Integer.toString(card.getUniqueNumber()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -630,7 +672,7 @@ public class CardPanel extends JPanel implements CardContainer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setGameCard(card);
|
this.gameCard = card;
|
||||||
if (!this.isShowing()) {
|
if (!this.isShowing()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -650,16 +692,6 @@ public class CardPanel extends JPanel implements CardContainer {
|
|||||||
return this.gameCard;
|
return this.gameCard;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the game card.
|
|
||||||
*
|
|
||||||
* @param gameCard0
|
|
||||||
* the gameCard to set
|
|
||||||
*/
|
|
||||||
public final void setGameCard(final Card gameCard0) {
|
|
||||||
this.gameCard = gameCard0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the drag animation panel.
|
* Gets the drag animation panel.
|
||||||
*
|
*
|
||||||
@@ -768,17 +800,31 @@ public class CardPanel extends JPanel implements CardContainer {
|
|||||||
return Singletons.getModel().getPreferences().getPrefBoolean(preferenceName);
|
return Singletons.getModel().getPreferences().getPrefBoolean(preferenceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isShowingOverlays() {
|
||||||
|
return isPreferenceEnabled(FPref.UI_SHOW_CARD_OVERLAYS);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean showCardNameOverlay() {
|
private boolean showCardNameOverlay() {
|
||||||
return isPreferenceEnabled(FPref.UI_OVERLAY_CARD_NAME);
|
return isShowingOverlays() && isPreferenceEnabled(FPref.UI_OVERLAY_CARD_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean showCardPowerOverlay() {
|
private boolean showCardPowerOverlay() {
|
||||||
return isPreferenceEnabled(FPref.UI_OVERLAY_CARD_POWER);
|
return isShowingOverlays() && isPreferenceEnabled(FPref.UI_OVERLAY_CARD_POWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean showCardManaCostOverlay() {
|
private boolean showCardManaCostOverlay() {
|
||||||
return isPreferenceEnabled(FPref.UI_OVERLAY_CARD_MANA_COST) && !this.getCard().isFaceDown();
|
return isShowingOverlays() &&
|
||||||
|
isPreferenceEnabled(FPref.UI_OVERLAY_CARD_MANA_COST) &&
|
||||||
|
!this.getCard().isFaceDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean showCardIdOverlay() {
|
||||||
|
return isShowingOverlays() && isPreferenceEnabled(FPref.UI_OVERLAY_CARD_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void repaintOverlays() {
|
||||||
|
repaint();
|
||||||
|
doLayout();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user