- Modified setting. "Text/Mana Overlay" replaced with individual toggle setting for Card Name, P/T and Mana Cost overlays.

This commit is contained in:
spr
2013-07-11 23:00:01 +00:00
parent c591902722
commit 8331e86624
4 changed files with 843 additions and 817 deletions

View File

@@ -87,7 +87,9 @@ public enum CSubmenuPreferences implements ICDoc {
lstControls.add(Pair.of(view.getCbUploadDraft(), FPref.UI_UPLOAD_DRAFT));
lstControls.add(Pair.of(view.getCbStackLand(), FPref.UI_SMOOTH_LAND));
lstControls.add(Pair.of(view.getCbRandomFoil(), FPref.UI_RANDOM_FOIL));
lstControls.add(Pair.of(view.getCbTextMana(), FPref.UI_CARD_OVERLAY));
lstControls.add(Pair.of(view.getCbOverlayCardName(), FPref.UI_OVERLAY_CARD_NAME));
lstControls.add(Pair.of(view.getCbOverlayCardPower(), FPref.UI_OVERLAY_CARD_POWER));
lstControls.add(Pair.of(view.getCbOverlayCardManaCost(), FPref.UI_OVERLAY_CARD_MANA_COST));
lstControls.add(Pair.of(view.getCbRandomizeArt(), FPref.UI_RANDOM_CARD_ART));
lstControls.add(Pair.of(view.getCbEnableSounds(), FPref.UI_ENABLE_SOUNDS));
lstControls.add(Pair.of(view.getCbAltSoundSystem(), FPref.UI_ALT_SOUND_SYSTEM));

View File

@@ -94,7 +94,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private final JCheckBox cbDevMode = new OptionsCheckBox("Developer Mode");
private final JCheckBox cbEnforceDeckLegality = new OptionsCheckBox("Deck Conformance");
private final JCheckBox cbCloneImgSource = new OptionsCheckBox("Clones use original card art");
private final JCheckBox cbTextMana = new OptionsCheckBox("Text / Mana Overlay");
private final JCheckBox cbOverlayCardName = new OptionsCheckBox("Card Name");
private final JCheckBox cbOverlayCardPower = new OptionsCheckBox("Power/Toughness");
private final JCheckBox cbOverlayCardManaCost = new OptionsCheckBox("Mana Cost");
private final JCheckBox cbScaleLarger = new OptionsCheckBox("Scale Image Larger");
private final JCheckBox cbRandomFoil = new OptionsCheckBox("Random Foil");
private final JCheckBox cbRandomizeArt = new OptionsCheckBox("Randomize Card Art");
@@ -189,8 +191,12 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.add(cbUiForTouchScreen, regularConstraints);
pnlPrefs.add(new NoteLabel("Increases some UI elements to provide a better experience on touchscreen devices. (Needs restart)"), regularConstraints);
pnlPrefs.add(cbTextMana, regularConstraints);
pnlPrefs.add(new NoteLabel("Overlays each card with basic card-specific information."), regularConstraints);
// Overlay options
pnlPrefs.add(new SectionLabel("Card Overlay Options"), sectionConstraints);
pnlPrefs.add(new NoteLabel("Show text overlays which are easier to read when cards are reduced in size to fit the play area."), regularConstraints);
pnlPrefs.add(cbOverlayCardName, regularConstraints);
pnlPrefs.add(cbOverlayCardPower, regularConstraints);
pnlPrefs.add(cbOverlayCardManaCost, regularConstraints);
// Sound options
pnlPrefs.add(new SectionLabel("Sound Options"), sectionConstraints);
@@ -443,8 +449,18 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
}
/** @return {@link javax.swing.JCheckBox} */
public JCheckBox getCbTextMana() {
return cbTextMana;
public JCheckBox getCbOverlayCardName() {
return cbOverlayCardName;
}
/** @return {@link javax.swing.JCheckBox} */
public JCheckBox getCbOverlayCardPower() {
return cbOverlayCardPower;
}
/** @return {@link javax.swing.JCheckBox} */
public JCheckBox getCbOverlayCardManaCost() {
return cbOverlayCardManaCost;
}
/** @return {@link javax.swing.JCheckBox} */

View File

@@ -38,7 +38,9 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
UI_RANDOM_FOIL ("false"),
UI_SMOOTH_LAND ("false"),
UI_AVATARS ("0,1"),
UI_CARD_OVERLAY ("true"),
UI_OVERLAY_CARD_NAME ("true"),
UI_OVERLAY_CARD_POWER ("true"),
UI_OVERLAY_CARD_MANA_COST ("true"),
UI_UPLOAD_DRAFT ("false"),
UI_SCALE_LARGER ("true"),
UI_MAX_STACK ("3"),

View File

@@ -125,7 +125,6 @@ public class CardPanel extends JPanel implements CardContainer {
private boolean isAnimationPanel;
private int cardXOffset, cardYOffset, cardWidth, cardHeight;
private boolean isSelected;
private boolean showCastingCost;
/**
* <p>
@@ -281,18 +280,6 @@ public class CardPanel extends JPanel implements CardContainer {
return this.isSelected;
}
/**
* <p>
* Setter for the field <code>showCastingCost</code>.
* </p>
*
* @param showCastingCost
* a boolean.
*/
public final void setShowCastingCost(final boolean showCastingCost) {
this.showCastingCost = showCastingCost;
}
/** {@inheritDoc} */
@Override
public final void paint(final Graphics g) {
@@ -371,7 +358,7 @@ public class CardPanel extends JPanel implements CardContainer {
return;
}
if (this.showCastingCost && this.cardWidth < 200) {
if (showCardManaCostOverlay() && this.cardWidth < 200) {
Card gameCard = this.getGameCard();
boolean showSplitMana = gameCard.isSplitCard() && gameCard.getCurState() == CardCharacteristicName.Original;
if ( !showSplitMana ) {
@@ -593,28 +580,31 @@ public class CardPanel extends JPanel implements CardContainer {
* a {@link forge.Card} object.
*/
public final void setText(final Card card) {
if ((card == null) || !Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_CARD_OVERLAY)) {
if ((card == null)) {
return;
}
if (card.isFaceDown()) {
this.titleText.setText("");
this.showCastingCost = false;
} else {
this.titleText.setText(card.getName());
this.showCastingCost = true;
if (showCardNameOverlay()) {
this.titleText.setText(card.getName());
}
}
String sPt = "";
if (card.isCreature() && card.isPlaneswalker()) {
sPt = String.format("%d/%d (%d)", card.getNetAttack(), card.getNetDefense(), card.getCounters(CounterType.LOYALTY));
} else if (card.isCreature()) {
sPt = String.format("%d/%d", card.getNetAttack(), card.getNetDefense());
} else if (card.isPlaneswalker()) {
int loyalty = card.getCounters(CounterType.LOYALTY);
sPt = String.valueOf(loyalty == 0 ? card.getBaseLoyalty() : loyalty);
if (showCardPowerOverlay()) {
String sPt = "";
if (card.isCreature() && card.isPlaneswalker()) {
sPt = String.format("%d/%d (%d)", card.getNetAttack(), card.getNetDefense(), card.getCounters(CounterType.LOYALTY));
} else if (card.isCreature()) {
sPt = String.format("%d/%d", card.getNetAttack(), card.getNetDefense());
} else if (card.isPlaneswalker()) {
int loyalty = card.getCounters(CounterType.LOYALTY);
sPt = String.valueOf(loyalty == 0 ? card.getBaseLoyalty() : loyalty);
}
this.ptText.setText(sPt);
}
this.ptText.setText(sPt);
int damage = card.getDamage();
this.damageText.setText(damage > 0 ? "\u00BB " + String.valueOf(damage) + " \u00AB" : "");
@@ -646,9 +636,7 @@ public class CardPanel extends JPanel implements CardContainer {
}
final BufferedImage image = card == null ? null : ImageCache.getImage(card, imagePanel.getWidth(), imagePanel.getHeight());
if ((this.getGameCard() != null) && Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_CARD_OVERLAY)) {
this.setText(this.getGameCard());
}
this.setText(this.getGameCard());
this.setImage(image);
}
@@ -775,4 +763,22 @@ public class CardPanel extends JPanel implements CardContainer {
public static final float getBorderSize() {
return BLACK_BORDER_SIZE;
}
private boolean isPreferenceEnabled(FPref preferenceName) {
return Singletons.getModel().getPreferences().getPrefBoolean(preferenceName);
}
private boolean showCardNameOverlay() {
return isPreferenceEnabled(FPref.UI_OVERLAY_CARD_NAME);
}
private boolean showCardPowerOverlay() {
return isPreferenceEnabled(FPref.UI_OVERLAY_CARD_POWER);
}
private boolean showCardManaCostOverlay() {
return isPreferenceEnabled(FPref.UI_OVERLAY_CARD_MANA_COST) && !this.getCard().isFaceDown();
}
}