From 4097d49adce37bc878814586c1f92589d83d31f2 Mon Sep 17 00:00:00 2001 From: ImperialSympathizer Date: Fri, 12 Jul 2024 17:36:59 -0400 Subject: [PATCH] add an optional disabled button label --- .../encounters/sleeping-snorlax-encounter.ts | 2 +- .../mystery-encounters/mystery-encounter-dialogue.ts | 3 ++- src/ui/mystery-encounter-ui-handler.ts | 9 +++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/data/mystery-encounters/encounters/sleeping-snorlax-encounter.ts b/src/data/mystery-encounters/encounters/sleeping-snorlax-encounter.ts index d26bacf7c5c..e0f4d2406e8 100644 --- a/src/data/mystery-encounters/encounters/sleeping-snorlax-encounter.ts +++ b/src/data/mystery-encounters/encounters/sleeping-snorlax-encounter.ts @@ -145,7 +145,7 @@ export const SleepingSnorlaxEncounter: IMysteryEncounter = .withDialogue({ buttonLabel: `${namespace}_option_3_label`, buttonTooltip: `${namespace}_option_3_tooltip`, - disabledTooltip: `${namespace}_option_3_disabled_tooltip`, + disabledButtonTooltip: `${namespace}_option_3_disabled_tooltip`, }) .withOptionPhase(async (scene: BattleScene) => { // Steal the Snorlax's Leftovers diff --git a/src/data/mystery-encounters/mystery-encounter-dialogue.ts b/src/data/mystery-encounters/mystery-encounter-dialogue.ts index 3832aaa7cd3..cbf939744c4 100644 --- a/src/data/mystery-encounters/mystery-encounter-dialogue.ts +++ b/src/data/mystery-encounters/mystery-encounter-dialogue.ts @@ -9,7 +9,8 @@ export class TextDisplay { export class OptionTextDisplay { buttonLabel: string; buttonTooltip?: string; - disabledTooltip?: string; + disabledButtonLabel?: string; + disabledButtonTooltip?: string; secondOptionPrompt?: string; selected?: TextDisplay[]; style?: TextStyle; diff --git a/src/ui/mystery-encounter-ui-handler.ts b/src/ui/mystery-encounter-ui-handler.ts index 2d35e98c772..e9ee0f1f6e7 100644 --- a/src/ui/mystery-encounter-ui-handler.ts +++ b/src/ui/mystery-encounter-ui-handler.ts @@ -325,12 +325,13 @@ export default class MysteryEncounterUiHandler extends UiHandler { this.optionsMeetsReqs.push(option.meetsRequirements(this.scene)); const optionDialogue = option.dialogue; + const label = !this.optionsMeetsReqs[i] && optionDialogue.disabledButtonLabel ? optionDialogue.disabledButtonLabel : optionDialogue.buttonLabel; let text: string; if (option.hasRequirements() && this.optionsMeetsReqs[i] && (option.optionMode === EncounterOptionMode.DEFAULT_OR_SPECIAL || option.optionMode === EncounterOptionMode.DISABLED_OR_SPECIAL)) { // Options with special requirements that are met are automatically colored green - text = getEncounterText(this.scene, optionDialogue.buttonLabel, TextStyle.SUMMARY_GREEN); + text = getEncounterText(this.scene, label, TextStyle.SUMMARY_GREEN); } else { - text = getEncounterText(this.scene, optionDialogue.buttonLabel, optionDialogue.style ? optionDialogue.style : TextStyle.WINDOW); + text = getEncounterText(this.scene, label, optionDialogue.style ? optionDialogue.style : TextStyle.WINDOW); } if (text) { @@ -425,8 +426,8 @@ export default class MysteryEncounterUiHandler extends UiHandler { let text: string; const cursorOption = this.filteredEncounterOptions[cursor]; const optionDialogue = cursorOption.dialogue; - if (!this.optionsMeetsReqs[cursor] && (cursorOption.optionMode === EncounterOptionMode.DISABLED_OR_DEFAULT || cursorOption.optionMode === EncounterOptionMode.DISABLED_OR_SPECIAL) && optionDialogue.disabledTooltip) { - text = getEncounterText(this.scene, optionDialogue.disabledTooltip, TextStyle.TOOLTIP_CONTENT); + if (!this.optionsMeetsReqs[cursor] && (cursorOption.optionMode === EncounterOptionMode.DISABLED_OR_DEFAULT || cursorOption.optionMode === EncounterOptionMode.DISABLED_OR_SPECIAL) && optionDialogue.disabledButtonTooltip) { + text = getEncounterText(this.scene, optionDialogue.disabledButtonTooltip, TextStyle.TOOLTIP_CONTENT); } else { text = getEncounterText(this.scene, optionDialogue.buttonTooltip, TextStyle.TOOLTIP_CONTENT); }