add ManaCostShard Map and cleanup Desktop and Mobile (#5215)

* add ManaCostShard Map and cleanup Desktop

* refactor mobile and remove SourceFile enum

* refactor mobile using ManaCostShard

* Fix Phyrexian Symbols and better String=>SkinProp mapping
This commit is contained in:
Hans Mackowiak
2024-05-18 12:13:19 +02:00
committed by GitHub
parent c71c2c25e1
commit d384da986b
16 changed files with 682 additions and 870 deletions

View File

@@ -17,6 +17,14 @@
*/
package forge.localinstance.skin;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import forge.card.mana.ManaCostShard;
import forge.localinstance.properties.ForgeConstants;
/**
* Assembles settings from selected or default theme as appropriate. Saves in a
* hashtable, access using .get(settingName) method.
@@ -575,28 +583,108 @@ public enum FSkinProp {
return coords[3];
}
public static Map<ManaCostShard, FSkinProp> SHARD_IMG = ImmutableMap.<ManaCostShard, FSkinProp>builder()
.put(ManaCostShard.WHITE, IMG_MANA_W)
.put(ManaCostShard.BLUE, IMG_MANA_U)
.put(ManaCostShard.BLACK, IMG_MANA_B)
.put(ManaCostShard.RED, IMG_MANA_R)
.put(ManaCostShard.GREEN, IMG_MANA_G)
.put(ManaCostShard.COLORLESS, IMG_MANA_COLORLESS)
.put(ManaCostShard.WU, IMG_MANA_HYBRID_WU)
.put(ManaCostShard.WB, IMG_MANA_HYBRID_WB)
.put(ManaCostShard.UB, IMG_MANA_HYBRID_UB)
.put(ManaCostShard.UR, IMG_MANA_HYBRID_UR)
.put(ManaCostShard.BR, IMG_MANA_HYBRID_BR)
.put(ManaCostShard.BG, IMG_MANA_HYBRID_BG)
.put(ManaCostShard.RW, IMG_MANA_HYBRID_RW)
.put(ManaCostShard.RG, IMG_MANA_HYBRID_RG)
.put(ManaCostShard.GW, IMG_MANA_HYBRID_GW)
.put(ManaCostShard.GU, IMG_MANA_HYBRID_GU)
.put(ManaCostShard.W2, IMG_MANA_2W)
.put(ManaCostShard.U2, IMG_MANA_2U)
.put(ManaCostShard.B2, IMG_MANA_2B)
.put(ManaCostShard.R2, IMG_MANA_2R)
.put(ManaCostShard.G2, IMG_MANA_2G)
.put(ManaCostShard.CW, IMG_MANA_HYBRID_CW)
.put(ManaCostShard.CU, IMG_MANA_HYBRID_CU)
.put(ManaCostShard.CB, IMG_MANA_HYBRID_CB)
.put(ManaCostShard.CR, IMG_MANA_HYBRID_CR)
.put(ManaCostShard.CG, IMG_MANA_HYBRID_CG)
.put(ManaCostShard.WP, IMG_MANA_PHRYX_W)
.put(ManaCostShard.UP, IMG_MANA_PHRYX_U)
.put(ManaCostShard.BP, IMG_MANA_PHRYX_B)
.put(ManaCostShard.RP, IMG_MANA_PHRYX_R)
.put(ManaCostShard.GP, IMG_MANA_PHRYX_G)
.put(ManaCostShard.BGP, IMG_MANA_PHRYX_BG)
.put(ManaCostShard.BRP, IMG_MANA_PHRYX_BR)
.put(ManaCostShard.GUP, IMG_MANA_PHRYX_GU)
.put(ManaCostShard.GWP, IMG_MANA_PHRYX_GW)
.put(ManaCostShard.RGP, IMG_MANA_PHRYX_RG)
.put(ManaCostShard.RWP, IMG_MANA_PHRYX_RW)
.put(ManaCostShard.UBP, IMG_MANA_PHRYX_UB)
.put(ManaCostShard.URP, IMG_MANA_PHRYX_UR)
.put(ManaCostShard.WBP, IMG_MANA_PHRYX_WB)
.put(ManaCostShard.WUP, IMG_MANA_PHRYX_WU)
.put(ManaCostShard.S, IMG_MANA_SNOW)
.put(ManaCostShard.X, IMG_MANA_X)
.build();
public static Map<String, FSkinProp> MANA_IMG = Maps.newHashMap();
static {
for (Map.Entry<ManaCostShard, FSkinProp> e : SHARD_IMG.entrySet()) {
MANA_IMG.put(e.getKey().getImageKey(), e.getValue());
}
for (int i = 0; i <= 20; i++) {
MANA_IMG.put(String.valueOf(i), FSkinProp.valueOf("IMG_MANA_" + i));
}
MANA_IMG.put("P", FSkinProp.IMG_MANA_PHRYX);
MANA_IMG.put("Y", FSkinProp.IMG_MANA_Y);
MANA_IMG.put("Z", FSkinProp.IMG_MANA_Z);
MANA_IMG.put("CHAOS", FSkinProp.IMG_CHAOS);
MANA_IMG.put("Q", FSkinProp.IMG_UNTAP);
MANA_IMG.put("T", FSkinProp.IMG_TAP);
}
public enum PropType {
BACKGROUND,
COLOR,
IMAGE,
ICON,
FOIL,
OLD_FOIL,
TROPHY,
ABILITY,
BORDERS,
ADV_BUTTONS,
BUTTONS,
BTNSTART,
MANAICONS,
PHYREXIAN,
COLORLESS_HYBRID,
PLANAR_CONQUEST,
ADVENTURE,
DECKBOX,
SETLOGO,
WATERMARKS,
DRAFTRANKS,
FAVICON
BACKGROUND(null),
COLOR(null),
IMAGE(null),
ICON(ForgeConstants.SPRITE_ICONS_FILE),
FOIL(ForgeConstants.SPRITE_FOILS_FILE),
OLD_FOIL(ForgeConstants.SPRITE_OLD_FOILS_FILE),
TROPHY(ForgeConstants.SPRITE_TROPHIES_FILE),
ABILITY(ForgeConstants.SPRITE_ABILITY_FILE),
BORDERS(ForgeConstants.SPRITE_BORDER_FILE),
ADV_BUTTONS(ForgeConstants.SPRITE_ADV_BUTTONS_FILE),
BUTTONS(ForgeConstants.SPRITE_BUTTONS_FILE),
BTNSTART(ForgeConstants.SPRITE_START_FILE),
MANAICONS(ForgeConstants.SPRITE_MANAICONS_FILE),
PHYREXIAN(ForgeConstants.SPRITE_PHYREXIAN_FILE),
COLORLESS_HYBRID(ForgeConstants.SPRITE_COLORLESS_HYBRID_FILE),
PLANAR_CONQUEST(ForgeConstants.SPRITE_PLANAR_CONQUEST_FILE),
ADVENTURE(ForgeConstants.SPRITE_ADVENTURE_FILE),
DECKBOX(ForgeConstants.SPRITE_DECKBOX_FILE),
SETLOGO(ForgeConstants.SPRITE_SETLOGO_FILE),
WATERMARKS(ForgeConstants.SPRITE_WATERMARK_FILE),
DRAFTRANKS(ForgeConstants.SPRITE_DRAFTRANKS_FILE),
FAVICON(ForgeConstants.SPRITE_FAVICONS_FILE);
private final String filename;
PropType(String filename0) {
filename = filename0;
}
public String getFilename() {
return filename;
}
}
}