mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +00:00
Add alternate preference for displaying life, experience, energy and poison counters
This commit is contained in:
@@ -64,6 +64,7 @@ public class Forge implements ApplicationListener {
|
||||
public static float heigtModifier = 0.0f;
|
||||
private static boolean isloadingaMatch = false;
|
||||
public static boolean showFPS = false;
|
||||
public static boolean altPlayerLayout = false;
|
||||
public static boolean enableUIMask = false;
|
||||
public static boolean enablePreloadExtendedArt = false;
|
||||
public static String locale = "en-US";
|
||||
@@ -123,6 +124,7 @@ public class Forge implements ApplicationListener {
|
||||
|
||||
textureFiltering = prefs.getPrefBoolean(FPref.UI_LIBGDX_TEXTURE_FILTERING);
|
||||
showFPS = prefs.getPrefBoolean(FPref.UI_SHOW_FPS);
|
||||
altPlayerLayout = prefs.getPrefBoolean(FPref.UI_ALT_PLAYERINFOLAYOUT);
|
||||
enableUIMask = prefs.getPrefBoolean(FPref.UI_ENABLE_BORDER_MASKING);
|
||||
enablePreloadExtendedArt = prefs.getPrefBoolean(FPref.UI_ENABLE_PRELOAD_EXTENDED_ART);
|
||||
locale = prefs.getPref(FPref.UI_LANGUAGE);
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import forge.Forge;
|
||||
import forge.Graphics;
|
||||
import forge.assets.FImage;
|
||||
import forge.assets.FSkinFont;
|
||||
@@ -69,6 +70,9 @@ public class VAvatar extends FDisplayObject {
|
||||
float h = getHeight();
|
||||
g.drawImage(image, 0, 0, w, h);
|
||||
|
||||
if (Forge.altPlayerLayout && Forge.isLandscapeMode())
|
||||
return;
|
||||
|
||||
//display XP in lower right corner of avatar
|
||||
int xp = player.getCounters(CounterEnumType.EXPERIENCE);
|
||||
if (xp > 0) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import forge.Forge;
|
||||
@@ -30,6 +31,7 @@ import forge.util.Utils;
|
||||
public class VPlayerPanel extends FContainer {
|
||||
private static final FSkinFont LIFE_FONT = FSkinFont.get(18);
|
||||
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 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);
|
||||
@@ -49,6 +51,7 @@ public class VPlayerPanel extends FContainer {
|
||||
private float avatarHeight = VAvatar.HEIGHT;
|
||||
private float displayAreaHeightFactor = 1.0f;
|
||||
private boolean forMultiPlayer = false;
|
||||
public int adjustHeight = 1;
|
||||
|
||||
public VPlayerPanel(PlayerView player0, boolean showHand, int playerCount) {
|
||||
player = player0;
|
||||
@@ -285,8 +288,14 @@ public class VPlayerPanel extends FContainer {
|
||||
float y = 0;
|
||||
avatar.setPosition(x, y);
|
||||
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 infoTabHeight = (height - y) / tabs.size();
|
||||
for (InfoTab tab : tabs) {
|
||||
@@ -362,6 +371,7 @@ public class VPlayerPanel extends FContainer {
|
||||
private int life = player.getLife();
|
||||
private int poisonCounters = player.getCounters(CounterEnumType.POISON);
|
||||
private int energyCounters = player.getCounters(CounterEnumType.ENERGY);
|
||||
private int experienceCounters = player.getCounters(CounterEnumType.EXPERIENCE);
|
||||
private String lifeStr = String.valueOf(life);
|
||||
|
||||
private LifeLabel() {
|
||||
@@ -389,6 +399,7 @@ public class VPlayerPanel extends FContainer {
|
||||
}
|
||||
|
||||
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
|
||||
if (vibrateDuration > 0 && MatchController.instance.isLocalPlayer(player) &&
|
||||
@@ -406,22 +417,50 @@ public class VPlayerPanel extends FContainer {
|
||||
|
||||
@Override
|
||||
public void draw(Graphics g) {
|
||||
if (poisonCounters == 0 && energyCounters == 0) {
|
||||
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);
|
||||
adjustHeight = 1;
|
||||
if(Forge.altPlayerLayout && Forge.isLandscapeMode()) {
|
||||
if (poisonCounters == 0 && energyCounters == 0 && experienceCounters == 0) {
|
||||
g.drawOutlinedText(lifeStr, INFO2_FONT, INFO_FORE_COLOR.getColor(), Color.BLACK, 0, 0, getWidth(), getHeight(), false, Align.left, false);
|
||||
} else {
|
||||
float halfHeight = getHeight() / 2;
|
||||
float textStart = halfHeight + Utils.scale(1);
|
||||
float textWidth = getWidth() - textStart;
|
||||
int mod = 1;
|
||||
g.drawImage(FSkinImage.QUEST_LIFE, 0, 0, halfHeight, halfHeight);
|
||||
g.drawOutlinedText(lifeStr, INFO_FONT, INFO_FORE_COLOR.getColor(), Color.BLACK, textStart, 0, textWidth, halfHeight, false, Align.left, false);
|
||||
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 {
|
||||
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);
|
||||
} else {
|
||||
if (poisonCounters == 0 && energyCounters == 0) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,6 +190,16 @@ public class SettingsPage extends TabPage<SettingsScreen> {
|
||||
localizer.getMessage("cbEscapeEndsTurn"),
|
||||
localizer.getMessage("nlEscapeEndsTurn")),
|
||||
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
|
||||
lstSettings.addItem(new BooleanSetting(FPref.DECKGEN_NOSMALL,
|
||||
|
||||
@@ -113,6 +113,8 @@ cbpAutoYieldMode=Automatische Bestätigung
|
||||
cbpCounterDisplayType=Markeranzeige Art
|
||||
cbpCounterDisplayLocation=Markeranzeige Ort
|
||||
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
|
||||
GeneralConfiguration=Allgemeine Einstellungen
|
||||
lblPlayerName=Spielername
|
||||
|
||||
@@ -113,6 +113,8 @@ cbpAutoYieldMode=Auto-Yield
|
||||
cbpCounterDisplayType=Counter Display Type
|
||||
cbpCounterDisplayLocation=Counter Display Location
|
||||
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
|
||||
GeneralConfiguration=General Configuration
|
||||
lblPlayerName=Player Name
|
||||
|
||||
@@ -113,6 +113,8 @@ cbpAutoYieldMode=Auto-Ceder
|
||||
cbpCounterDisplayType=Estilo de los contadores
|
||||
cbpCounterDisplayLocation=Ubicación del contador
|
||||
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
|
||||
GeneralConfiguration=Configuración general
|
||||
lblPlayerName=Nombre Jugador
|
||||
|
||||
@@ -113,6 +113,8 @@ cbpAutoYieldMode=Auto-Yield
|
||||
cbpCounterDisplayType=Tipo di display contatore
|
||||
cbpCounterDisplayLocation=Posizione display contatore
|
||||
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
|
||||
GeneralConfiguration=Configurazione generale
|
||||
lblPlayerName=Nome del giocatore
|
||||
|
||||
@@ -113,6 +113,8 @@ cbpAutoYieldMode=自动让过
|
||||
cbpCounterDisplayType=计数器显示类型
|
||||
cbpCounterDisplayLocation=计数器显示区域
|
||||
cbpGraveyardOrdering=允许指衍生物进入墓地
|
||||
lblAltLifeDisplay=Alternate Player Layout (Landscape Mode)
|
||||
nlAltLifeDisplay=Enables alternate layout for displaying Player Life, Poison, Energy and Experience counters.
|
||||
Troubleshooting=故障排除
|
||||
GeneralConfiguration=常规配置
|
||||
lblPlayerName=玩家名称
|
||||
|
||||
@@ -127,6 +127,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
|
||||
UI_DISPLAY_CURRENT_COLORS(ForgeConstants.DISP_CURRENT_COLORS_NEVER),
|
||||
UI_FILTER_LANDS_BY_COLOR_IDENTITY("true"),
|
||||
UI_ALLOW_ESC_TO_END_TURN ("false"),
|
||||
UI_ALT_PLAYERINFOLAYOUT ("false"),
|
||||
UI_PRESELECT_PREVIOUS_ABILITY_ORDER ("false"),
|
||||
UI_AUTO_YIELD_MODE (ForgeConstants.AUTO_YIELD_PER_ABILITY),
|
||||
UI_SHOW_STORM_COUNT_IN_PROMPT ("false"),
|
||||
|
||||
Reference in New Issue
Block a user