Add alternate preference for displaying life, experience, energy and poison counters

This commit is contained in:
Anthony Calosa
2020-10-28 06:19:12 +08:00
parent a733a157b6
commit fde28d1fea
10 changed files with 83 additions and 17 deletions

View File

@@ -64,6 +64,7 @@ public class Forge implements ApplicationListener {
public static float heigtModifier = 0.0f; public static float heigtModifier = 0.0f;
private static boolean isloadingaMatch = false; private static boolean isloadingaMatch = false;
public static boolean showFPS = false; public static boolean showFPS = false;
public static boolean altPlayerLayout = false;
public static boolean enableUIMask = false; public static boolean enableUIMask = false;
public static boolean enablePreloadExtendedArt = false; public static boolean enablePreloadExtendedArt = false;
public static String locale = "en-US"; public static String locale = "en-US";
@@ -123,6 +124,7 @@ public class Forge implements ApplicationListener {
textureFiltering = prefs.getPrefBoolean(FPref.UI_LIBGDX_TEXTURE_FILTERING); textureFiltering = prefs.getPrefBoolean(FPref.UI_LIBGDX_TEXTURE_FILTERING);
showFPS = prefs.getPrefBoolean(FPref.UI_SHOW_FPS); showFPS = prefs.getPrefBoolean(FPref.UI_SHOW_FPS);
altPlayerLayout = prefs.getPrefBoolean(FPref.UI_ALT_PLAYERINFOLAYOUT);
enableUIMask = prefs.getPrefBoolean(FPref.UI_ENABLE_BORDER_MASKING); enableUIMask = prefs.getPrefBoolean(FPref.UI_ENABLE_BORDER_MASKING);
enablePreloadExtendedArt = prefs.getPrefBoolean(FPref.UI_ENABLE_PRELOAD_EXTENDED_ART); enablePreloadExtendedArt = prefs.getPrefBoolean(FPref.UI_ENABLE_PRELOAD_EXTENDED_ART);
locale = prefs.getPref(FPref.UI_LANGUAGE); locale = prefs.getPref(FPref.UI_LANGUAGE);

View File

@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Align;
import forge.Forge;
import forge.Graphics; import forge.Graphics;
import forge.assets.FImage; import forge.assets.FImage;
import forge.assets.FSkinFont; import forge.assets.FSkinFont;
@@ -69,6 +70,9 @@ public class VAvatar extends FDisplayObject {
float h = getHeight(); float h = getHeight();
g.drawImage(image, 0, 0, w, h); g.drawImage(image, 0, 0, w, h);
if (Forge.altPlayerLayout && Forge.isLandscapeMode())
return;
//display XP in lower right corner of avatar //display XP in lower right corner of avatar
int xp = player.getCounters(CounterEnumType.EXPERIENCE); int xp = player.getCounters(CounterEnumType.EXPERIENCE);
if (xp > 0) { if (xp > 0) {

View File

@@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Align;
import forge.Forge; import forge.Forge;
@@ -30,6 +31,7 @@ import forge.util.Utils;
public class VPlayerPanel extends FContainer { public class VPlayerPanel extends FContainer {
private static final FSkinFont LIFE_FONT = FSkinFont.get(18); private static final FSkinFont LIFE_FONT = FSkinFont.get(18);
private static final FSkinFont INFO_FONT = FSkinFont.get(12); private static final FSkinFont INFO_FONT = FSkinFont.get(12);
private static final FSkinFont INFO2_FONT = FSkinFont.get(14);
private static final FSkinColor INFO_FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); private static final FSkinColor INFO_FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT);
private static final FSkinColor DISPLAY_AREA_BACK_COLOR = FSkinColor.get(Colors.CLR_INACTIVE).alphaColor(0.5f); private static final FSkinColor DISPLAY_AREA_BACK_COLOR = FSkinColor.get(Colors.CLR_INACTIVE).alphaColor(0.5f);
private static final FSkinColor DELIRIUM_HIGHLIGHT = FSkinColor.get(Colors.CLR_PHASE_ACTIVE_ENABLED).alphaColor(0.5f); private static final FSkinColor DELIRIUM_HIGHLIGHT = FSkinColor.get(Colors.CLR_PHASE_ACTIVE_ENABLED).alphaColor(0.5f);
@@ -49,6 +51,7 @@ public class VPlayerPanel extends FContainer {
private float avatarHeight = VAvatar.HEIGHT; private float avatarHeight = VAvatar.HEIGHT;
private float displayAreaHeightFactor = 1.0f; private float displayAreaHeightFactor = 1.0f;
private boolean forMultiPlayer = false; private boolean forMultiPlayer = false;
public int adjustHeight = 1;
public VPlayerPanel(PlayerView player0, boolean showHand, int playerCount) { public VPlayerPanel(PlayerView player0, boolean showHand, int playerCount) {
player = player0; player = player0;
@@ -285,8 +288,14 @@ public class VPlayerPanel extends FContainer {
float y = 0; float y = 0;
avatar.setPosition(x, y); avatar.setPosition(x, y);
y += avatar.getHeight(); y += avatar.getHeight();
lblLife.setBounds(x, y, avatar.getWidth(), LIFE_FONT.getLineHeight());
y += lblLife.getHeight(); lblLife.setBounds(x, Forge.altPlayerLayout ? 0 : y, avatar.getWidth(), Forge.altPlayerLayout ? INFO_FONT.getLineHeight() : LIFE_FONT.getLineHeight());
if (Forge.altPlayerLayout) {
if (adjustHeight > 2)
y += INFO_FONT.getLineHeight()/2;
} else
y += lblLife.getHeight();
float infoTabWidth = avatar.getWidth(); float infoTabWidth = avatar.getWidth();
float infoTabHeight = (height - y) / tabs.size(); float infoTabHeight = (height - y) / tabs.size();
for (InfoTab tab : tabs) { for (InfoTab tab : tabs) {
@@ -362,6 +371,7 @@ public class VPlayerPanel extends FContainer {
private int life = player.getLife(); private int life = player.getLife();
private int poisonCounters = player.getCounters(CounterEnumType.POISON); private int poisonCounters = player.getCounters(CounterEnumType.POISON);
private int energyCounters = player.getCounters(CounterEnumType.ENERGY); private int energyCounters = player.getCounters(CounterEnumType.ENERGY);
private int experienceCounters = player.getCounters(CounterEnumType.EXPERIENCE);
private String lifeStr = String.valueOf(life); private String lifeStr = String.valueOf(life);
private LifeLabel() { private LifeLabel() {
@@ -389,6 +399,7 @@ public class VPlayerPanel extends FContainer {
} }
energyCounters = player.getCounters(CounterEnumType.ENERGY); energyCounters = player.getCounters(CounterEnumType.ENERGY);
experienceCounters = player.getCounters(CounterEnumType.EXPERIENCE);
//when gui player loses life, vibrate device for a length of time based on amount of life lost //when gui player loses life, vibrate device for a length of time based on amount of life lost
if (vibrateDuration > 0 && MatchController.instance.isLocalPlayer(player) && if (vibrateDuration > 0 && MatchController.instance.isLocalPlayer(player) &&
@@ -406,22 +417,50 @@ public class VPlayerPanel extends FContainer {
@Override @Override
public void draw(Graphics g) { public void draw(Graphics g) {
if (poisonCounters == 0 && energyCounters == 0) { adjustHeight = 1;
g.drawText(lifeStr, LIFE_FONT, INFO_FORE_COLOR, 0, 0, getWidth(), getHeight(), false, Align.center, true); if(Forge.altPlayerLayout && Forge.isLandscapeMode()) {
} if (poisonCounters == 0 && energyCounters == 0 && experienceCounters == 0) {
else { g.drawOutlinedText(lifeStr, INFO2_FONT, INFO_FORE_COLOR.getColor(), Color.BLACK, 0, 0, getWidth(), getHeight(), false, Align.left, false);
float halfHeight = getHeight() / 2; } else {
float textStart = halfHeight + Utils.scale(1); float halfHeight = getHeight() / 2;
float textWidth = getWidth() - textStart; float textStart = halfHeight + Utils.scale(1);
g.drawImage(FSkinImage.QUEST_LIFE, 0, 0, halfHeight, halfHeight); float textWidth = getWidth() - textStart;
g.drawText(lifeStr, INFO_FONT, INFO_FORE_COLOR, textStart, 0, textWidth, halfHeight, false, Align.center, true); int mod = 1;
if (poisonCounters > 0) { //prioritize showing poison counters over energy counters g.drawImage(FSkinImage.QUEST_LIFE, 0, 0, halfHeight, halfHeight);
g.drawImage(FSkinImage.POISON, 0, halfHeight, halfHeight, halfHeight); g.drawOutlinedText(lifeStr, INFO_FONT, INFO_FORE_COLOR.getColor(), Color.BLACK, textStart, 0, textWidth, halfHeight, false, Align.left, false);
g.drawText(String.valueOf(poisonCounters), INFO_FONT, INFO_FORE_COLOR, textStart, halfHeight, textWidth, halfHeight, false, Align.center, true); if (poisonCounters > 0) {
g.drawImage(FSkinImage.POISON, 0, halfHeight+2, halfHeight, halfHeight);
g.drawOutlinedText(String.valueOf(poisonCounters), INFO_FONT, INFO_FORE_COLOR.getColor(), Color.BLACK, textStart, halfHeight+2, textWidth, halfHeight, false, Align.left, false);
mod+=1;
}
if (energyCounters > 0) {
g.drawImage(FSkinImage.ENERGY, 0, (halfHeight*mod)+2, halfHeight, halfHeight);
g.drawOutlinedText(String.valueOf(energyCounters), INFO_FONT, INFO_FORE_COLOR.getColor(), Color.BLACK, textStart, (halfHeight*mod)+2, textWidth, halfHeight, false, Align.left, false);
mod+=1;
}
if (experienceCounters > 0) {
g.drawImage(FSkinImage.COMMANDER, 0, (halfHeight*mod)+2, halfHeight, halfHeight);
g.drawOutlinedText(String.valueOf(experienceCounters), INFO_FONT, INFO_FORE_COLOR.getColor(), Color.BLACK, textStart, (halfHeight*mod)+2, textWidth, halfHeight, false, Align.left, false);
mod+=1;
}
adjustHeight = (mod > 2) && (avatar.getHeight() < halfHeight*mod)? mod : 1;
} }
else { } else {
g.drawImage(FSkinImage.ENERGY, 0, halfHeight, halfHeight, halfHeight); if (poisonCounters == 0 && energyCounters == 0) {
g.drawText(String.valueOf(energyCounters), INFO_FONT, INFO_FORE_COLOR, textStart, halfHeight, textWidth, halfHeight, false, Align.center, true); g.drawText(lifeStr, LIFE_FONT, INFO_FORE_COLOR, 0, 0, getWidth(), getHeight(), false, Align.center, true);
} else {
float halfHeight = getHeight() / 2;
float textStart = halfHeight + Utils.scale(1);
float textWidth = getWidth() - textStart;
g.drawImage(FSkinImage.QUEST_LIFE, 0, 0, halfHeight, halfHeight);
g.drawText(lifeStr, INFO_FONT, INFO_FORE_COLOR, textStart, 0, textWidth, halfHeight, false, Align.center, true);
if (poisonCounters > 0) { //prioritize showing poison counters over energy counters
g.drawImage(FSkinImage.POISON, 0, halfHeight, halfHeight, halfHeight);
g.drawText(String.valueOf(poisonCounters), INFO_FONT, INFO_FORE_COLOR, textStart, halfHeight, textWidth, halfHeight, false, Align.center, true);
} else {
g.drawImage(FSkinImage.ENERGY, 0, halfHeight, halfHeight, halfHeight);
g.drawText(String.valueOf(energyCounters), INFO_FONT, INFO_FORE_COLOR, textStart, halfHeight, textWidth, halfHeight, false, Align.center, true);
}
} }
} }
} }

View File

@@ -190,6 +190,16 @@ public class SettingsPage extends TabPage<SettingsScreen> {
localizer.getMessage("cbEscapeEndsTurn"), localizer.getMessage("cbEscapeEndsTurn"),
localizer.getMessage("nlEscapeEndsTurn")), localizer.getMessage("nlEscapeEndsTurn")),
1); 1);
lstSettings.addItem(new BooleanSetting(FPref.UI_ALT_PLAYERINFOLAYOUT,
localizer.getMessage("lblAltLifeDisplay"),
localizer.getMessage("nlAltLifeDisplay")){
@Override
public void select() {
super.select();
//update
Forge.altPlayerLayout = FModel.getPreferences().getPrefBoolean(FPref.UI_ALT_PLAYERINFOLAYOUT);
}
},1);
//Random Deck Generation //Random Deck Generation
lstSettings.addItem(new BooleanSetting(FPref.DECKGEN_NOSMALL, lstSettings.addItem(new BooleanSetting(FPref.DECKGEN_NOSMALL,

View File

@@ -113,6 +113,8 @@ cbpAutoYieldMode=Automatische Bestätigung
cbpCounterDisplayType=Markeranzeige Art cbpCounterDisplayType=Markeranzeige Art
cbpCounterDisplayLocation=Markeranzeige Ort cbpCounterDisplayLocation=Markeranzeige Ort
cbpGraveyardOrdering=Genaue Reihenfolge im Friedhof einhalten cbpGraveyardOrdering=Genaue Reihenfolge im Friedhof einhalten
lblAltLifeDisplay=Alternate Player Layout (Landscape Mode)
nlAltLifeDisplay=Enables alternate layout for displaying Player Life, Poison, Energy and Experience counters.
Troubleshooting=Fehlerbehebung Troubleshooting=Fehlerbehebung
GeneralConfiguration=Allgemeine Einstellungen GeneralConfiguration=Allgemeine Einstellungen
lblPlayerName=Spielername lblPlayerName=Spielername

View File

@@ -113,6 +113,8 @@ cbpAutoYieldMode=Auto-Yield
cbpCounterDisplayType=Counter Display Type cbpCounterDisplayType=Counter Display Type
cbpCounterDisplayLocation=Counter Display Location cbpCounterDisplayLocation=Counter Display Location
cbpGraveyardOrdering=Allow Ordering Cards Put in Graveyard cbpGraveyardOrdering=Allow Ordering Cards Put in Graveyard
lblAltLifeDisplay=Alternate Player Layout (Landscape Mode)
nlAltLifeDisplay=Enables alternate layout for displaying Player Life, Poison, Energy and Experience counters.
Troubleshooting=Troubleshooting Troubleshooting=Troubleshooting
GeneralConfiguration=General Configuration GeneralConfiguration=General Configuration
lblPlayerName=Player Name lblPlayerName=Player Name

View File

@@ -113,6 +113,8 @@ cbpAutoYieldMode=Auto-Ceder
cbpCounterDisplayType=Estilo de los contadores cbpCounterDisplayType=Estilo de los contadores
cbpCounterDisplayLocation=Ubicación del contador cbpCounterDisplayLocation=Ubicación del contador
cbpGraveyardOrdering=Permitir ordenar cartas puestas en el cementerio cbpGraveyardOrdering=Permitir ordenar cartas puestas en el cementerio
lblAltLifeDisplay=Alternate Player Layout (Landscape Mode)
nlAltLifeDisplay=Enables alternate layout for displaying Player Life, Poison, Energy and Experience counters.
Troubleshooting=Solución de problemas Troubleshooting=Solución de problemas
GeneralConfiguration=Configuración general GeneralConfiguration=Configuración general
lblPlayerName=Nombre Jugador lblPlayerName=Nombre Jugador

View File

@@ -113,6 +113,8 @@ cbpAutoYieldMode=Auto-Yield
cbpCounterDisplayType=Tipo di display contatore cbpCounterDisplayType=Tipo di display contatore
cbpCounterDisplayLocation=Posizione display contatore cbpCounterDisplayLocation=Posizione display contatore
cbpGraveyardOrdering=Consenti l''ordinazione di carte messe nel cimitero cbpGraveyardOrdering=Consenti l''ordinazione di carte messe nel cimitero
lblAltLifeDisplay=Alternate Player Layout (Landscape Mode)
nlAltLifeDisplay=Enables alternate layout for displaying Player Life, Poison, Energy and Experience counters.
Troubleshooting=Risoluzione dei problemi Troubleshooting=Risoluzione dei problemi
GeneralConfiguration=Configurazione generale GeneralConfiguration=Configurazione generale
lblPlayerName=Nome del giocatore lblPlayerName=Nome del giocatore

View File

@@ -113,6 +113,8 @@ cbpAutoYieldMode=自动让过
cbpCounterDisplayType=计数器显示类型 cbpCounterDisplayType=计数器显示类型
cbpCounterDisplayLocation=计数器显示区域 cbpCounterDisplayLocation=计数器显示区域
cbpGraveyardOrdering=允许指衍生物进入墓地 cbpGraveyardOrdering=允许指衍生物进入墓地
lblAltLifeDisplay=Alternate Player Layout (Landscape Mode)
nlAltLifeDisplay=Enables alternate layout for displaying Player Life, Poison, Energy and Experience counters.
Troubleshooting=故障排除 Troubleshooting=故障排除
GeneralConfiguration=常规配置 GeneralConfiguration=常规配置
lblPlayerName=玩家名称 lblPlayerName=玩家名称

View File

@@ -127,6 +127,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
UI_DISPLAY_CURRENT_COLORS(ForgeConstants.DISP_CURRENT_COLORS_NEVER), UI_DISPLAY_CURRENT_COLORS(ForgeConstants.DISP_CURRENT_COLORS_NEVER),
UI_FILTER_LANDS_BY_COLOR_IDENTITY("true"), UI_FILTER_LANDS_BY_COLOR_IDENTITY("true"),
UI_ALLOW_ESC_TO_END_TURN ("false"), UI_ALLOW_ESC_TO_END_TURN ("false"),
UI_ALT_PLAYERINFOLAYOUT ("false"),
UI_PRESELECT_PREVIOUS_ABILITY_ORDER ("false"), UI_PRESELECT_PREVIOUS_ABILITY_ORDER ("false"),
UI_AUTO_YIELD_MODE (ForgeConstants.AUTO_YIELD_PER_ABILITY), UI_AUTO_YIELD_MODE (ForgeConstants.AUTO_YIELD_PER_ABILITY),
UI_SHOW_STORM_COUNT_IN_PROMPT ("false"), UI_SHOW_STORM_COUNT_IN_PROMPT ("false"),