Add new counter display and associated preference; clean up preferences screen a little

This commit is contained in:
Krazy
2017-06-22 02:25:06 +00:00
parent 89e72f382f
commit 6e891101ce
7 changed files with 451 additions and 329 deletions

View File

@@ -28,315 +28,323 @@ import com.google.common.collect.ImmutableList;
*/
public enum CounterType {
M1M1("-1/-1"),
P1P1("+1/+1"),
LOYALTY,
M1M1("-1/-1", "-1/-1", 255, 110, 106),
P1P1("+1/+1", "+1/+1", 96, 226, 23),
AGE(),
LOYALTY("LOYAL", 198, 198, 198),
AIM(),
AGE("AGE", 255, 137, 57),
ARROW(),
AIM("AIM", 255, 180, 0),
ARROWHEAD(),
ARROW("ARROW", 237, 195, 0),
AWAKENING(),
ARROWHEAD("ARWHD", 230, 191, 167),
BLAZE(),
AWAKENING("AWAKE", 0, 231, 79),
BLOOD(),
BLAZE("BLAZE", 255, 124, 82),
BOUNTY(),
BLOOD("BLOOD", 255, 108, 111),
BRIBERY(),
BOUNTY("BOUNT", 255, 158, 0),
BRICK(),
BRIBERY("BRIBE", 172, 201, 235),
CARRION(),
BRICK("BRICK", 226, 192, 164),
CHARGE(),
CARRION("CRRON", 255, 163, 222),
CORPSE(),
CHARGE("CHARG", 246, 192, 0),
CREDIT(),
CORPSE("CRPSE", 230, 186, 209),
CRYSTAL(),
CREDIT("CRDIT", 188, 197, 234),
CUBE(),
CRYSTAL("CRYST", 255, 85, 206),
CURRENCY(),
CUBE("CUBE", 148, 219, 0),
DEATH(),
CURRENCY("CURR", 223, 200, 0),
DELAY(),
DEATH("DEATH", 255, 108, 110),
DEPLETION(),
DELAY("DELAY", 102, 206, 255),
DESPAIR(),
DEPLETION("DPLT", 185, 201, 208),
DEVOTION(),
DESPAIR("DESPR", 238, 186, 187),
DIVINITY(),
DEVOTION("DEVOT", 255, 111, 255),
DREAM(),
DIVINITY("DVNTY", 0, 233, 255),
DOOM(),
DOOM("DOOM", 255, 104, 118),
ECHO(),
DREAM("DREAM", 190, 189, 255),
ELIXIR(),
ECHO("ECHO", 225, 180, 255),
EON(),
ELIXIR("ELIXR", 81, 221, 175),
EYEBALL(),
EON("EON", 23, 194, 255),
FADE(),
EYEBALL("EYE", 184, 202, 201),
FATE(),
FADE("FADE", 159, 209, 192),
FEATHER(),
FATE("FATE", 255, 164, 226),
FILIBUSTER(),
FEATHER("FTHR", 195, 202, 165),
FLAME(),
FILIBUSTER("FLBTR", 255, 179, 119),
FLOOD(),
FLAME("FLAME", 255, 143, 43),
FUNGUS(),
FLOOD("FLOOD", 0, 203, 255),
FURY(),
FUNGUS("FNGUS", 121, 219, 151),
FUSE(),
FURY("FURY", 255, 120, 89),
GEM(),
FUSE("FUSE", 255, 122, 85),
GLYPH(),
GEM("GEM", 255, 99, 251),
GOLD(),
GLYPH("GLYPH", 184, 202, 199),
GROWTH(),
GOLD("GOLD", 248, 191, 0),
HATCHLING(),
GROWTH("GRWTH", 87, 226, 32),
HEALING(),
HATCHLING("HATCH", 201, 199, 186),
HOOFPRINT(),
HEALING("HEAL", 255, 166, 236),
HOUR(),
HOOFPRINT("HOOF", 233, 189, 170),
HOURGLASS(),
HOUR("HOUR", 198, 197, 210),
HUNGER(),
HOURGLASS("HRGLS", 0, 215, 255),
ICE(),
HUNGER("HUNGR", 255, 91, 149),
INFECTION(),
ICE("ICE", 0, 239, 255),
INTERVENTION(),
INFECTION("INFCT", 0, 230, 66),
ISOLATION(),
INTERVENTION("INTRV", 205, 203, 105),
JAVELIN(),
ISOLATION("ISOLT", 250, 190, 0),
KI(),
JAVELIN("JAVLN", 180, 206, 172),
LEVEL("Level"),
KI("KI", 190, 189, 255),
LORE(),
LEVEL("LEVEL", 60, 222, 185),
LUCK(),
LORE("LORE", 209, 198, 161),
M0M1("-0/-1"),
LUCK("LUCK", 185, 174, 255),
M0M2("-0/-2"),
M0M1("-0/-1", "-0/-1", 255, 110, 106),
M1M0("-1/-0"),
M0M2("-0/-2", "-0/-2", 255, 110, 106),
M2M1("-2/-1"),
M1M0("-1/-0", "-1/-0", 255, 110, 106),
M2M2("-2/-2"),
M2M1("-2/-1", "-2/-1", 255, 110, 106),
MAGNET(),
M2M2("-2/-2", "-2/-2", 255, 110, 106),
MANA(),
MAGNET("MAGNT", 198, 197, 210),
MANIFESTATION(),
MANA("MANA", 0, 237, 152),
MANNEQUIN(),
MANIFESTATION("MNFST", 104, 225, 8),
MATRIX(),
MANNEQUIN("MANQN", 206, 199, 162),
MINE(),
MATRIX("MATRX", 183, 174, 255),
MINING(),
MINE("MINE", 255, 100, 127),
MIRE(),
MINING("MINNG", 184, 201, 207),
MUSIC(),
MIRE("MIRE", 153, 209, 199),
MUSTER(),
MUSIC("MUSIC", 255, 138, 255),
NET(),
MUSTER("MUSTR", 235, 196, 0),
OMEN(),
NET("NET", 0, 221, 251),
ORE(),
OMEN("OMEN", 255, 178, 120),
PAGE(),
ORE("ORE", 200, 201, 163),
PAIN(),
PAGE("PAGE", 218, 195, 162),
PARALYZATION(),
PAIN("PAIN", 255, 108, 111),
PETAL(),
PARALYZATION("PRLYZ", 220, 201, 0),
PETRIFICATION(),
PETAL("PETAL", 255, 162, 216),
PIN(),
PETRIFICATION("PETRI", 185, 201, 208),
PLAGUE(),
PIN("PIN", 194, 196, 233),
PLOT(),
PLAGUE("PLGUE", 94, 226, 25),
PRESSURE(),
PLOT("PLOT", 255, 172, 133),
PHYLACTERY,
PRESSURE("PRESS", 255, 164, 159),
POLYP(),
PHYLACTERY("PHYLA", 117, 219, 153),
PUPA(),
POLYP("POLYP", 236, 185, 198),
P0P1("+0/+1"),
PUPA("PUPA", 0, 223, 203),
P0P2("+0/+2"),
P0P1("+0/+1", "+0/+1", 96, 226, 23),
P1P0("+1/+0"),
P0P2("+0/+2", "+0/+2", 96, 226, 23),
P1P2("+1/+2"),
P1P0("+1/+0", "+1/+0", 96, 226, 23),
P2P0("+2/+0"),
P1P2("+1/+2", "+1/+2", 96, 226, 23),
P2P2("+2/+2"),
P2P0("+2/+0", "+2/+0", 96, 226, 23),
QUEST(),
P2P2("+2/+2", "+2/+2", 96, 226, 23),
RUST(),
QUEST("QUEST", 251, 189, 0),
SCREAM(),
RUST("RUST", 255, 181, 116),
SCROLL(),
SCREAM("SCREM", 0, 220, 255),
SHELL(),
SCROLL("SCRLL", 206, 199, 162),
SHIELD(),
SHELL("SHELL", 190, 207, 111),
SHRED(),
SHIELD("SHLD", 202, 198, 186),
SLEEP(),
SHRED("SHRED", 255, 165, 152),
SLEIGHT(),
SLEEP("SLEEP", 178, 192, 255),
SLIME(),
SLEIGHT("SLGHT", 185, 174, 255),
SOOT(),
SLIME("SLIME", 101, 220, 163 ),
SPITE(),
SOOT("SOOT", 211, 194, 198),
SPORE(),
SPITE("SPITE", 0, 218, 255),
STORAGE(),
SPORE("SPORE", 122, 218, 150),
STRIFE(),
STORAGE("STORG", 255, 177, 121),
STUDY(),
STRIFE("STRFE", 255, 89, 223),
THEFT(),
STUDY("STUDY", 226, 192, 165),
TIDE(),
THEFT("THEFT", 255, 176, 125),
TIME(),
TIDE("TIDE", 0, 212, 187),
TOWER("tower"),
TIME("TIME", 255, 121, 255),
TRAINING(),
TOWER("tower", "TOWER", 0, 239, 255),
TRAP(),
TRAINING("TRAIN", 220, 201, 0),
TREASURE(),
TRAP("TRAP", 255, 121, 86),
UNITY(),
TREASURE("TRSUR", 255, 184, 0),
VELOCITY(),
UNITY("UNITY", 242, 156, 255),
VERSE(),
VELOCITY("VELO", 255, 95, 138),
VITALITY(),
VERSE("VERSE", 0, 237, 155),
VORTEX(),
VITALITY("VITAL", 255, 94, 142),
WAGE(),
VORTEX("VORTX", 142, 200, 255),
WINCH(),
WAGE("WAGE", 242, 190, 106),
WIND(),
WINCH("WINCH", 208, 195, 203),
WISH(),
WIND("WIND", 0, 236, 255),
WISH("WISH", 255, 85, 206),
// Player Counters
ENERGY(),
ENERGY("ENRGY"),
EXPERIENCE(),
EXPERIENCE("EXP"),
POISON();
POISON("POISN");
private String name;
private String name, counterOnCardDisplayName;
private int red, green, blue;
/**
* <p>
* Constructor for Counters.
* </p>
*/
CounterType() {
this.name = this.name().substring(0, 1).toUpperCase() + this.name().substring(1).toLowerCase();
if (red == 0 && green == 0 && blue == 0) {
red = 255;
green = 255;
blue = 255;
}
}
/**
* <p>
* Constructor for Counters.
* </p>
*
* @param name
* a {@link java.lang.String} object.
*/
CounterType(final String name) {
CounterType(final String counterOnCardDisplayName) {
this();
this.counterOnCardDisplayName = counterOnCardDisplayName;
}
CounterType(final String counterOnCardDisplayName, final int red, final int green, final int blue) {
this(counterOnCardDisplayName);
this.red = red;
this.green = green;
this.blue = blue;
}
CounterType(final String name, final String counterOnCardDisplayName, final int red, final int green, final int blue) {
this(counterOnCardDisplayName, red, green, blue);
this.name = name;
}
/**
* <p>
* Getter for the field <code>name</code>.
* </p>
*
* @return a {@link java.lang.String} object.
*/
public String getName() {
return this.name;
}
/**
* <p>
* getType.
* </p>
*
* @param name
* a {@link java.lang.String} object.
* @return a {@link forge.game.card.CounterType} object.
*/
public int getRed() {
return red;
}
public int getGreen() {
return green;
}
public int getBlue() {
return blue;
}
public String getCounterOnCardDisplayName() {
return counterOnCardDisplayName;
}
public static CounterType getType(final String name) {
final String replacedName = name.replace("/", "").replaceAll("\\+", "p").replaceAll("\\-", "m").toUpperCase();
return Enum.valueOf(CounterType.class, replacedName);
}
public static final ImmutableList<CounterType> values = ImmutableList.copyOf(values());
}

View File

@@ -107,6 +107,7 @@ public enum CSubmenuPreferences implements ICDoc {
lstControls.add(Pair.of(view.getCbUiForTouchScreen(), FPref.UI_FOR_TOUCHSCREN));
lstControls.add(Pair.of(view.getCbTimedTargOverlay(), FPref.UI_TIMED_TARGETING_OVERLAY_UPDATES));
lstControls.add(Pair.of(view.getCbCompactMainMenu(), FPref.UI_COMPACT_MAIN_MENU));
lstControls.add(Pair.of(view.getCbTextBasedCounters(), FPref.UI_TEXT_BASED_COUNTERS));
lstControls.add(Pair.of(view.getCbPromptFreeBlocks(), FPref.MATCHPREF_PROMPT_FREE_BLOCKS));
lstControls.add(Pair.of(view.getCbPauseWhileMinimized(), FPref.UI_PAUSE_WHILE_MINIMIZED));
lstControls.add(Pair.of(view.getCbWorkshopSyntax(), FPref.DEV_WORKSHOP_SYNTAX));

View File

@@ -79,6 +79,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private final JCheckBox cbAltSoundSystem = new OptionsCheckBox("Use Alternate Sound System");
private final JCheckBox cbUiForTouchScreen = new OptionsCheckBox("Enhance UI for Touchscreens");
private final JCheckBox cbTimedTargOverlay = new OptionsCheckBox("Enable Targeting Overlay Optimization");
private final JCheckBox cbTextBasedCounters = new OptionsCheckBox("Use new text-based counters on cards");
private final JCheckBox cbCompactMainMenu = new OptionsCheckBox("Use Compact Main Sidebar Menu");
private final JCheckBox cbDetailedPaymentDesc = new OptionsCheckBox("Spell Description in Payment Prompt");
private final JCheckBox cbPromptFreeBlocks = new OptionsCheckBox("Free Block Handling");
@@ -111,8 +112,10 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
// Spacing between components is defined here.
final String sectionConstraints = "w 80%!, h 42px!, gap 10% 0 10px 10px, span 2 1";
final String regularConstraints = "w 80%!, h 22px!, gap 10% 0 0 10px, span 2 1";
final String sectionConstraints = "w 80%!, h 42px!, gap 10% 0 80px 20px, span 2 1";
final String titleConstraints = "w 80%!, h 22px!, gap 10% 0 0 0px, span 2 1";
final String comboBoxConstraints = "w 80%!, h 25px!, gap 10% 0 0 0px, span 2 1";
final String descriptionConstraints = "w 80%!, h 22px!, gap 10% 0 0 20px, span 2 1";
// Troubleshooting
pnlPrefs.add(new SectionLabel("Troubleshooting"), sectionConstraints);
@@ -128,175 +131,176 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.add(btnContentDirectoryUI, twoButtonConstraints2);
// General Configuration
pnlPrefs.add(new SectionLabel("General Configuration"), sectionConstraints + ", gaptop 2%");
pnlPrefs.add(new SectionLabel("General Configuration"), sectionConstraints);
pnlPrefs.add(getPlayerNamePanel(), regularConstraints + ", h 26px!");
pnlPrefs.add(new NoteLabel("Sets the name that you will be referred to by Forge during gameplay."), regularConstraints);
pnlPrefs.add(cbCompactMainMenu, regularConstraints);
pnlPrefs.add(new NoteLabel("Enable for a space efficient sidebar that displays only one menu group at a time (RESTART REQUIRED)."), regularConstraints);
pnlPrefs.add(getPlayerNamePanel(), titleConstraints + ", h 26px!");
pnlPrefs.add(new NoteLabel("Sets the name that you will be referred to by Forge during gameplay."), descriptionConstraints);
pnlPrefs.add(cbCompactMainMenu, titleConstraints);
pnlPrefs.add(new NoteLabel("Enable for a space efficient sidebar that displays only one menu group at a time (RESTART REQUIRED)."), descriptionConstraints);
// Gameplay Options
pnlPrefs.add(new SectionLabel("Gameplay"), sectionConstraints + ", gaptop 2%");
pnlPrefs.add(new SectionLabel("Gameplay"), sectionConstraints);
pnlPrefs.add(cbpAiProfiles, "w 80%!, gap 10% 0 0 10px, span 2 1");
pnlPrefs.add(new NoteLabel("Choose your AI opponent."), regularConstraints);
pnlPrefs.add(cbpAiProfiles, comboBoxConstraints);
pnlPrefs.add(new NoteLabel("Choose your AI opponent."), descriptionConstraints);
pnlPrefs.add(cbAnte, regularConstraints);
pnlPrefs.add(new NoteLabel("Determines whether or not the game is played for ante."), regularConstraints);
pnlPrefs.add(cbAnte, titleConstraints);
pnlPrefs.add(new NoteLabel("Determines whether or not the game is played for ante."), descriptionConstraints);
pnlPrefs.add(cbAnteMatchRarity, regularConstraints);
pnlPrefs.add(new NoteLabel("Attempts to make antes the same rarity for all players."), regularConstraints);
pnlPrefs.add(cbAnteMatchRarity, titleConstraints);
pnlPrefs.add(new NoteLabel("Attempts to make antes the same rarity for all players."), descriptionConstraints);
pnlPrefs.add(cbEnableAICheats, regularConstraints);
pnlPrefs.add(new NoteLabel("Allow the AI to cheat to gain advantage (for personalities that have cheat shuffling options set)."), regularConstraints);
pnlPrefs.add(cbEnableAICheats, titleConstraints);
pnlPrefs.add(new NoteLabel("Allow the AI to cheat to gain advantage (for personalities that have cheat shuffling options set)."), descriptionConstraints);
pnlPrefs.add(cbManaBurn, regularConstraints);
pnlPrefs.add(new NoteLabel("Play with mana burn (from pre-Magic 2010 rules)."), regularConstraints);
pnlPrefs.add(cbManaBurn, titleConstraints);
pnlPrefs.add(new NoteLabel("Play with mana burn (from pre-Magic 2010 rules)."), descriptionConstraints);
pnlPrefs.add(cbManaLostPrompt, regularConstraints);
pnlPrefs.add(new NoteLabel("When enabled, you get a warning if passing priority would cause you to lose mana in your mana pool."), regularConstraints);
pnlPrefs.add(cbManaLostPrompt, titleConstraints);
pnlPrefs.add(new NoteLabel("When enabled, you get a warning if passing priority would cause you to lose mana in your mana pool."), descriptionConstraints);
pnlPrefs.add(cbEnforceDeckLegality, regularConstraints);
pnlPrefs.add(new NoteLabel("Enforces deck legality relevant to each environment (minimum deck sizes, max card count etc)."), regularConstraints);
pnlPrefs.add(cbEnforceDeckLegality, titleConstraints);
pnlPrefs.add(new NoteLabel("Enforces deck legality relevant to each environment (minimum deck sizes, max card count etc)."), descriptionConstraints);
pnlPrefs.add(cbCloneImgSource, regularConstraints);
pnlPrefs.add(new NoteLabel("When enabled clones will use their original art instead of the cloned card's art."), regularConstraints);
pnlPrefs.add(cbCloneImgSource, titleConstraints);
pnlPrefs.add(new NoteLabel("When enabled clones will use their original art instead of the cloned card's art."), descriptionConstraints);
pnlPrefs.add(cbPromptFreeBlocks, regularConstraints);
pnlPrefs.add(new NoteLabel("When enabled, if you would have to pay 0 to block, pay automatically without prompt."), regularConstraints);
pnlPrefs.add(cbPromptFreeBlocks, titleConstraints);
pnlPrefs.add(new NoteLabel("When enabled, if you would have to pay 0 to block, pay automatically without prompt."), descriptionConstraints);
pnlPrefs.add(cbPauseWhileMinimized, regularConstraints);
pnlPrefs.add(new NoteLabel("When enabled, Forge pauses when minimized (primarily for AI vs AI)."), regularConstraints);
pnlPrefs.add(cbPauseWhileMinimized, titleConstraints);
pnlPrefs.add(new NoteLabel("When enabled, Forge pauses when minimized (primarily for AI vs AI)."), descriptionConstraints);
pnlPrefs.add(cbEscapeEndsTurn, regularConstraints);
pnlPrefs.add(new NoteLabel("When enabled, Escape key functions as an alternative shortcut to end the current turn."), regularConstraints);
pnlPrefs.add(cbEscapeEndsTurn, titleConstraints);
pnlPrefs.add(new NoteLabel("When enabled, Escape key functions as an alternative shortcut to end the current turn."), descriptionConstraints);
pnlPrefs.add(cbDetailedPaymentDesc, regularConstraints);
pnlPrefs.add(new NoteLabel("When enabled, detailed spell/ability descriptions are shown when choosing targets and paying costs."), regularConstraints);
pnlPrefs.add(cbDetailedPaymentDesc, titleConstraints);
pnlPrefs.add(new NoteLabel("When enabled, detailed spell/ability descriptions are shown when choosing targets and paying costs."), descriptionConstraints);
pnlPrefs.add(cbShowStormCount, regularConstraints);
pnlPrefs.add(new NoteLabel("When enabled, displays the current storm count in the prompt pane."), regularConstraints);
pnlPrefs.add(cbShowStormCount, titleConstraints);
pnlPrefs.add(new NoteLabel("When enabled, displays the current storm count in the prompt pane."), descriptionConstraints);
pnlPrefs.add(cbPreselectPrevAbOrder, regularConstraints);
pnlPrefs.add(new NoteLabel("When enabled, preselects the last defined simultaneous ability order in the ordering dialog."), regularConstraints);
pnlPrefs.add(cbPreselectPrevAbOrder, titleConstraints);
pnlPrefs.add(new NoteLabel("When enabled, preselects the last defined simultaneous ability order in the ordering dialog."), descriptionConstraints);
pnlPrefs.add(cbpAutoYieldMode, regularConstraints);
pnlPrefs.add(new NoteLabel("Defines the granularity level of auto-yields (per unique ability or per unique card)."), regularConstraints);
pnlPrefs.add(cbpAutoYieldMode, titleConstraints);
pnlPrefs.add(new NoteLabel("Defines the granularity level of auto-yields (per unique ability or per unique card)."), descriptionConstraints);
// Deck building options
pnlPrefs.add(new SectionLabel("Random Deck Generation"), sectionConstraints);
pnlPrefs.add(cbRemoveSmall, regularConstraints);
pnlPrefs.add(new NoteLabel("Disables 1/1 and 0/X creatures in generated decks."), regularConstraints);
pnlPrefs.add(cbRemoveSmall, titleConstraints);
pnlPrefs.add(new NoteLabel("Disables 1/1 and 0/X creatures in generated decks."), descriptionConstraints);
pnlPrefs.add(cbSingletons, regularConstraints);
pnlPrefs.add(new NoteLabel("Disables non-land duplicates in generated decks."), regularConstraints);
pnlPrefs.add(cbSingletons, titleConstraints);
pnlPrefs.add(new NoteLabel("Disables non-land duplicates in generated decks."), descriptionConstraints);
pnlPrefs.add(cbRemoveArtifacts, regularConstraints);
pnlPrefs.add(new NoteLabel("Disables artifact cards in generated decks."), regularConstraints);
pnlPrefs.add(cbRemoveArtifacts, titleConstraints);
pnlPrefs.add(new NoteLabel("Disables artifact cards in generated decks."), descriptionConstraints);
// Deck building options
pnlPrefs.add(new SectionLabel("Deck Editor Options"), sectionConstraints);
pnlPrefs.add(cbFilterLandsByColorId, regularConstraints);
pnlPrefs.add(new NoteLabel("When using card color filters, filter lands in a way to make it easier to find relevant mana producing lands."), regularConstraints);
pnlPrefs.add(cbFilterLandsByColorId, titleConstraints);
pnlPrefs.add(new NoteLabel("When using card color filters, filter lands in a way to make it easier to find relevant mana producing lands."), descriptionConstraints);
// Advanced
pnlPrefs.add(new SectionLabel("Advanced Settings"), sectionConstraints);
pnlPrefs.add(cbDevMode, regularConstraints);
pnlPrefs.add(new NoteLabel("Enables menu with functions for testing during development."), regularConstraints);
pnlPrefs.add(cbDevMode, titleConstraints);
pnlPrefs.add(new NoteLabel("Enables menu with functions for testing during development."), descriptionConstraints);
pnlPrefs.add(cbWorkshopSyntax, regularConstraints);
pnlPrefs.add(new NoteLabel("Enables syntax checking of card scripts in the Workshop. Note: functionality still in testing phase!"), regularConstraints);
pnlPrefs.add(cbWorkshopSyntax, titleConstraints);
pnlPrefs.add(new NoteLabel("Enables syntax checking of card scripts in the Workshop. Note: functionality still in testing phase!"), descriptionConstraints);
pnlPrefs.add(cbpGameLogEntryType, "w 80%!, gap 10% 0 0 10px, span 2 1");
pnlPrefs.add(new NoteLabel("Changes how much information is displayed in the game log. Sorted by least to most verbose."), regularConstraints);
pnlPrefs.add(cbpGameLogEntryType, comboBoxConstraints);
pnlPrefs.add(new NoteLabel("Changes how much information is displayed in the game log. Sorted by least to most verbose."), descriptionConstraints);
pnlPrefs.add(cbpCloseAction, "w 80%!, gap 10% 0 0 10px, span 2 1");
pnlPrefs.add(new NoteLabel("Changes what happens when clicking the X button in the upper right."), regularConstraints);
pnlPrefs.add(cbpCloseAction, comboBoxConstraints);
pnlPrefs.add(new NoteLabel("Changes what happens when clicking the X button in the upper right."), descriptionConstraints);
pnlPrefs.add(cbLoadCardsLazily, regularConstraints);
pnlPrefs.add(new NoteLabel("If turned on, Forge will load card scripts as they're needed instead of at start up. (Warning: Experimental)"), regularConstraints);
pnlPrefs.add(cbLoadCardsLazily, titleConstraints);
pnlPrefs.add(new NoteLabel("If turned on, Forge will load card scripts as they're needed instead of at start up. (Warning: Experimental)"), descriptionConstraints);
// Graphic Options
pnlPrefs.add(new SectionLabel("Graphic Options"), sectionConstraints + ", gaptop 2%");
pnlPrefs.add(cbImageFetcher, regularConstraints);
pnlPrefs.add(new NoteLabel("Enables live fetching of missing card images from an online resource."), regularConstraints);
pnlPrefs.add(cbImageFetcher, titleConstraints);
pnlPrefs.add(new NoteLabel("Enables live fetching of missing card images from an online resource."), descriptionConstraints);
pnlPrefs.add(cbDisplayFoil, regularConstraints);
pnlPrefs.add(new NoteLabel("Displays foil cards with the visual foil overlay effect."), regularConstraints);
pnlPrefs.add(cbDisplayFoil, titleConstraints);
pnlPrefs.add(new NoteLabel("Displays foil cards with the visual foil overlay effect."), descriptionConstraints);
pnlPrefs.add(cbRandomFoil, regularConstraints);
pnlPrefs.add(new NoteLabel("Adds foil effect to random cards."), regularConstraints);
pnlPrefs.add(cbRandomFoil, titleConstraints);
pnlPrefs.add(new NoteLabel("Adds foil effect to random cards."), descriptionConstraints);
pnlPrefs.add(cbScaleLarger, regularConstraints);
pnlPrefs.add(new NoteLabel("Allows card pictures to be expanded larger than their original size."), regularConstraints);
pnlPrefs.add(cbScaleLarger, titleConstraints);
pnlPrefs.add(new NoteLabel("Allows card pictures to be expanded larger than their original size."), descriptionConstraints);
pnlPrefs.add(cbRenderBlackCardBorders, regularConstraints);
pnlPrefs.add(new NoteLabel("Render black borders around card images."), regularConstraints);
pnlPrefs.add(cbRenderBlackCardBorders, titleConstraints);
pnlPrefs.add(new NoteLabel("Render black borders around card images."), descriptionConstraints);
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(cbLargeCardViewers, titleConstraints);
pnlPrefs.add(new NoteLabel("Makes all card viewers much larger for use with high resolution images. Will not fit on smaller screens."), descriptionConstraints);
pnlPrefs.add(cbSmallDeckViewer, regularConstraints);
pnlPrefs.add(new NoteLabel("Sets the deck viewer window to be 800x600 rather than a proportion of the screen size."), regularConstraints);
pnlPrefs.add(cbSmallDeckViewer, titleConstraints);
pnlPrefs.add(new NoteLabel("Sets the deck viewer window to be 800x600 rather than a proportion of the screen size."), descriptionConstraints);
pnlPrefs.add(cbRandomArtInPools, regularConstraints);
pnlPrefs.add(new NoteLabel("Generates cards with random art in generated limited mode card pools."), regularConstraints);
pnlPrefs.add(cbRandomArtInPools, titleConstraints);
pnlPrefs.add(new NoteLabel("Generates cards with random art in generated limited mode card pools."), descriptionConstraints);
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(cbUiForTouchScreen, titleConstraints);
pnlPrefs.add(new NoteLabel("Increases some UI elements to provide a better experience on touchscreen devices. (Needs restart)"), descriptionConstraints);
pnlPrefs.add(cbCompactPrompt, regularConstraints);
pnlPrefs.add(new NoteLabel("Hide header and use smaller font in Prompt pane to make it more compact."), regularConstraints);
pnlPrefs.add(cbCompactPrompt, titleConstraints);
pnlPrefs.add(new NoteLabel("Hide header and use smaller font in Prompt pane to make it more compact."), descriptionConstraints);
/*pnlPrefs.add(cbStackCardView, regularConstraints); TODO: Show this checkbox when setting can support being enabled
pnlPrefs.add(new NoteLabel("Show cards and abilities on Stack in card view rather than list view."), regularConstraints);*/
/*pnlPrefs.add(cbStackCardView, titleConstraints); TODO: Show this checkbox when setting can support being enabled
pnlPrefs.add(new NoteLabel("Show cards and abilities on Stack in card view rather than list view."), descriptionConstraints);*/
pnlPrefs.add(cbHideReminderText, regularConstraints);
pnlPrefs.add(new NoteLabel("Hide reminder text in Card Detail pane."), regularConstraints);
pnlPrefs.add(cbHideReminderText, titleConstraints);
pnlPrefs.add(new NoteLabel("Hide reminder text in Card Detail pane."), descriptionConstraints);
pnlPrefs.add(cbOpenPacksIndiv, regularConstraints);
pnlPrefs.add(new NoteLabel("When opening Fat Packs and Booster Boxes, booster packs will be opened and displayed one at a time."), regularConstraints);
pnlPrefs.add(cbOpenPacksIndiv, titleConstraints);
pnlPrefs.add(new NoteLabel("When opening Fat Packs and Booster Boxes, booster packs will be opened and displayed one at a time."), descriptionConstraints);
pnlPrefs.add(cbTokensInSeparateRow, regularConstraints);
pnlPrefs.add(new NoteLabel("Displays tokens in a separate row on the battlefield below the non-token creatures."), regularConstraints);
pnlPrefs.add(cbTokensInSeparateRow, titleConstraints);
pnlPrefs.add(new NoteLabel("Displays tokens in a separate row on the battlefield below the non-token creatures."), descriptionConstraints);
pnlPrefs.add(cbStackCreatures, regularConstraints);
pnlPrefs.add(new NoteLabel("Stacks identical creatures on the battlefield like lands, artifacts, and enchantments."), regularConstraints);
pnlPrefs.add(cbStackCreatures, titleConstraints);
pnlPrefs.add(new NoteLabel("Stacks identical creatures on the battlefield like lands, artifacts, and enchantments."), descriptionConstraints);
pnlPrefs.add(cbTimedTargOverlay, "w 80%!, gap 10% 0 0 10px, span 2 1");
pnlPrefs.add(new NoteLabel("Enables throttling-based optimization of targeting overlay to reduce CPU use (only disable if you experience choppiness on older hardware, requires starting a new match)"), regularConstraints);
pnlPrefs.add(cbTimedTargOverlay, titleConstraints);
pnlPrefs.add(new NoteLabel("Enables throttling-based optimization of targeting overlay to reduce CPU use (only disable if you experience choppiness on older hardware, requires starting a new match)"), descriptionConstraints);
pnlPrefs.add(cbpDisplayCurrentCardColors, "w 80%!, gap 10% 0 0 10px, span 2 1");
pnlPrefs.add(new NoteLabel("Displays the breakdown of the current color of cards in the card detail information panel."), regularConstraints);
pnlPrefs.add(cbTextBasedCounters, titleConstraints);
pnlPrefs.add(new NoteLabel("Enables text-based counters on cards instead of the old image based ones"), descriptionConstraints);
pnlPrefs.add(cbpDisplayCurrentCardColors, comboBoxConstraints);
pnlPrefs.add(new NoteLabel("Displays the breakdown of the current color of cards in the card detail information panel."), descriptionConstraints);
// Sound options
pnlPrefs.add(new SectionLabel("Sound Options"), sectionConstraints + ", gaptop 2%");
pnlPrefs.add(cbEnableSounds, regularConstraints);
pnlPrefs.add(new NoteLabel("Enable sound effects during the game."), regularConstraints);
pnlPrefs.add(cbEnableSounds, titleConstraints);
pnlPrefs.add(new NoteLabel("Enable sound effects during the game."), descriptionConstraints);
pnlPrefs.add(cbEnableMusic, regularConstraints);
pnlPrefs.add(new NoteLabel("Enable background music during the game."), regularConstraints);
pnlPrefs.add(cbEnableMusic, titleConstraints);
pnlPrefs.add(new NoteLabel("Enable background music during the game."), descriptionConstraints);
pnlPrefs.add(cbAltSoundSystem, regularConstraints);
pnlPrefs.add(new NoteLabel("Use the alternate sound system (only use if you have issues with sound not playing or disappearing)."), regularConstraints);
pnlPrefs.add(cbAltSoundSystem, titleConstraints);
pnlPrefs.add(new NoteLabel("Use the alternate sound system (only use if you have issues with sound not playing or disappearing)."), descriptionConstraints);
// Keyboard shortcuts
final JLabel lblShortcuts = new SectionLabel("Keyboard Shortcuts");
pnlPrefs.add(lblShortcuts, sectionConstraints + ", gaptop 2%");
pnlPrefs.add(new SectionLabel("Keyboard Shortcuts"), sectionConstraints);
final List<Shortcut> shortcuts = KeyboardShortcuts.getKeyboardShortcuts();
for (final Shortcut s : shortcuts) {
pnlPrefs.add(new FLabel.Builder().text(s.getDescription())
.fontAlign(SwingConstants.RIGHT).build(), "w 50%!, h 22px!, gap 0 2% 0 1%");
.fontAlign(SwingConstants.RIGHT).build(), "w 50%!, h 22px!, gap 0 2% 0 20px");
KeyboardShortcutField field = new KeyboardShortcutField(s);
pnlPrefs.add(field, "w 25%!");
shortcutFields.put(s.getPrefKey(), field);
@@ -665,6 +669,10 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
return cbPreselectPrevAbOrder;
}
public final JCheckBox getCbTextBasedCounters() {
return cbTextBasedCounters;
}
/** @return {@link forge.toolbox.FLabel} */
public FLabel getBtnReset() {
return btnReset;

View File

@@ -17,18 +17,17 @@
*/
package forge.toolbox;
import java.awt.Graphics;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import com.esotericsoftware.minlog.Log;
import forge.assets.FSkinProp;
import forge.card.mana.ManaCost;
import forge.card.mana.ManaCostShard;
import forge.toolbox.FSkin.SkinImage;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
/**
* <p>
* CardFaceSymbols class.
@@ -182,7 +181,7 @@ public class CardFaceSymbols {
* @param h and int
*/
public static void drawOther(final Graphics g, final String s, int x, final int y, final int w, final int h) {
if (s.length() == 0) {
if (s.isEmpty()) {
return;
}

View File

@@ -17,23 +17,6 @@
*/
package forge.view.arcane;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JRootPane;
import javax.swing.SwingUtilities;
import forge.CachedCardImage;
import forge.FThreads;
import forge.StaticData;
@@ -42,6 +25,7 @@ import forge.card.mana.ManaCost;
import forge.game.card.Card;
import forge.game.card.CardView;
import forge.game.card.CardView.CardStateView;
import forge.game.card.CounterType;
import forge.gui.CardContainer;
import forge.item.PaperCard;
import forge.model.FModel;
@@ -52,6 +36,18 @@ import forge.toolbox.FSkin.SkinnedPanel;
import forge.toolbox.IDisposable;
import forge.view.arcane.util.OutlinedLabel;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.font.TextAttribute;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* CardPanel class.
@@ -251,9 +247,8 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
}
// Black fill - (will become outline for white bordered cards)
final int n = 0;
g2d.setColor(Color.black);
g2d.fillRoundRect(cardXOffset - n, (cardYOffset - n) + offset, cardWidth + (n * 2), cardHeight + (n * 2), cornerSize + n , cornerSize + n);
g2d.fillRoundRect(cardXOffset, cardYOffset + offset, cardWidth, cardHeight, cornerSize, cornerSize);
// White border if card is known to have it.
if (getCard() != null && matchUI.mayView(getCard())) {
@@ -310,21 +305,11 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
@Override
public final void doLayout() {
// Determine whether to render border from properties
boolean noBorderPref = !isPreferenceEnabled(FPref.UI_RENDER_BLACK_BORDERS);
// Borderless cards should be accounted for here
boolean noBorderOnCard = getCard().getCurrentState().getSetCode().equalsIgnoreCase("MPS_AKH");
boolean cardImgHasAlpha = imagePanel != null && imagePanel.getSrcImage() != null && imagePanel.getSrcImage().getColorModel().hasAlpha();
int borderSize = 0;
if (!noBorderPref && !(noBorderOnCard && cardImgHasAlpha)) {
// A 2 px border is necessary to ensure the rounded card corners don't glitch when the card is highlighted
borderSize = noBorderOnCard ? 2 : Math.round(cardWidth * CardPanel.BLACK_BORDER_SIZE);
}
int borderSize = calculateBorderSize();
final Point imgPos = new Point(cardXOffset + borderSize, cardYOffset + borderSize);
final Dimension imgSize = new Dimension(cardWidth - (borderSize * 2), cardHeight - (borderSize * 2));
final Dimension imgSize = calculateImageSize();
imagePanel.setLocation(imgPos);
imagePanel.setSize(imgSize);
@@ -337,6 +322,29 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
displayCardIdOverlay(showText && canShow && showCardIdOverlay(), imgSize, imgPos);
}
private int calculateBorderSize() {
// Determine whether to render border from properties
boolean noBorderPref = !isPreferenceEnabled(FPref.UI_RENDER_BLACK_BORDERS);
// Borderless cards should be accounted for here
boolean noBorderOnCard = getCard().getCurrentState().getSetCode().equalsIgnoreCase("MPS_AKH");
boolean cardImgHasAlpha = imagePanel != null && imagePanel.getSrcImage() != null && imagePanel.getSrcImage().getColorModel().hasAlpha();
if (!noBorderPref && !(noBorderOnCard && cardImgHasAlpha)) {
// A 2 px border is necessary to ensure the rounded card corners don't glitch when the card is highlighted
return noBorderOnCard ? 2 : Math.round(cardWidth * CardPanel.BLACK_BORDER_SIZE);
}
return 0;
}
private Dimension calculateImageSize() {
int borderSize = calculateBorderSize();
return new Dimension(cardWidth - (borderSize * 2), cardHeight - (borderSize * 2));
}
private void displayCardIdOverlay(final boolean isVisible, final Dimension imgSize, final Point imgPos) {
if (isVisible) {
final Dimension idSize = cardIdText.getPreferredSize();
@@ -394,14 +402,18 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
}
}
int number = 0;
if (card.getCounters() != null) {
if (isPreferenceEnabled(FPref.UI_TEXT_BASED_COUNTERS)) {
drawCounterTabs(g);
} else {
int counters = 0;
for (final Integer i : card.getCounters().values()) {
number += i.intValue();
}
counters += i;
}
final int counters = number;
final int yCounters = (cardYOffset + cardHeight) - (cardHeight / 3) - 40;
if (counters == 1) {
@@ -414,6 +426,10 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
CardFaceSymbols.drawSymbol("countersMulti", g, cardXOffset - 15, yCounters);
}
}
}
final int combatXSymbols = (cardXOffset + (cardWidth / 4)) - 16;
final int stateXSymbols = (cardXOffset + (cardWidth / 2)) - 16;
final int ySymbols = (cardYOffset + cardHeight) - (cardHeight / 8) - 16;
@@ -437,6 +453,93 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
CardFaceSymbols.drawSymbol("sacrifice", g, (cardXOffset + (cardWidth / 2)) - 20,
(cardYOffset + (cardHeight / 2)) - 20);
}
}
private void drawCounterTabs(final Graphics g) {
final Dimension imgSize = calculateImageSize();
final int titleY = Math.round(imgSize.height * (54f / 640)) - 15;
final int spaceFromTopOfCard = titleY + 65;
final int counterBoxHeight = 27;
final int counterBoxBaseWidth = 65;
final int counterBoxSpacing = 2;
int currentCounter = 0;
Map<TextAttribute, Object> attributes = new HashMap<>();
attributes.put(TextAttribute.FAMILY, "Roboto Bold");
attributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
attributes.put(TextAttribute.SIZE, 11);
attributes.put(TextAttribute.KERNING, TextAttribute.KERNING_ON);
Font smallFont = Font.getFont(attributes);
attributes.put(TextAttribute.SIZE, 15);
Font largeFont = Font.getFont(attributes);
FontMetrics smallFontMetrics = g.getFontMetrics(smallFont);
FontMetrics largeFontMetrics = g.getFontMetrics(largeFont);
for (Map.Entry<CounterType, Integer> counterEntry : card.getCounters().entrySet()) {
final CounterType counter = counterEntry.getKey();
final int numberOfCounters = counterEntry.getValue();
final int counterBoxRealWidth = counterBoxBaseWidth + largeFontMetrics.stringWidth(String.valueOf(numberOfCounters));
final int counterYOffset = cardYOffset + spaceFromTopOfCard - counterBoxHeight + currentCounter++ * (counterBoxHeight + counterBoxSpacing);
if (isSelected) {
g.setColor(new Color(0, 0, 0, 255));
} else {
g.setColor(new Color(0, 0, 0, 200));
}
RoundRectangle2D counterArea = new RoundRectangle2D.Float(cardXOffset, counterYOffset, counterBoxRealWidth, counterBoxHeight, 10, 10);
((Graphics2D) g).fill(counterArea);
g.fillRect(cardXOffset, counterYOffset, 10, counterBoxHeight);
if (isSelected) {
g.setColor(new Color(counter.getRed(), counter.getGreen(), counter.getBlue()));
} else {
g.setColor(new Color(counter.getRed(), counter.getGreen(), counter.getBlue(), 180));
}
Rectangle nameBounds = counterArea.getBounds();
nameBounds.x += 13;
nameBounds.width = 48;
drawVerticallyCenteredString(g, counter.getCounterOnCardDisplayName(), nameBounds, smallFont, smallFontMetrics);
Rectangle numberBounds = counterArea.getBounds();
numberBounds.x += 58;
drawVerticallyCenteredString(g, String.valueOf(numberOfCounters), numberBounds, largeFont, largeFontMetrics);
}
}
/**
* Draws a String justified to the left of the rectangle, centered vertically.
*
* @param g The Graphics instance.
* @param text The String to draw.
* @param area The Rectangle to center the text in.
* @param font The font to use to draw the text.
*/
private void drawVerticallyCenteredString(Graphics g, String text, Rectangle area, Font font, final FontMetrics fontMetrics) {
Font oldFont = g.getFont();
int x = area.x;
int y = area.y + (area.height - fontMetrics.getHeight()) / 2 + fontMetrics.getAscent();
g.setFont(font);
g.drawString(text, x, y);
g.setFont(oldFont);
}
@Override

View File

@@ -1,14 +1,9 @@
package forge.app;
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.badlogic.gdx.backends.lwjgl.LwjglClipboard;
import forge.Forge;
import forge.assets.AssetsDownloader;
import forge.interfaces.IDeviceAdapter;
@@ -17,6 +12,10 @@ import forge.util.OperatingSystem;
import forge.util.RestartUtil;
import forge.util.Utils;
import java.awt.*;
import java.io.File;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
// Set this to "true" to make the mobile game port run as a full-screen desktop application
@@ -55,6 +54,9 @@ public class Main {
}
}
screenWidth = 640;
screenHeight = 960;
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.resizable = false;
config.width = desktopMode ? desktopScreenWidth : screenWidth;

View File

@@ -90,6 +90,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
UI_PRESELECT_PREVIOUS_ABILITY_ORDER ("false"),
UI_AUTO_YIELD_MODE (ForgeConstants.AUTO_YIELD_PER_ABILITY),
UI_SHOW_STORM_COUNT_IN_PROMPT ("false"),
UI_TEXT_BASED_COUNTERS ("true"),
UI_FOR_TOUCHSCREN("false"),