mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-19 14:52:19 +02:00
Updated as per comments and made arrows tint when start select cursor is visible
This commit is contained in:
parent
0646446009
commit
949f6fe9df
@ -172,7 +172,7 @@ export abstract class Challenge {
|
||||
* @param overrideValue {@link integer} The value to check for. If undefined, gets the current value.
|
||||
* @returns {@link string} The localised name for the current value.
|
||||
*/
|
||||
getValue(overrideValue?: integer): string {
|
||||
getValue(overrideValue?: number): string {
|
||||
const value = overrideValue ?? this.value;
|
||||
return i18next.t(`challenges:${this.geti18nKey()}.value.${value}`);
|
||||
}
|
||||
@ -182,7 +182,7 @@ export abstract class Challenge {
|
||||
* @param overrideValue {@link integer} The value to check for. If undefined, gets the current value.
|
||||
* @returns {@link string} The localised description for the current value.
|
||||
*/
|
||||
getDescription(overrideValue?: integer): string {
|
||||
getDescription(overrideValue?: number): string {
|
||||
const value = overrideValue ?? this.value;
|
||||
return `${i18next.t([`challenges:${this.geti18nKey()}.desc.${value}`, `challenges:${this.geti18nKey()}.desc`])}`;
|
||||
}
|
||||
@ -483,7 +483,7 @@ export class SingleGenerationChallenge extends Challenge {
|
||||
* @param {value} overrideValue The value to check for. If undefined, gets the current value.
|
||||
* @returns {string} The localised name for the current value.
|
||||
*/
|
||||
getValue(overrideValue?: integer): string {
|
||||
getValue(overrideValue?: number): string {
|
||||
const value = overrideValue ?? this.value;
|
||||
if (value === 0) {
|
||||
return i18next.t("settings:off");
|
||||
@ -496,7 +496,7 @@ export class SingleGenerationChallenge extends Challenge {
|
||||
* @param {value} overrideValue The value to check for. If undefined, gets the current value.
|
||||
* @returns {string} The localised description for the current value.
|
||||
*/
|
||||
getDescription(overrideValue?: integer): string {
|
||||
getDescription(overrideValue?: number): string {
|
||||
const value = overrideValue ?? this.value;
|
||||
if (value === 0) {
|
||||
return i18next.t("challenges:singleGeneration.desc_default");
|
||||
|
@ -158,7 +158,6 @@ export default class GameChallengesUiHandler extends UiHandler {
|
||||
|
||||
const value = addTextObject(this.scene, 0, 28 + i * 16, "", TextStyle.SETTINGS_LABEL);
|
||||
value.setName(`challenge-value-text-${i}`);
|
||||
//value.setX((rightArrow.x - (leftArrow.x + leftArrow.width)) / 2);
|
||||
value.setPositionRelative(label, 100, 0);
|
||||
this.valuesContainer.add(value);
|
||||
|
||||
@ -302,6 +301,7 @@ export default class GameChallengesUiHandler extends UiHandler {
|
||||
super.show(args);
|
||||
|
||||
this.startCursor.setVisible(false);
|
||||
this.updateChallengeArrows(false);
|
||||
this.challengesContainer.setVisible(true);
|
||||
// Should always be false at the start
|
||||
this.hasSelectedChallenge = this.scene.gameMode.challenges.some(c => c.value !== 0);
|
||||
@ -317,6 +317,21 @@ export default class GameChallengesUiHandler extends UiHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* This code updates the challenge starter arrows to be tinted/not tinted when the start button is selected to show they can't be changed
|
||||
*/
|
||||
updateChallengeArrows(tinted: boolean) {
|
||||
for (let i = 0; i < Math.min(9, this.scene.gameMode.challenges.length); i++) {
|
||||
const challengeLabel = this.challengeLabels[i];
|
||||
if (tinted) {
|
||||
challengeLabel.leftArrow.setTint(0x808080);
|
||||
challengeLabel.rightArrow.setTint(0x808080);
|
||||
} else {
|
||||
challengeLabel.leftArrow.clearTint();
|
||||
challengeLabel.rightArrow.clearTint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes input from a specified button.
|
||||
* This method handles navigation through a UI menu, including movement through menu items
|
||||
@ -338,6 +353,7 @@ export default class GameChallengesUiHandler extends UiHandler {
|
||||
// If the user presses cancel when the start cursor has been activated, the game deactivates the start cursor and allows typical challenge selection behavior
|
||||
this.startCursor.setVisible(false);
|
||||
this.cursorObj?.setVisible(true);
|
||||
this.updateChallengeArrows(this.startCursor.visible);
|
||||
} else {
|
||||
this.scene.clearPhaseQueue();
|
||||
this.scene.pushPhase(new TitlePhase(this.scene));
|
||||
@ -352,6 +368,7 @@ export default class GameChallengesUiHandler extends UiHandler {
|
||||
} else {
|
||||
this.startCursor.setVisible(true);
|
||||
this.cursorObj?.setVisible(false);
|
||||
this.updateChallengeArrows(this.startCursor.visible);
|
||||
}
|
||||
success = true;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user