mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-27 09:16:03 +00:00
Merge pull request #67 from AsdarDevelops/disabled-button
add an optional disabled button label
This commit is contained in:
commit
30daba0df5
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user