mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-21 15:52:18 +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.
|
* @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.
|
* @returns {@link string} The localised name for the current value.
|
||||||
*/
|
*/
|
||||||
getValue(overrideValue?: integer): string {
|
getValue(overrideValue?: number): string {
|
||||||
const value = overrideValue ?? this.value;
|
const value = overrideValue ?? this.value;
|
||||||
return i18next.t(`challenges:${this.geti18nKey()}.value.${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.
|
* @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.
|
* @returns {@link string} The localised description for the current value.
|
||||||
*/
|
*/
|
||||||
getDescription(overrideValue?: integer): string {
|
getDescription(overrideValue?: number): string {
|
||||||
const value = overrideValue ?? this.value;
|
const value = overrideValue ?? this.value;
|
||||||
return `${i18next.t([`challenges:${this.geti18nKey()}.desc.${value}`, `challenges:${this.geti18nKey()}.desc`])}`;
|
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.
|
* @param {value} overrideValue The value to check for. If undefined, gets the current value.
|
||||||
* @returns {string} The localised name for 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;
|
const value = overrideValue ?? this.value;
|
||||||
if (value === 0) {
|
if (value === 0) {
|
||||||
return i18next.t("settings:off");
|
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.
|
* @param {value} overrideValue The value to check for. If undefined, gets the current value.
|
||||||
* @returns {string} The localised description for 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;
|
const value = overrideValue ?? this.value;
|
||||||
if (value === 0) {
|
if (value === 0) {
|
||||||
return i18next.t("challenges:singleGeneration.desc_default");
|
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);
|
const value = addTextObject(this.scene, 0, 28 + i * 16, "", TextStyle.SETTINGS_LABEL);
|
||||||
value.setName(`challenge-value-text-${i}`);
|
value.setName(`challenge-value-text-${i}`);
|
||||||
//value.setX((rightArrow.x - (leftArrow.x + leftArrow.width)) / 2);
|
|
||||||
value.setPositionRelative(label, 100, 0);
|
value.setPositionRelative(label, 100, 0);
|
||||||
this.valuesContainer.add(value);
|
this.valuesContainer.add(value);
|
||||||
|
|
||||||
@ -302,6 +301,7 @@ export default class GameChallengesUiHandler extends UiHandler {
|
|||||||
super.show(args);
|
super.show(args);
|
||||||
|
|
||||||
this.startCursor.setVisible(false);
|
this.startCursor.setVisible(false);
|
||||||
|
this.updateChallengeArrows(false);
|
||||||
this.challengesContainer.setVisible(true);
|
this.challengesContainer.setVisible(true);
|
||||||
// Should always be false at the start
|
// Should always be false at the start
|
||||||
this.hasSelectedChallenge = this.scene.gameMode.challenges.some(c => c.value !== 0);
|
this.hasSelectedChallenge = this.scene.gameMode.challenges.some(c => c.value !== 0);
|
||||||
@ -317,6 +317,21 @@ export default class GameChallengesUiHandler extends UiHandler {
|
|||||||
return true;
|
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.
|
* Processes input from a specified button.
|
||||||
* This method handles navigation through a UI menu, including movement through menu items
|
* 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
|
// 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.startCursor.setVisible(false);
|
||||||
this.cursorObj?.setVisible(true);
|
this.cursorObj?.setVisible(true);
|
||||||
|
this.updateChallengeArrows(this.startCursor.visible);
|
||||||
} else {
|
} else {
|
||||||
this.scene.clearPhaseQueue();
|
this.scene.clearPhaseQueue();
|
||||||
this.scene.pushPhase(new TitlePhase(this.scene));
|
this.scene.pushPhase(new TitlePhase(this.scene));
|
||||||
@ -352,6 +368,7 @@ export default class GameChallengesUiHandler extends UiHandler {
|
|||||||
} else {
|
} else {
|
||||||
this.startCursor.setVisible(true);
|
this.startCursor.setVisible(true);
|
||||||
this.cursorObj?.setVisible(false);
|
this.cursorObj?.setVisible(false);
|
||||||
|
this.updateChallengeArrows(this.startCursor.visible);
|
||||||
}
|
}
|
||||||
success = true;
|
success = true;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user