mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-24 07:23:24 +02:00
- Add comments to describe what the function does
- Add comments to describe what the function does
This commit is contained in:
parent
85374f5c1d
commit
2c7bca7e3b
@ -92,8 +92,16 @@ export function getIconWithSettingName(config, settingName) {
|
|||||||
return getIconWithKey(config, key);
|
return getIconWithKey(config, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve key from input keys eg: return "R" from "KEY_R"
|
||||||
|
* @param configs
|
||||||
|
* @param source Source of last input type. Eg: "gamepad"
|
||||||
|
* @param devices List of all devices.
|
||||||
|
* @param settingName Action for the input key.
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
export function getKeyForLatestInput(configs, source, devices, settingName) {
|
export function getKeyForLatestInput(configs, source, devices, settingName) {
|
||||||
let config: any; // TODO: refine type
|
let config: any;
|
||||||
if (source === "gamepad") {
|
if (source === "gamepad") {
|
||||||
config = configs[devices[Device.GAMEPAD]];
|
config = configs[devices[Device.GAMEPAD]];
|
||||||
} else {
|
} else {
|
||||||
|
@ -134,6 +134,11 @@ export class UiInputs {
|
|||||||
|
|
||||||
buttonAB(button: Button): void {
|
buttonAB(button: Button): void {
|
||||||
if (this.isInSettings()) {
|
if (this.isInSettings()) {
|
||||||
|
/**
|
||||||
|
* When exiting the settings menu, this function
|
||||||
|
* will update the the UI to update the text.
|
||||||
|
* Eg: (E) Throw Poke ball -> (Shift) Throw Poke ball
|
||||||
|
*/
|
||||||
const whiteListUIModes: UiMode[] = [UiMode.MODIFIER_SELECT, UiMode.COMMAND];
|
const whiteListUIModes: UiMode[] = [UiMode.MODIFIER_SELECT, UiMode.COMMAND];
|
||||||
for (const uiMode of whiteListUIModes) {
|
for (const uiMode of whiteListUIModes) {
|
||||||
globalScene.ui.handlers[uiMode].updateTipsText();
|
globalScene.ui.handlers[uiMode].updateTipsText();
|
||||||
|
@ -240,7 +240,11 @@ export class CommandUiHandler extends UiHandler {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Button.CYCLE_SHINY: {
|
case Button.CYCLE_SHINY: {
|
||||||
// Used to throw the last pokeball
|
/**
|
||||||
|
* When the Cycle Shiny button is pressed,
|
||||||
|
* the last pokeball will be thrown.
|
||||||
|
* This can only be used in the UiMode.COMMAND.
|
||||||
|
*/
|
||||||
const commandPhase = globalScene.phaseManager.getCurrentPhase() as CommandPhase;
|
const commandPhase = globalScene.phaseManager.getCurrentPhase() as CommandPhase;
|
||||||
if (
|
if (
|
||||||
globalScene.currentBattle.battleType === BattleType.WILD
|
globalScene.currentBattle.battleType === BattleType.WILD
|
||||||
@ -255,7 +259,13 @@ export class CommandUiHandler extends UiHandler {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Button.CYCLE_ABILITY: // Used to restart the battle
|
case Button.CYCLE_ABILITY:
|
||||||
|
/**
|
||||||
|
* When the Cycle Ability button is pressed,
|
||||||
|
* the UI will request the user if they would like
|
||||||
|
* to restart the battle. This can only be used in
|
||||||
|
* the UiMode.COMMAND.
|
||||||
|
*/
|
||||||
if (!globalScene.enableRetries) {
|
if (!globalScene.enableRetries) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -376,6 +386,10 @@ export class CommandUiHandler extends UiHandler {
|
|||||||
this.cursorObj = null;
|
this.cursorObj = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To update text in the command when globalScene.enableHotkeyTips
|
||||||
|
* is turned off or when action keys are changed.
|
||||||
|
*/
|
||||||
updateTipsText(): void {
|
updateTipsText(): void {
|
||||||
const throwBallKey = globalScene.enableHotkeyTips
|
const throwBallKey = globalScene.enableHotkeyTips
|
||||||
? ""
|
? ""
|
||||||
|
@ -173,6 +173,10 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
|
|||||||
globalScene.addInfoToggle(this.moveInfoOverlay);
|
globalScene.addInfoToggle(this.moveInfoOverlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To update text in the command when globalScene.enableHotkeyTips
|
||||||
|
* is turned off or when action keys are changed.
|
||||||
|
*/
|
||||||
updateTipsText(): void {
|
updateTipsText(): void {
|
||||||
this.updateRerollText();
|
this.updateRerollText();
|
||||||
this.updateRerollCostPosition();
|
this.updateRerollCostPosition();
|
||||||
@ -541,7 +545,11 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
|
|||||||
success = this.setCursor(0);
|
success = this.setCursor(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Button.CYCLE_SHINY: // R key, by default to reroll the shop
|
case Button.CYCLE_SHINY:
|
||||||
|
/**
|
||||||
|
* When the Cycle Shiny button is pressed,
|
||||||
|
* a reroll command will be played.
|
||||||
|
*/
|
||||||
if (this.onActionInput && globalScene.money >= this.rerollCost) {
|
if (this.onActionInput && globalScene.money >= this.rerollCost) {
|
||||||
const originalOnActionInput = this.onActionInput;
|
const originalOnActionInput = this.onActionInput;
|
||||||
this.awaitingActionInput = true;
|
this.awaitingActionInput = true;
|
||||||
@ -549,7 +557,11 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
|
|||||||
originalOnActionInput(0, 0);
|
originalOnActionInput(0, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Button.CYCLE_ABILITY: // E key, by default to lock rarity
|
case Button.CYCLE_ABILITY:
|
||||||
|
/**
|
||||||
|
* When the Cycle Ability button is pressed,
|
||||||
|
* the lock rarity will be enabled/disabled.
|
||||||
|
*/
|
||||||
if (this.onActionInput && this.lockRarityButtonContainer.visible) {
|
if (this.onActionInput && this.lockRarityButtonContainer.visible) {
|
||||||
const originalOnActionInput = this.onActionInput;
|
const originalOnActionInput = this.onActionInput;
|
||||||
this.awaitingActionInput = true;
|
this.awaitingActionInput = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user