[Enhancement] Add go filter shortcut (#3345)
* update goFilter shortcut * fix filter instruction position * remove unnecessary new lines * update requested changes. add other language entries too * remove unnecessary case code * open dropdown when pressing goFilter shortcut * add missing entry for `fr` * Update src/locales/fr/starter-select-ui-handler.ts Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Update src/locales/de/starter-select-ui-handler.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * update instruction container position and text offset for more longer instruction label. decrease size of fr instruction font * fixed de info font size * Update src/locales/pt_BR/starter-select-ui-handler.ts Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Update src/locales/ko/starter-select-ui-handler.ts Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update src/locales/zh_TW/starter-select-ui-handler.ts Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com> * Update src/locales/zh_CN/starter-select-ui-handler.ts Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com> * update font size, starterInfoXPos and starterInfoYOffset in zh. update starterInfoXPos in de * Update src/locales/es/starter-select-ui-handler.ts Co-authored-by: Asdar <asdargmng@gmail.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: mercurius-00 <80205689+mercurius-00@users.noreply.github.com> Co-authored-by: Asdar <asdargmng@gmail.com>
This commit is contained in:
parent
cff5a670b1
commit
b54a255c15
|
@ -41,6 +41,7 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"cycleAbility": ": Fähigkeit",
|
||||
"cycleNature": ": Wesen",
|
||||
"cycleVariant": ": Seltenheit",
|
||||
"goFilter": ": Zu den Filtern",
|
||||
"enablePassive": "Passiv-Skill aktivieren",
|
||||
"disablePassive": "Passiv-Skill deaktivieren",
|
||||
"locked": "Gesperrt",
|
||||
|
|
|
@ -41,6 +41,7 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"cycleAbility": ": Ability",
|
||||
"cycleNature": ": Nature",
|
||||
"cycleVariant": ": Variant",
|
||||
"goFilter": ": Go to filters",
|
||||
"enablePassive": "Enable Passive",
|
||||
"disablePassive": "Disable Passive",
|
||||
"locked": "Locked",
|
||||
|
|
|
@ -41,6 +41,7 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"cycleAbility": ": Habilidad",
|
||||
"cycleNature": ": Naturaleza",
|
||||
"cycleVariant": ": Variante",
|
||||
"goFilter": ": Ir a filtros",
|
||||
"enablePassive": "Activar Pasiva",
|
||||
"disablePassive": "Desactivar Pasiva",
|
||||
"locked": "Bloqueado",
|
||||
|
|
|
@ -41,6 +41,7 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"cycleAbility": ": Talent",
|
||||
"cycleNature": ": Nature",
|
||||
"cycleVariant": ": Variant",
|
||||
"goFilter": ": Aller aux filtres",
|
||||
"enablePassive": "Activer Passif",
|
||||
"disablePassive": "Désactiver Passif",
|
||||
"locked": "Verrouillé",
|
||||
|
|
|
@ -41,6 +41,7 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"cycleAbility": ": Abilità",
|
||||
"cycleNature": ": Natura",
|
||||
"cycleVariant": ": Variante",
|
||||
"goFilter": ": Go to filters",
|
||||
"enablePassive": "Attiva passiva",
|
||||
"disablePassive": "Disattiva passiva",
|
||||
"locked": "Bloccato",
|
||||
|
|
|
@ -41,6 +41,7 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"cycleAbility": ": 특성",
|
||||
"cycleNature": ": 성격",
|
||||
"cycleVariant": ": 색상",
|
||||
"goFilter": ": 필터로 이동",
|
||||
"enablePassive": "패시브 활성화",
|
||||
"disablePassive": "패시브 비활성화",
|
||||
"locked": "잠김",
|
||||
|
|
|
@ -41,6 +41,7 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"cycleAbility": ": » Habilidade",
|
||||
"cycleNature": ": » Natureza",
|
||||
"cycleVariant": ": » Variante",
|
||||
"goFilter": ": Ir para filtros",
|
||||
"enablePassive": "Ativar Passiva",
|
||||
"disablePassive": "Desativar Passiva",
|
||||
"locked": "Bloqueada",
|
||||
|
|
|
@ -41,6 +41,7 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"cycleAbility": ": 特性",
|
||||
"cycleNature": ": 性格",
|
||||
"cycleVariant": ": 变种",
|
||||
"goFilter": ": 转到筛选",
|
||||
"enablePassive": "启用被动",
|
||||
"disablePassive": "禁用被动",
|
||||
"locked": "未解锁",
|
||||
|
|
|
@ -42,6 +42,7 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
|||
"cycleAbility": ": 特性",
|
||||
"cycleNature": ": 性格",
|
||||
"cycleVariant": ": 變種",
|
||||
"goFilter": ": 轉到篩選",
|
||||
"enablePassive": "啟用被動",
|
||||
"disablePassive": "禁用被動",
|
||||
"locked": "未解鎖",
|
||||
|
|
|
@ -79,7 +79,7 @@ export class UiInputs {
|
|||
[Button.ACTION]: () => this.buttonAb(Button.ACTION),
|
||||
[Button.CANCEL]: () => this.buttonAb(Button.CANCEL),
|
||||
[Button.MENU]: () => this.buttonMenu(),
|
||||
[Button.STATS]: () => this.buttonStats(true),
|
||||
[Button.STATS]: () => this.buttonGoToFilter(Button.STATS),
|
||||
[Button.CYCLE_SHINY]: () => this.buttonCycleOption(Button.CYCLE_SHINY),
|
||||
[Button.CYCLE_FORM]: () => this.buttonCycleOption(Button.CYCLE_FORM),
|
||||
[Button.CYCLE_GENDER]: () => this.buttonCycleOption(Button.CYCLE_GENDER),
|
||||
|
@ -139,6 +139,17 @@ export class UiInputs {
|
|||
p.toggleStats(pressed);
|
||||
}
|
||||
}
|
||||
|
||||
buttonGoToFilter(button: Button): void {
|
||||
const whitelist = [StarterSelectUiHandler];
|
||||
const uiHandler = this.scene.ui?.getHandler();
|
||||
if (whitelist.some(handler => uiHandler instanceof handler)) {
|
||||
this.scene.ui.processInput(button);
|
||||
} else {
|
||||
this.buttonStats(true);
|
||||
}
|
||||
}
|
||||
|
||||
buttonInfo(pressed: boolean = true): void {
|
||||
if (this.scene.showMovesetFlyout ) {
|
||||
for (const p of this.scene.getField().filter(p => p?.isActive(true))) {
|
||||
|
|
|
@ -70,8 +70,9 @@ const languageSettings: { [key: string]: LanguageSetting } = {
|
|||
instructionTextSize: "38px",
|
||||
},
|
||||
"de":{
|
||||
starterInfoTextSize: "56px",
|
||||
starterInfoTextSize: "48px",
|
||||
instructionTextSize: "35px",
|
||||
starterInfoXPos: 33,
|
||||
},
|
||||
"es":{
|
||||
starterInfoTextSize: "56px",
|
||||
|
@ -79,7 +80,7 @@ const languageSettings: { [key: string]: LanguageSetting } = {
|
|||
},
|
||||
"fr":{
|
||||
starterInfoTextSize: "54px",
|
||||
instructionTextSize: "42px",
|
||||
instructionTextSize: "35px",
|
||||
},
|
||||
"it":{
|
||||
starterInfoTextSize: "56px",
|
||||
|
@ -91,9 +92,10 @@ const languageSettings: { [key: string]: LanguageSetting } = {
|
|||
starterInfoXPos: 33,
|
||||
},
|
||||
"zh":{
|
||||
starterInfoTextSize: "40px",
|
||||
instructionTextSize: "42px",
|
||||
starterInfoYOffset: 2
|
||||
starterInfoTextSize: "47px",
|
||||
instructionTextSize: "38px",
|
||||
starterInfoYOffset: 1,
|
||||
starterInfoXPos: 24,
|
||||
},
|
||||
"pt":{
|
||||
starterInfoTextSize: "48px",
|
||||
|
@ -258,18 +260,21 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
private pokemonShinyIcon: Phaser.GameObjects.Sprite;
|
||||
|
||||
private instructionsContainer: Phaser.GameObjects.Container;
|
||||
private filterInstructionsContainer: Phaser.GameObjects.Container;
|
||||
private shinyIconElement: Phaser.GameObjects.Sprite;
|
||||
private formIconElement: Phaser.GameObjects.Sprite;
|
||||
private abilityIconElement: Phaser.GameObjects.Sprite;
|
||||
private genderIconElement: Phaser.GameObjects.Sprite;
|
||||
private natureIconElement: Phaser.GameObjects.Sprite;
|
||||
private variantIconElement: Phaser.GameObjects.Sprite;
|
||||
private goFilterIconElement: Phaser.GameObjects.Sprite;
|
||||
private shinyLabel: Phaser.GameObjects.Text;
|
||||
private formLabel: Phaser.GameObjects.Text;
|
||||
private genderLabel: Phaser.GameObjects.Text;
|
||||
private abilityLabel: Phaser.GameObjects.Text;
|
||||
private natureLabel: Phaser.GameObjects.Text;
|
||||
private variantLabel: Phaser.GameObjects.Text;
|
||||
private goFilterLabel: Phaser.GameObjects.Text;
|
||||
|
||||
private starterSelectMessageBox: Phaser.GameObjects.NineSlice;
|
||||
private starterSelectMessageBoxContainer: Phaser.GameObjects.Container;
|
||||
|
@ -329,7 +334,9 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
//variables to keep track of the dynamically rendered list of instruction prompts for starter select
|
||||
private instructionRowX = 0;
|
||||
private instructionRowY = 0;
|
||||
private instructionRowTextOffset = 12;
|
||||
private instructionRowTextOffset = 9;
|
||||
private filterInstructionRowX = 0;
|
||||
private filterInstructionRowY = 0;
|
||||
|
||||
private starterSelectCallback: StarterSelectCallback | null;
|
||||
|
||||
|
@ -825,8 +832,19 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
this.variantLabel = addTextObject(this.scene, this.instructionRowX + this.instructionRowTextOffset, this.instructionRowY, i18next.t("starterSelectUiHandler:cycleVariant"), TextStyle.PARTY, { fontSize: instructionTextSize });
|
||||
this.variantLabel.setName("text-variant-label");
|
||||
|
||||
this.goFilterIconElement = new Phaser.GameObjects.Sprite(this.scene, this.filterInstructionRowX, this.filterInstructionRowY, "keyboard", "C.png");
|
||||
this.goFilterIconElement.setName("sprite-goFilter-icon-element");
|
||||
this.goFilterIconElement.setScale(0.675);
|
||||
this.goFilterIconElement.setOrigin(0.0, 0.0);
|
||||
this.goFilterLabel = addTextObject(this.scene, this.filterInstructionRowX + this.instructionRowTextOffset, this.filterInstructionRowY, i18next.t("starterSelectUiHandler:goFilter"), TextStyle.PARTY, { fontSize: instructionTextSize });
|
||||
this.goFilterLabel.setName("text-goFilter-label");
|
||||
|
||||
this.hideInstructions();
|
||||
|
||||
this.filterInstructionsContainer = this.scene.add.container(50, 5);
|
||||
this.filterInstructionsContainer.setVisible(true);
|
||||
this.starterSelectContainer.add(this.filterInstructionsContainer);
|
||||
|
||||
this.starterSelectMessageBoxContainer = this.scene.add.container(0, this.scene.game.canvas.height / 6);
|
||||
this.starterSelectMessageBoxContainer.setVisible(false);
|
||||
this.starterSelectContainer.add(this.starterSelectMessageBoxContainer);
|
||||
|
@ -1175,6 +1193,16 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
this.tryExit();
|
||||
success = true;
|
||||
}
|
||||
} else if (button === Button.STATS) {
|
||||
// if stats button is pressed, go to filter directly
|
||||
if (!this.filterMode) {
|
||||
this.startCursorObj.setVisible(false);
|
||||
this.starterIconsCursorObj.setVisible(false);
|
||||
this.setSpecies(null);
|
||||
this.filterBarCursor = 0;
|
||||
this.setFilterMode(true);
|
||||
this.filterBar.toggleDropDown(this.filterBarCursor);
|
||||
}
|
||||
} else if (this.startCursorObj.visible) { // this checks to see if the start button is selected
|
||||
switch (button) {
|
||||
case Button.ACTION:
|
||||
|
@ -2026,6 +2054,9 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
case SettingKeyboard.Button_Cycle_Variant:
|
||||
iconPath = "V.png";
|
||||
break;
|
||||
case SettingKeyboard.Button_Stats:
|
||||
iconPath = "C.png";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -2045,11 +2076,36 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
}
|
||||
}
|
||||
|
||||
updateFilterButtonIcon(iconSetting, gamepadType, iconElement, controlLabel): void {
|
||||
let iconPath;
|
||||
// touch controls cannot be rebound as is, and are just emulating a keyboard event.
|
||||
// Additionally, since keyboard controls can be rebound (and will be displayed when they are), we need to have special handling for the touch controls
|
||||
if (gamepadType === "touch") {
|
||||
gamepadType = "keyboard";
|
||||
iconPath = "C.png";
|
||||
} else {
|
||||
iconPath = this.scene.inputController?.getIconForLatestInputRecorded(iconSetting);
|
||||
}
|
||||
iconElement.setTexture(gamepadType, iconPath);
|
||||
iconElement.setPosition(this.filterInstructionRowX, this.filterInstructionRowY);
|
||||
controlLabel.setPosition(this.filterInstructionRowX + this.instructionRowTextOffset, this.filterInstructionRowY);
|
||||
iconElement.setVisible(true);
|
||||
controlLabel.setVisible(true);
|
||||
this.filterInstructionsContainer.add([iconElement, controlLabel]);
|
||||
this.filterInstructionRowY += 8;
|
||||
if (this.filterInstructionRowY >= 24) {
|
||||
this.filterInstructionRowY = 0;
|
||||
this.filterInstructionRowX += 50;
|
||||
}
|
||||
}
|
||||
updateInstructions(): void {
|
||||
this.instructionRowX = 0;
|
||||
this.instructionRowY = 0;
|
||||
this.filterInstructionRowX = 0;
|
||||
this.filterInstructionRowY = 0;
|
||||
this.hideInstructions();
|
||||
this.instructionsContainer.removeAll();
|
||||
this.filterInstructionsContainer.removeAll();
|
||||
let gamepadType;
|
||||
if (this.scene.inputMethod === "gamepad") {
|
||||
gamepadType = this.scene.inputController.getConfig(this.scene.inputController.selectedDevice[Device.GAMEPAD]).padType;
|
||||
|
@ -2057,6 +2113,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
gamepadType = this.scene.inputMethod;
|
||||
}
|
||||
|
||||
if (!gamepadType) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.speciesStarterDexEntry?.caughtAttr) {
|
||||
if (this.canCycleShiny) {
|
||||
this.updateButtonIcon(SettingKeyboard.Button_Cycle_Shiny, gamepadType, this.shinyIconElement, this.shinyLabel);
|
||||
|
@ -2077,6 +2137,12 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
this.updateButtonIcon(SettingKeyboard.Button_Cycle_Variant, gamepadType, this.variantIconElement, this.variantLabel);
|
||||
}
|
||||
}
|
||||
|
||||
// if filter mode is inactivated and gamepadType is not undefined, update the button icons
|
||||
if (!this.filterMode) {
|
||||
this.updateFilterButtonIcon(SettingKeyboard.Button_Stats, gamepadType, this.goFilterIconElement, this.goFilterLabel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getValueLimit(): integer {
|
||||
|
@ -2398,6 +2464,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
this.setCursor(filterMode ? this.filterBarCursor : this.cursor);
|
||||
if (filterMode) {
|
||||
this.setSpecies(null);
|
||||
this.updateInstructions();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -3260,6 +3327,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
this.natureLabel.setVisible(false);
|
||||
this.variantIconElement.setVisible(false);
|
||||
this.variantLabel.setVisible(false);
|
||||
this.goFilterIconElement.setVisible(false);
|
||||
this.goFilterLabel.setVisible(false);
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
|
|
Loading…
Reference in New Issue