[UI/UX] Default cursor to no when stop trying to teach move

https://github.com/pagefaultgames/pokerogue/pull/5924

* [UI/UX] "Stop trying to teach move" Defaulting to "No"

* [Test] setCursor to 0, 'Yes' to end learning move

* Move confirmUIMode to its own file in enums, add docs

---------

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
This commit is contained in:
Dobin Shin 2025-06-12 08:24:27 +09:00 committed by GitHub
parent f499ea0568
commit ba2158ec64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,13 @@
// biome-ignore lint/correctness/noUnusedImports: Used in tsdoc
import type ConfirmUiHandler from "#app/ui/confirm-ui-handler";
/**
* Used by {@linkcode ConfirmUiHandler} to determine whether the cursor should start on Yes or No
*/
export const ConfirmUiMode = Object.freeze({
/** Start cursor on Yes */
DEFAULT_YES: 1,
/** Start cursor on No */
DEFAULT_NO: 2
});
export type ConfirmUiMode = typeof ConfirmUiMode[keyof typeof ConfirmUiMode];

View File

@ -12,6 +12,7 @@ import { UiMode } from "#enums/ui-mode";
import i18next from "i18next";
import { PlayerPartyMemberPokemonPhase } from "#app/phases/player-party-member-pokemon-phase";
import type Pokemon from "#app/field/pokemon";
import { ConfirmUiMode } from "#enums/confirm-ui-mode";
import { LearnMoveType } from "#enums/learn-move-type";
export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
@ -163,6 +164,10 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
globalScene.ui.setMode(this.messageMode);
this.replaceMoveCheck(move, pokemon);
},
false,
0,
0,
ConfirmUiMode.DEFAULT_NO,
);
}

View File

@ -4,8 +4,11 @@ import { UiMode } from "#enums/ui-mode";
import i18next from "i18next";
import { Button } from "#enums/buttons";
import { globalScene } from "#app/global-scene";
import { ConfirmUiMode } from "#enums/confirm-ui-mode";
export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
private confirmUiMode: ConfirmUiMode;
public static readonly windowWidth: number = 48;
private switchCheck: boolean;
@ -105,7 +108,16 @@ export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
this.optionSelectContainer.setPosition(globalScene.game.canvas.width / 6 - 1 + xOffset, -48 + yOffset);
this.confirmUiMode = args.length >= 6 ? (args[5] as ConfirmUiMode) : ConfirmUiMode.DEFAULT_YES;
switch (this.confirmUiMode) {
case ConfirmUiMode.DEFAULT_YES:
this.setCursor(this.switchCheck ? this.switchCheckCursor : 0);
break;
case ConfirmUiMode.DEFAULT_NO:
this.setCursor(this.switchCheck ? this.switchCheckCursor : 1);
break;
}
return true;
}

View File

@ -92,6 +92,10 @@ describe("Learn Move Phase", () => {
game.onNextPrompt("LearnMovePhase", UiMode.CONFIRM, () => {
game.scene.ui.processInput(Button.ACTION);
});
game.onNextPrompt("LearnMovePhase", UiMode.CONFIRM, () => {
game.scene.ui.setCursor(0);
game.scene.ui.processInput(Button.ACTION);
});
await game.phaseInterceptor.to(LearnMovePhase);
const levelReq = bulbasaur.getLevelMoves(5)[0][0];