mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 15:32:18 +02:00
Move confirmUIMode to its own file in enums, add docs
This commit is contained in:
parent
d88e7a2cfc
commit
cb06c9d0a1
13
src/enums/confirm-ui-mode.ts
Normal file
13
src/enums/confirm-ui-mode.ts
Normal 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];
|
@ -13,7 +13,7 @@ import i18next from "i18next";
|
|||||||
import { PlayerPartyMemberPokemonPhase } from "#app/phases/player-party-member-pokemon-phase";
|
import { PlayerPartyMemberPokemonPhase } from "#app/phases/player-party-member-pokemon-phase";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
||||||
import { ConfirmUiMode } from "#app/ui/confirm-ui-handler";
|
import { ConfirmUiMode } from "#enums/confirm-ui-mode";
|
||||||
|
|
||||||
export enum LearnMoveType {
|
export enum LearnMoveType {
|
||||||
/** For learning a move via level-up, evolution, or other non-item-based event */
|
/** For learning a move via level-up, evolution, or other non-item-based event */
|
||||||
@ -175,7 +175,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||||||
false,
|
false,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
ConfirmUiMode.REJECT_MOVE,
|
ConfirmUiMode.DEFAULT_NO,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,11 +4,7 @@ import { UiMode } from "#enums/ui-mode";
|
|||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { Button } from "#enums/buttons";
|
import { Button } from "#enums/buttons";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
|
import { ConfirmUiMode } from "#enums/confirm-ui-mode";
|
||||||
export enum ConfirmUiMode {
|
|
||||||
DEFAULT,
|
|
||||||
REJECT_MOVE,
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
|
export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
|
||||||
private confirmUiMode: ConfirmUiMode;
|
private confirmUiMode: ConfirmUiMode;
|
||||||
@ -112,13 +108,13 @@ export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
|
|||||||
|
|
||||||
this.optionSelectContainer.setPosition(globalScene.game.canvas.width / 6 - 1 + xOffset, -48 + yOffset);
|
this.optionSelectContainer.setPosition(globalScene.game.canvas.width / 6 - 1 + xOffset, -48 + yOffset);
|
||||||
|
|
||||||
this.confirmUiMode = args.length >= 6 ? (args[5] as ConfirmUiMode) : ConfirmUiMode.DEFAULT;
|
this.confirmUiMode = args.length >= 6 ? (args[5] as ConfirmUiMode) : ConfirmUiMode.DEFAULT_YES;
|
||||||
|
|
||||||
switch (this.confirmUiMode) {
|
switch (this.confirmUiMode) {
|
||||||
case ConfirmUiMode.DEFAULT:
|
case ConfirmUiMode.DEFAULT_YES:
|
||||||
this.setCursor(this.switchCheck ? this.switchCheckCursor : 0);
|
this.setCursor(this.switchCheck ? this.switchCheckCursor : 0);
|
||||||
break;
|
break;
|
||||||
case ConfirmUiMode.REJECT_MOVE:
|
case ConfirmUiMode.DEFAULT_NO:
|
||||||
this.setCursor(this.switchCheck ? this.switchCheckCursor : 1);
|
this.setCursor(this.switchCheck ? this.switchCheckCursor : 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user