Merge branch 'gray_text' into 'master'

Gray text preference

See merge request core-developers/forge!5485
This commit is contained in:
Michael Kamensky
2021-10-01 17:09:36 +00:00
16 changed files with 49 additions and 6 deletions

View File

@@ -16,6 +16,8 @@ public class GameRules {
// it's a preference, not rule... but I could hardly find a better place for it
private boolean canCloneUseTargetsImage;
// same for me
private boolean useGrayText;
public GameRules(final GameType type) {
this.gameType = type;
@@ -99,4 +101,11 @@ public class GameRules {
public void setCanCloneUseTargetsImage(final boolean canCloneUseTargetsImage) {
this.canCloneUseTargetsImage = canCloneUseTargetsImage;
}
public boolean useGrayText() {
return useGrayText;
}
public void setUseGrayText(final boolean useGrayText) {
this.useGrayText = useGrayText;
}
}

View File

@@ -2225,6 +2225,10 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
final String linebreak = "\r\n\r\n";
final String grayTag = "<span style=\"color:gray;\">";
final String endTag = "</span>";
boolean useGrayTag = true;
if (getGame() != null && getController() != null && game.getAge() != GameStage.Play) {
useGrayTag = game.getRules().useGrayText();
}
final CardTypeView type = state.getType();
final StringBuilder sb = new StringBuilder();
@@ -2332,9 +2336,9 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
disabled = getGame() != null && !trig.requirementsCheck(getGame());
}
String trigStr = trig.replaceAbilityText(trig.toString(), state);
if (disabled) sb.append(grayTag);
if (disabled && useGrayTag) sb.append(grayTag);
sb.append(trigStr.replaceAll("\\\\r\\\\n", "\r\n"));
if (disabled) sb.append(endTag);
if (disabled && useGrayTag) sb.append(endTag);
sb.append(linebreak);
}
}
@@ -2348,9 +2352,9 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
final String stAbD = stAb.toString();
if (!stAbD.equals("")) {
boolean disabled = getGame() != null && getController() != null && game.getAge() != GameStage.Play && !stAb.checkConditions();
if (disabled) sb.append(grayTag);
if (disabled && useGrayTag) sb.append(grayTag);
sb.append(stAbD);
if (disabled) sb.append(endTag);
if (disabled && useGrayTag) sb.append(endTag);
sb.append(linebreak);
}
}
@@ -2451,9 +2455,9 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
// Class second part is a static ability that grants the other abilities
for (final StaticAbility st : state.getStaticAbilities()) {
if (st.isClassLevelNAbility(level) && !st.isSecondary()) {
if (disabled) sb.append(grayTag);
if (disabled && useGrayTag) sb.append(grayTag);
sb.append(st.toString());
if (disabled) sb.append(endTag);
if (disabled && useGrayTag) sb.append(endTag);
sb.append(linebreak);
}
}

View File

@@ -157,6 +157,7 @@ public enum CSubmenuPreferences implements ICDoc {
lstControls.add(Pair.of(view.getCbManaLostPrompt(), FPref.UI_MANA_LOST_PROMPT));
lstControls.add(Pair.of(view.getCbEscapeEndsTurn(), FPref.UI_ALLOW_ESC_TO_END_TURN));
lstControls.add(Pair.of(view.getCbDetailedPaymentDesc(), FPref.UI_DETAILED_SPELLDESC_IN_PROMPT));
lstControls.add(Pair.of(view.getCbGrayText(), FPref.UI_GRAY_INACTIVE_TEXT));
lstControls.add(Pair.of(view.getCbPreselectPrevAbOrder(), FPref.UI_PRESELECT_PREVIOUS_ABILITY_ORDER));
lstControls.add(Pair.of(view.getCbShowStormCount(), FPref.UI_SHOW_STORM_COUNT_IN_PROMPT));
lstControls.add(Pair.of(view.getCbRemindOnPriority(), FPref.UI_REMIND_ON_PRIORITY));

View File

@@ -96,6 +96,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private final JCheckBox cbTimedTargOverlay = new OptionsCheckBox(localizer.getMessage("cbTimedTargOverlay"));
private final JCheckBox cbCompactMainMenu = new OptionsCheckBox(localizer.getMessage("cbCompactMainMenu"));
private final JCheckBox cbDetailedPaymentDesc = new OptionsCheckBox(localizer.getMessage("cbDetailedPaymentDesc"));
private final JCheckBox cbGrayText = new OptionsCheckBox(localizer.getMessage("cbGrayText"));
private final JCheckBox cbPromptFreeBlocks = new OptionsCheckBox(localizer.getMessage("cbPromptFreeBlocks"));
private final JCheckBox cbPauseWhileMinimized = new OptionsCheckBox(localizer.getMessage("cbPauseWhileMinimized"));
private final JCheckBox cbCompactPrompt = new OptionsCheckBox(localizer.getMessage("cbCompactPrompt"));
@@ -247,6 +248,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.add(cbDetailedPaymentDesc, titleConstraints);
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlDetailedPaymentDesc")), descriptionConstraints);
pnlPrefs.add(cbGrayText, titleConstraints);
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlGrayText")), descriptionConstraints);
pnlPrefs.add(cbShowStormCount, titleConstraints);
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlShowStormCount")), descriptionConstraints);
@@ -901,6 +905,10 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
return cbDetailedPaymentDesc;
}
public final JCheckBox getCbGrayText() {
return cbGrayText;
}
public final JCheckBox getCbShowStormCount() {
return cbShowStormCount;
}

View File

@@ -73,6 +73,7 @@ public class GameWrapper {
rules.setPlayForAnte(FModel.getPreferences().getPrefBoolean(FPref.UI_ANTE));
rules.setMatchAnteRarity(FModel.getPreferences().getPrefBoolean(FPref.UI_ANTE_MATCH_RARITY));
rules.setManaBurn(FModel.getPreferences().getPrefBoolean(FPref.UI_MANABURN));
rules.setUseGrayText(FModel.getPreferences().getPrefBoolean(FPref.UI_GRAY_INACTIVE_TEXT));
Match match = new Match(rules, registeredPlayers, "Test");
game = match.createGame();

View File

@@ -211,6 +211,10 @@ public class SettingsPage extends TabPage<SettingsScreen> {
localizer.getMessage("cbDetailedPaymentDesc"),
localizer.getMessage("nlDetailedPaymentDesc")),
1);
lstSettings.addItem(new BooleanSetting(FPref.UI_GRAY_INACTIVE_TEXT,
localizer.getMessage("cbGrayText"),
localizer.getMessage("nlGrayText")),
1);
lstSettings.addItem(new BooleanSetting(FPref.UI_SHOW_STORM_COUNT_IN_PROMPT,
localizer.getMessage("cbShowStormCount"),
localizer.getMessage("nlShowStormCount")),

View File

@@ -91,6 +91,7 @@ cbUiForTouchScreen=Verbessere Oberfläche für Touchscreens
cbTimedTargOverlay=Aktiviere Zielpfeiloptimierung
cbCompactMainMenu=Nutze kompakteres Seitenmenü
cbDetailedPaymentDesc=Spruchbeschreibung in Bestätigungsfenster
cbGrayText=Gray out unmet conditions in card text
cbPromptFreeBlocks=Freies Block-Management
cbPauseWhileMinimized=Pausiere wenn minimiert
cbCompactPrompt=Kompaktes Bestätigungsfenster
@@ -156,6 +157,7 @@ nlPromptFreeBlocks=Wenn ein neuer Block nichts kosten würde, dann wird er autom
nlPauseWhileMinimized=Wenn aktiviert, pausiert Forge im minimierten Zustand (betrifft hauptsächlich KI gegen KI).
nlEscapeEndsTurn=Wenn aktiviert, funktioniert ESCape als Alternative um den Zug zu beenden.
nlDetailedPaymentDesc=Wenn aktiviert, werden detaillierte Spruch-/Fähigkeitsbeschreibungen beim Auswählen von Zielen bzw. Bezahlen von Kosten angezeigt.
nlGrayText=When enabled, ability text with unmet conditions will be grayed out in card detail panes.
nlShowStormCount=Wenn aktiviert, wird ein Sturmzähler angezeigt.
nlRemindOnPriority=Wenn aktiviert, dann blinkt der Auswahlbereich des Spielers bei Erhalt der Priorität.
nlPreselectPrevAbOrder=Wenn aktiviert, wird die letzte genutzte Reihenfolge von Fähigkeiten im Auswahlfenster vorbelegt.

View File

@@ -92,6 +92,7 @@ cbUiForTouchScreen=Enhance UI for Touchscreens
cbTimedTargOverlay=Enable Targeting Overlay Optimization
cbCompactMainMenu=Use Compact Main Sidebar Menu
cbDetailedPaymentDesc=Spell Description in Payment Prompt
cbGrayText=Gray out unmet conditions in card text
cbPromptFreeBlocks=Free Block Handling
cbPauseWhileMinimized=Pause While Minimized
cbCompactPrompt=Compact Prompt
@@ -157,6 +158,7 @@ nlPromptFreeBlocks=When enabled, if you would have to pay 0 to block, pay automa
nlPauseWhileMinimized=When enabled, Forge pauses when minimized (primarily for AI vs AI).
nlEscapeEndsTurn=When enabled, Escape key functions as an alternative shortcut to end the current turn.
nlDetailedPaymentDesc=When enabled, detailed spell/ability descriptions are shown when choosing targets and paying costs.
nlGrayText=When enabled, ability text with unmet conditions will be grayed out in card detail panes.
nlShowStormCount=When enabled, displays the current storm count in the prompt pane.
nlRemindOnPriority=When enabled, flashes the player choice area upon receiving priority.
nlPreselectPrevAbOrder=When enabled, preselects the last defined simultaneous ability order in the ordering dialog.

View File

@@ -92,6 +92,7 @@ cbUiForTouchScreen=Mejorar la interfaz de usuario para pantallas táctiles
cbTimedTargOverlay=Habilitar optimización de superposición de capas
cbCompactMainMenu=Usar el menú de la barra lateral principal compacta
cbDetailedPaymentDesc=Descripción del hechizo en el aviso del pago
cbGrayText=Gray out unmet conditions in card text
cbPromptFreeBlocks=Manejar bloqueos en el combate sí no requieren coste
cbPauseWhileMinimized=Pausa mientras minimizado
cbCompactPrompt=Ventana de aviso compacta
@@ -157,6 +158,7 @@ nlPromptFreeBlocks=Cuando está habilitado, si tuvieses que pagar 0 para bloquea
nlPauseWhileMinimized=Cuando está habilitado, Forge hace una pausa cuando está minimizado (principalmente para IA contra IA).
nlEscapeEndsTurn=Cuando está habilitada, la tecla Escape funciona como un atajo alternativo para finalizar el turno actual.
nlDetailedPaymentDesc=Cuando está habilitado, se muestran descripciones detalladas de hechizos / habilidades al elegir objetivos y pagar costos.
nlGrayText=When enabled, ability text with unmet conditions will be grayed out in card detail panes.
nlShowStormCount=Cuando está habilitado, muestra el recuento de tormentas actual en el panel de solicitud.
nlRemindOnPriority=Cuando está habilitado, parpadea el área de elección del jugador al recibir prioridad.
nlPreselectPrevAbOrder=Cuando está habilitado, preselecciona el último orden de habilidad simultáneo definido en el cuadro de diálogo de ordenación.

View File

@@ -91,6 +91,7 @@ cbUiForTouchScreen=Migliora l''interfaccia utente per i touchscreen
cbTimedTargOverlay=Abilita l''ottimizzazione delle sovraimperssioni per scegliere un bersaglio
cbCompactMainMenu=Usa la barra principale del menu compatta
cbDetailedPaymentDesc=Descrizione della magia nella richiesta di pagamento
cbGrayText=Gray out unmet conditions in card text
cbPromptFreeBlocks=Gestione libera dei blocchi
cbPauseWhileMinimized=Pausa se ridotto a icona
cbCompactPrompt=Riquadro messaggi compatto
@@ -156,6 +157,7 @@ nlPromptFreeBlocks=Se abilitato, quando è richiesto un pagamento di 0 per blocc
nlPauseWhileMinimized=Se abilitato, mette in pausa Forge quando è ridotto a icona (principalmente per IA vs IA).
nlEscapeEndsTurn=Se abilitato, il tasto Esc funziona come scorciatoia alternativa per terminare il turno in corso.
nlDetailedPaymentDesc=Se abilitato, vengono visualizzate descrizioni dettagliate di magie/abilità quando si scelgono bersagli e si pagano i costi.
nlGrayText=When enabled, ability text with unmet conditions will be grayed out in card detail panes.
nlShowStormCount=Se abilitato, visualizza il numero di magie lanciate nel riquadro messaggi.
nlRemindOnPriority=Se abilitato, lampeggia l''area di scelta del giocatore alla ricezione della priorità.
nlPreselectPrevAbOrder=Se abilitato, preseleziona l''ultimo ordine di abilità simultaneo definito nella finestra di dialogo degli ordini.

View File

@@ -92,6 +92,7 @@ cbUiForTouchScreen=タッチスクリーン向けに UI を強化
cbTimedTargOverlay=ターゲティングオーバーレイ最適化を有効にする
cbCompactMainMenu=コンパクトメインサイドバーメニューを使用
cbDetailedPaymentDesc=支払いプロンプトでもスペル説明を表示する
cbGrayText=Gray out unmet conditions in card text
cbPromptFreeBlocks=ブロック自動処理
cbPauseWhileMinimized=最小化中の一時停止
cbCompactPrompt=コンパクトプロンプト
@@ -157,6 +158,7 @@ nlPromptFreeBlocks=有効にすると、ブロックするために0を支払う
nlPauseWhileMinimized=有効にすると、Forge は最小化すると一時停止します(主に AI 対 AI
nlEscapeEndsTurn=有効にすると、エスケープキーは現在のターンを終了するための代替ショートカットとして機能します。
nlDetailedPaymentDesc=有効にすると、ターゲットを選択してコストを支払うときに、呪文/能力の詳細な説明が表示されます。
nlGrayText=When enabled, ability text with unmet conditions will be grayed out in card detail panes.
nlShowStormCount=有効にすると、現在のストームカウントがプロンプトパネルに表示されます。
nlRemindOnPriority=有効にすると、優先権が渡るプレーヤーの選択エリアをフラッシュします。
nlPreselectPrevAbOrder=有効にすると、順序付けダイアログで最後に選択した同時能力の順序が事前に選択されます。

View File

@@ -92,6 +92,7 @@ cbSROptimize=为屏幕阅读器启用UI优化
cbTimedTargOverlay=启用定位叠加优化
cbCompactMainMenu=使用紧凑的主侧边栏菜单
cbDetailedPaymentDesc=在付费提示中详细描述咒语
cbGrayText=Gray out unmet conditions in card text
cbPromptFreeBlocks=不阻塞处理
cbPauseWhileMinimized=暂停时最小化
cbCompactPrompt=紧凑型提示
@@ -157,6 +158,7 @@ nlPromptFreeBlocks=启用后如果你需要支付0来阻挡则不会提示自
nlPauseWhileMinimized=启用后Forge将在暂停时最小化主要用于AI VS AI
nlEscapeEndsTurn=启用后,空格键可以用于结束当前回合的替代按键。
nlDetailedPaymentDesc=启用后,选择目标和支付费用的时候会显示详细的咒语/异能说明。
nlGrayText=When enabled, ability text with unmet conditions will be grayed out in card detail panes.
nlShowStormCount=启用后,提示窗格将会显示当前的风暴计数
nlRemindOnPriority=启用后,获得优先权时玩家区域将闪烁。
nlPreselectPrevAbOrder=启用后,将预先将异能排序。

View File

@@ -88,6 +88,7 @@ public class HostedMatch {
gameRules.setManaBurn(FModel.getPreferences().getPrefBoolean(FPref.UI_MANABURN));
gameRules.setSideboardForAI(FModel.getPreferences().getPrefBoolean(FPref.MATCH_SIDEBOARD_FOR_AI));
gameRules.setCanCloneUseTargetsImage(FModel.getPreferences().getPrefBoolean(FPref.UI_CLONE_MODE_SOURCE));
gameRules.setUseGrayText(FModel.getPreferences().getPrefBoolean(FPref.UI_GRAY_INACTIVE_TEXT));
return gameRules;
}

View File

@@ -251,6 +251,7 @@ public class QuestDraftUtils {
rules.setGamesPerMatch(3);
rules.setManaBurn(FModel.getPreferences().getPrefBoolean(FPref.UI_MANABURN));
rules.setCanCloneUseTargetsImage(FModel.getPreferences().getPrefBoolean(FPref.UI_CLONE_MODE_SOURCE));
rules.setUseGrayText(FModel.getPreferences().getPrefBoolean(FPref.UI_GRAY_INACTIVE_TEXT));
return rules;
}

View File

@@ -598,6 +598,7 @@ public class QuestUtil {
rules.setGamesPerMatch(qData.getMatchLength());
rules.setManaBurn(FModel.getPreferences().getPrefBoolean(FPref.UI_MANABURN));
rules.setCanCloneUseTargetsImage(FModel.getPreferences().getPrefBoolean(FPref.UI_CLONE_MODE_SOURCE));
rules.setUseGrayText(FModel.getPreferences().getPrefBoolean(FPref.UI_GRAY_INACTIVE_TEXT));
final TreeSet<GameType> variant = new TreeSet<>();
if(FModel.getQuest().getDeckConstructionRules() == DeckConstructionRules.Commander){

View File

@@ -102,6 +102,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
UI_COMPACT_LIST_ITEMS ("false"),
UI_SMALL_DECK_VIEWER ("false"),
UI_DETAILED_SPELLDESC_IN_PROMPT ("true"),
UI_GRAY_INACTIVE_TEXT ("true"),
UI_CARD_SIZE ("small"),
UI_SINGLE_CARD_ZOOM("false"),
UI_LIBGDX_TEXTURE_FILTERING("true"),