Added optional large card viewers for use with high resolution card images.

This commit is contained in:
Krazy
2014-04-22 22:52:00 +00:00
parent b480b52bc0
commit 73fd1e29f1
8 changed files with 105 additions and 24 deletions

View File

@@ -633,8 +633,6 @@ public class Game {
onePlayerHasTimeShifted = false;
}
System.out.println(validRarities.size());
CardRarity anteRarity = validRarities.get(new Random().nextInt(validRarities.size()));
System.out.println("Rarity chosen for ante: " + anteRarity.name());

View File

@@ -20,6 +20,8 @@ package forge.gui;
import forge.game.card.Card;
import forge.item.PaperCard;
import forge.model.FModel;
import forge.properties.ForgePreferences.FPref;
import forge.toolbox.FButton;
import forge.toolbox.FLabel;
import forge.toolbox.FScrollPane;
@@ -102,7 +104,13 @@ public class BoxedProductCardListViewer extends FDialog {
this.picture.setOpaque(false);
this.setTitle(title);
this.setSize(720, 374);
if (FModel.getPreferences().getPrefBoolean(FPref.UI_LARGE_CARD_VIEWERS)) {
this.setSize(1200, 825);
} else {
this.setSize(720, 374);
}
this.addWindowFocusListener(new CardListFocuser());
FButton btnOK = new FButton("Next Pack");
@@ -123,11 +131,20 @@ public class BoxedProductCardListViewer extends FDialog {
});
this.add(new FLabel.Builder().text(message).build(), "cell 0 0, spanx 3, gapbottom 4");
this.add(new FScrollPane(this.jList, true), "cell 0 1, w 225, growy, pushy, ax c");
this.add(this.picture, "cell 1 1, w 225, growy, pushy, ax c");
this.add(this.detail, "cell 2 1, w 225, growy, pushy, ax c");
this.add(btnOK, "cell 1 2, w 150, h 26, ax c, gaptop 6");
this.add(btnCancel, "cell 2 2, w 205, h 26, ax c, gaptop 6");
if (FModel.getPreferences().getPrefBoolean(FPref.UI_LARGE_CARD_VIEWERS)) {
this.add(new FScrollPane(this.jList, true), "cell 0 1, w 225, h 450, ax c");
this.add(this.picture, "cell 1 1, w 480, growy, pushy, ax c");
this.add(this.detail, "cell 2 1, w 320, h 500, ax c");
this.add(btnOK, "cell 1 2, w 150, h 40, ax c, gaptop 6");
this.add(btnCancel, "cell 2 2, w 205, h 40, ax c, gaptop 6");
} else {
this.add(new FScrollPane(this.jList, true), "cell 0 1, w 225, growy, pushy, ax c");
this.add(this.picture, "cell 1 1, w 225, growy, pushy, ax c");
this.add(this.detail, "cell 2 1, w 225, growy, pushy, ax c");
this.add(btnOK, "cell 1 2, w 150, h 26, ax c, gaptop 6");
this.add(btnCancel, "cell 2 2, w 205, h 26, ax c, gaptop 6");
}
// selection is here
this.jList.getSelectionModel().addListSelectionListener(new SelListener());

View File

@@ -20,6 +20,8 @@ package forge.gui;
import forge.game.card.Card;
import forge.item.PaperCard;
import forge.model.FModel;
import forge.properties.ForgePreferences.FPref;
import forge.toolbox.FButton;
import forge.toolbox.FLabel;
import forge.toolbox.FScrollPane;
@@ -100,7 +102,13 @@ public class CardListViewer extends FDialog {
this.picture.setOpaque(false);
this.setTitle(title);
this.setSize(720, 374);
if (FModel.getPreferences().getPrefBoolean(FPref.UI_LARGE_CARD_VIEWERS)) {
this.setSize(1200, 825);
} else {
this.setSize(720, 374);
}
this.addWindowFocusListener(new CardListFocuser());
FButton btnOK = new FButton("OK");
@@ -112,10 +120,18 @@ public class CardListViewer extends FDialog {
});
this.add(new FLabel.Builder().text(message).build(), "cell 0 0, spanx 3, gapbottom 4");
this.add(new FScrollPane(this.jList, true), "cell 0 1, w 225, growy, pushy, ax c");
this.add(this.picture, "cell 1 1, w 225, growy, pushy, ax c");
this.add(this.detail, "cell 2 1, w 225, growy, pushy, ax c");
this.add(btnOK, "cell 1 2, w 150, h 26, ax c, gaptop 6");
if (FModel.getPreferences().getPrefBoolean(FPref.UI_LARGE_CARD_VIEWERS)) {
this.add(new FScrollPane(this.jList, true), "cell 0 1, w 225, h 450, ax c");
this.add(this.picture, "cell 1 1, w 480, growy, pushy, ax c");
this.add(this.detail, "cell 2 1, w 320, h 500, ax c");
this.add(btnOK, "cell 1 2, w 150, h 40, ax c, gaptop 6");
} else {
this.add(new FScrollPane(this.jList, true), "cell 0 1, w 225, growy, pushy, ax c");
this.add(this.picture, "cell 1 1, w 225, growy, pushy, ax c");
this.add(this.detail, "cell 2 1, w 225, growy, pushy, ax c");
this.add(btnOK, "cell 1 2, w 150, h 26, ax c, gaptop 6");
}
// selection is here
this.jList.getSelectionModel().addListSelectionListener(new SelListener());

View File

@@ -71,6 +71,7 @@ public enum CSubmenuPreferences implements ICDoc {
lstControls.add(Pair.of(view.getCbAnteMatchRarity(), FPref.UI_ANTE_MATCH_RARITY));
lstControls.add(Pair.of(view.getCbManaBurn(), FPref.UI_MANABURN));
lstControls.add(Pair.of(view.getCbScaleLarger(), FPref.UI_SCALE_LARGER));
lstControls.add(Pair.of(view.getCbLargeCardViewers(), FPref.UI_LARGE_CARD_VIEWERS));
lstControls.add(Pair.of(view.getCbRandomArtInPools(), FPref.UI_RANDOM_ART_IN_POOLS));
lstControls.add(Pair.of(view.getCbEnforceDeckLegality(), FPref.ENFORCE_DECK_LEGALITY));
lstControls.add(Pair.of(view.getCbCloneImgSource(), FPref.UI_CLONE_MODE_SOURCE));

View File

@@ -68,6 +68,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private final JCheckBox cbEnforceDeckLegality = new OptionsCheckBox("Deck Conformance");
private final JCheckBox cbCloneImgSource = new OptionsCheckBox("Clones Use Original Card Art");
private final JCheckBox cbScaleLarger = new OptionsCheckBox("Scale Image Larger");
private final JCheckBox cbLargeCardViewers = new OptionsCheckBox("Use Large Card Viewers");
private final JCheckBox cbDisplayFoil = new OptionsCheckBox("Display Foil Overlay");
private final JCheckBox cbRandomFoil = new OptionsCheckBox("Random Foil");
private final JCheckBox cbRandomArtInPools = new OptionsCheckBox("Randomize Card Art in Generated Card Pools");
@@ -192,6 +193,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.add(cbScaleLarger, regularConstraints);
pnlPrefs.add(new NoteLabel("Allows card pictures to be expanded larger than their original size."), regularConstraints);
pnlPrefs.add(cbLargeCardViewers, regularConstraints);
pnlPrefs.add(new NoteLabel("Makes all card viewers much larger for use with high resolution images. Will not fit on smaller screens."), regularConstraints);
pnlPrefs.add(cbRandomArtInPools, regularConstraints);
pnlPrefs.add(new NoteLabel("Generates cards with random art in generated limited mode card pools."), regularConstraints);
@@ -455,6 +459,11 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
return cbScaleLarger;
}
/** @return {@link javax.swing.JCheckBox} */
public JCheckBox getCbLargeCardViewers() {
return cbLargeCardViewers;
}
/** @return {@link javax.swing.JCheckBox} */
public JCheckBox getCbRandomArtInPools() {
return cbRandomArtInPools;

View File

@@ -76,6 +76,7 @@ public class QuestWinLose extends ControlWinLose {
private static final String CONSTRAINTS_TITLE = "w 95%!, gap 0 0 20px 10px";
private static final String CONSTRAINTS_TEXT = "w 95%!,, h 180px!, gap 0 0 0 20px";
private static final String CONSTRAINTS_CARDS = "w 95%!, h 330px!, gap 0 0 0 20px";
private static final String CONSTRAINTS_CARDS_LARGE = "w 95%!, h 600px!, gap 0 0 0 20px";
private final transient QuestController qData;
private final transient QuestEvent qEvent;
@@ -207,12 +208,20 @@ public class QuestWinLose extends ControlWinLose {
if (cardsWon != null && !cardsWon.isEmpty()) {
this.getView().getPnlCustom().add(new TitleLabel("Spoils! These cards will be available in your card pool after this ante match:"),
QuestWinLose.CONSTRAINTS_TITLE);
this.getView().getPnlCustom().add(new QuestWinLoseCardViewer(cardsWon), QuestWinLose.CONSTRAINTS_CARDS);
if (FModel.getPreferences().getPrefBoolean(FPref.UI_LARGE_CARD_VIEWERS)) {
this.getView().getPnlCustom().add(new QuestWinLoseCardViewer(cardsWon), QuestWinLose.CONSTRAINTS_CARDS_LARGE);
} else {
this.getView().getPnlCustom().add(new QuestWinLoseCardViewer(cardsWon), QuestWinLose.CONSTRAINTS_CARDS);
}
}
if (cardsLost != null && !cardsLost.isEmpty()) {
this.getView().getPnlCustom().add(new TitleLabel("Looted! You lost the following cards in an ante match:"),
QuestWinLose.CONSTRAINTS_TITLE);
this.getView().getPnlCustom().add(new QuestWinLoseCardViewer(cardsLost), QuestWinLose.CONSTRAINTS_CARDS);
if (FModel.getPreferences().getPrefBoolean(FPref.UI_LARGE_CARD_VIEWERS)) {
this.getView().getPnlCustom().add(new QuestWinLoseCardViewer(cardsLost), QuestWinLose.CONSTRAINTS_CARDS_LARGE);
} else {
this.getView().getPnlCustom().add(new QuestWinLoseCardViewer(cardsLost), QuestWinLose.CONSTRAINTS_CARDS);
}
}
}
@@ -303,7 +312,8 @@ public class QuestWinLose extends ControlWinLose {
.getPref(QPref.REWARDS_WINS_MULTIPLIER)) * qData.getAchievements().getWin()));
credBase += creditsForPreviousWins;
sb.append("Bonus for previous wins: ").append(creditsForPreviousWins).append(" credits.<br>");
sb.append("Bonus for previous wins: ").append(creditsForPreviousWins).append(
creditsForPreviousWins != 1 ? " credits.<br>" : " credit.<br>");
// Gameplay bonuses (for each game win)
boolean hasNeverLost = true;
@@ -470,7 +480,11 @@ public class QuestWinLose extends ControlWinLose {
final QuestWinLoseCardViewer cv = new QuestWinLoseCardViewer(cardsWon);
this.view.getPnlCustom().add(this.lblTemp1, QuestWinLose.CONSTRAINTS_TITLE);
this.view.getPnlCustom().add(cv, QuestWinLose.CONSTRAINTS_CARDS);
if (FModel.getPreferences().getPrefBoolean(FPref.UI_LARGE_CARD_VIEWERS)) {
this.view.getPnlCustom().add(cv, QuestWinLose.CONSTRAINTS_CARDS_LARGE);
} else {
this.view.getPnlCustom().add(cv, QuestWinLose.CONSTRAINTS_CARDS);
}
}
/**
@@ -488,7 +502,11 @@ public class QuestWinLose extends ControlWinLose {
final QuestWinLoseCardViewer cv = new QuestWinLoseCardViewer(cardsWon);
this.view.getPnlCustom().add(this.lblTemp1, QuestWinLose.CONSTRAINTS_TITLE);
this.view.getPnlCustom().add(cv, QuestWinLose.CONSTRAINTS_CARDS);
if (FModel.getPreferences().getPrefBoolean(FPref.UI_LARGE_CARD_VIEWERS)) {
this.view.getPnlCustom().add(cv, QuestWinLose.CONSTRAINTS_CARDS_LARGE);
} else {
this.view.getPnlCustom().add(cv, QuestWinLose.CONSTRAINTS_CARDS);
}
}
/**
@@ -566,7 +584,11 @@ public class QuestWinLose extends ControlWinLose {
final QuestWinLoseCardViewer cv = new QuestWinLoseCardViewer(cardsWon);
this.view.getPnlCustom().add(this.lblTemp1, QuestWinLose.CONSTRAINTS_TITLE);
this.view.getPnlCustom().add(cv, QuestWinLose.CONSTRAINTS_CARDS);
if (FModel.getPreferences().getPrefBoolean(FPref.UI_LARGE_CARD_VIEWERS)) {
this.view.getPnlCustom().add(cv, QuestWinLose.CONSTRAINTS_CARDS_LARGE);
} else {
this.view.getPnlCustom().add(cv, QuestWinLose.CONSTRAINTS_CARDS);
}
}
}
@@ -638,7 +660,11 @@ public class QuestWinLose extends ControlWinLose {
qData.getCards().addAllCards(boosterCards);
final QuestWinLoseCardViewer cv = new QuestWinLoseCardViewer(boosterCards);
this.view.getPnlCustom().add(new TitleLabel("Extra " + ii.getName() + "!"), QuestWinLose.CONSTRAINTS_TITLE);
this.view.getPnlCustom().add(cv, QuestWinLose.CONSTRAINTS_CARDS);
if (FModel.getPreferences().getPrefBoolean(FPref.UI_LARGE_CARD_VIEWERS)) {
this.view.getPnlCustom().add(cv, QuestWinLose.CONSTRAINTS_CARDS_LARGE);
} else {
this.view.getPnlCustom().add(cv, QuestWinLose.CONSTRAINTS_CARDS);
}
}
}
else if (ii instanceof IQuestRewardCard) {
@@ -655,7 +681,11 @@ public class QuestWinLose extends ControlWinLose {
this.lblTemp1 = new TitleLabel(message);
this.view.getPnlCustom().add(this.lblTemp1, QuestWinLose.CONSTRAINTS_TITLE);
}
this.getView().getPnlCustom().add(cv, QuestWinLose.CONSTRAINTS_CARDS);
if (FModel.getPreferences().getPrefBoolean(FPref.UI_LARGE_CARD_VIEWERS)) {
this.getView().getPnlCustom().add(cv, QuestWinLose.CONSTRAINTS_CARDS_LARGE);
} else {
this.getView().getPnlCustom().add(cv, QuestWinLose.CONSTRAINTS_CARDS);
}
qData.getCards().addAllCards(cardsWon);
}
}

View File

@@ -21,6 +21,8 @@ import forge.game.card.Card;
import forge.gui.CardDetailPanel;
import forge.gui.CardPicturePanel;
import forge.item.PaperCard;
import forge.model.FModel;
import forge.properties.ForgePreferences.FPref;
import forge.toolbox.FList;
import forge.toolbox.FPanel;
import forge.toolbox.FScrollPane;
@@ -71,9 +73,16 @@ public class QuestWinLoseCardViewer extends FPanel {
picture.setOpaque(false);
this.setLayout(new MigLayout("insets 0, gap 0"));
this.add(scroller, "w 32%!, h 98%!, gap 1% 1% 1% 1%");
this.add(this.picture, "w 32%!, h 98%!, gap 0 0 1% 1%");
this.add(this.detail, "w 32%!, h 98%!, gap 1% 1% 1% 1%");
if (FModel.getPreferences().getPrefBoolean(FPref.UI_LARGE_CARD_VIEWERS)) {
this.add(scroller, "w 23%!, h 98%!, gap 1% 1% 1% 1%");
this.add(this.picture, "w 48%!, h 98%!, gap 0 0 1% 1%");
this.add(this.detail, "w 23%!, h 98%!, gap 1% 1% 1% 1%");
} else {
this.add(scroller, "w 32%!, h 98%!, gap 1% 1% 1% 1%");
this.add(this.picture, "w 32%!, h 98%!, gap 0 0 1% 1%");
this.add(this.detail, "w 32%!, h 98%!, gap 1% 1% 1% 1%");
}
// selection is here
this.jList.getSelectionModel().addListSelectionListener(new SelListener());

View File

@@ -49,6 +49,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
UI_OPEN_PACKS_INDIV ("false"),
UI_UPLOAD_DRAFT ("false"),
UI_SCALE_LARGER ("true"),
UI_LARGE_CARD_VIEWERS ("false"),
UI_RANDOM_ART_IN_POOLS ("true"),
UI_COMPACT_PROMPT ("false"),
UI_CARD_SIZE ("small"),