Hiding "Show forms" button while forms are being shown

This commit is contained in:
Wlowscha 2025-02-10 23:40:40 +01:00
parent 9060dc52df
commit cfa70693e2
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04

View File

@ -210,7 +210,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
private trayColumns: number; private trayColumns: number;
private trayCursorObj: Phaser.GameObjects.Image; private trayCursorObj: Phaser.GameObjects.Image;
private trayCursor: number = 0; private trayCursor: number = 0;
private showTray: boolean = false; private showingTray: boolean = false;
private showFormTrayIconElement: Phaser.GameObjects.Sprite; private showFormTrayIconElement: Phaser.GameObjects.Sprite;
private showFormTrayLabel: Phaser.GameObjects.Text; private showFormTrayLabel: Phaser.GameObjects.Text;
private canShowFormTray: boolean; private canShowFormTray: boolean;
@ -893,14 +893,14 @@ export default class PokedexUiHandler extends MessageUiHandler {
} else if (this.filterTextMode && !(this.filterText.getValue(this.filterTextCursor) === this.filterText.defaultText)) { } else if (this.filterTextMode && !(this.filterText.getValue(this.filterTextCursor) === this.filterText.defaultText)) {
this.filterText.resetSelection(this.filterTextCursor); this.filterText.resetSelection(this.filterTextCursor);
success = true; success = true;
} else if (this.showTray) { } else if (this.showingTray) {
success = this.closeFormTray(); success = this.closeFormTray();
} else { } else {
this.tryExit(); this.tryExit();
success = true; success = true;
} }
} else if (button === Button.STATS) { } else if (button === Button.STATS) {
if (!this.filterMode && !this.showTray) { if (!this.filterMode && !this.showingTray) {
this.cursorObj.setVisible(false); this.cursorObj.setVisible(false);
this.setSpecies(null); this.setSpecies(null);
this.filterText.cursorObj.setVisible(false); this.filterText.cursorObj.setVisible(false);
@ -911,7 +911,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
error = true; error = true;
} }
} else if (button === Button.V) { } else if (button === Button.V) {
if (!this.filterTextMode && !this.showTray) { if (!this.filterTextMode && !this.showingTray) {
this.cursorObj.setVisible(false); this.cursorObj.setVisible(false);
this.setSpecies(null); this.setSpecies(null);
this.filterBar.cursorObj.setVisible(false); this.filterBar.cursorObj.setVisible(false);
@ -922,7 +922,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
error = true; error = true;
} }
} else if (button === Button.CYCLE_SHINY) { } else if (button === Button.CYCLE_SHINY) {
if (!this.showTray) { if (!this.showingTray) {
this.showDecorations = !this.showDecorations; this.showDecorations = !this.showDecorations;
this.updateScroll(); this.updateScroll();
success = true; success = true;
@ -1025,7 +1025,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
success = true; success = true;
break; break;
} }
} else if (this.showTray) { } else if (this.showingTray) {
if (button === Button.ACTION) { if (button === Button.ACTION) {
const formIndex = this.trayForms[this.trayCursor].formIndex; const formIndex = this.trayForms[this.trayCursor].formIndex;
ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, formIndex, { form: formIndex }); ui.setOverlayMode(Mode.POKEDEX_PAGE, this.lastSpecies, formIndex, { form: formIndex });
@ -1739,12 +1739,15 @@ export default class PokedexUiHandler extends MessageUiHandler {
this.trayContainers.push(formContainer); this.trayContainers.push(formContainer);
}); });
this.showTray = true; this.showingTray = true;
this.setTrayCursor(0); this.setTrayCursor(0);
this.formTrayContainer.setVisible(true); this.formTrayContainer.setVisible(true);
this.showFormTrayIconElement.setVisible(false);
this.showFormTrayLabel.setVisible(false);
return true; return true;
} }
@ -1756,14 +1759,14 @@ export default class PokedexUiHandler extends MessageUiHandler {
this.trayContainers = []; this.trayContainers = [];
this.formTrayContainer.setVisible(false); this.formTrayContainer.setVisible(false);
this.showTray = false; this.showingTray = false;
this.setSpeciesDetails(this.lastSpecies); this.setSpeciesDetails(this.lastSpecies);
return true; return true;
} }
setTrayCursor(cursor: number): boolean { setTrayCursor(cursor: number): boolean {
if (!this.showTray) { if (!this.showingTray) {
return false; return false;
} }
@ -1948,8 +1951,10 @@ export default class PokedexUiHandler extends MessageUiHandler {
} }
if (species?.forms?.length > 1) { if (species?.forms?.length > 1) {
this.showFormTrayIconElement.setVisible(true); if (!this.showingTray) {
this.showFormTrayLabel.setVisible(true); this.showFormTrayIconElement.setVisible(true);
this.showFormTrayLabel.setVisible(true);
}
this.canShowFormTray = true; this.canShowFormTray = true;
} else { } else {
this.showFormTrayIconElement.setVisible(false); this.showFormTrayIconElement.setVisible(false);