mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-05-06 08:23:18 +01:00
[Bug] Fix Login Screen Buttons can be Pressed While Animating (#5170)
* destroy containers when processing external containers * make form buttons uninteractible until tweens finished instead * fix holding enter spam * fix conflicts
This commit is contained in:
parent
65294f408e
commit
bda286cebb
@ -124,7 +124,7 @@ export abstract class FormModalUiHandler extends ModalUiHandler {
|
||||
if (this.buttonBgs.length) {
|
||||
this.buttonBgs[0].off("pointerdown");
|
||||
this.buttonBgs[0].on("pointerdown", () => {
|
||||
if (this.submitAction) {
|
||||
if (this.submitAction && globalScene.tweens.getTweensOf(this.modalContainer).length === 0) {
|
||||
this.submitAction();
|
||||
}
|
||||
});
|
||||
|
@ -40,25 +40,9 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
|
||||
|
||||
setup(): void {
|
||||
super.setup();
|
||||
|
||||
this.buildExternalPartyContainer();
|
||||
|
||||
this.infoContainer = globalScene.add.container(0, 0);
|
||||
|
||||
this.usernameInfoImage = this.buildInteractableImage("settings_icon", "username-info-icon", {
|
||||
x: 20,
|
||||
scale: 0.5,
|
||||
});
|
||||
|
||||
this.saveDownloadImage = this.buildInteractableImage("saving_icon", "save-download-icon", {
|
||||
x: 0,
|
||||
scale: 0.75,
|
||||
});
|
||||
|
||||
this.infoContainer.add(this.usernameInfoImage);
|
||||
this.infoContainer.add(this.saveDownloadImage);
|
||||
this.getUi().add(this.infoContainer);
|
||||
this.infoContainer.setVisible(false);
|
||||
this.infoContainer.disableInteractive();
|
||||
this.buildInfoContainer();
|
||||
}
|
||||
|
||||
private buildExternalPartyContainer() {
|
||||
@ -84,6 +68,26 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
|
||||
this.externalPartyContainer.setVisible(false);
|
||||
}
|
||||
|
||||
private buildInfoContainer() {
|
||||
this.infoContainer = globalScene.add.container(0, 0);
|
||||
|
||||
this.usernameInfoImage = this.buildInteractableImage("settings_icon", "username-info-icon", {
|
||||
x: 20,
|
||||
scale: 0.5,
|
||||
});
|
||||
|
||||
this.saveDownloadImage = this.buildInteractableImage("saving_icon", "save-download-icon", {
|
||||
x: 0,
|
||||
scale: 0.75,
|
||||
});
|
||||
|
||||
this.infoContainer.add(this.usernameInfoImage);
|
||||
this.infoContainer.add(this.saveDownloadImage);
|
||||
this.getUi().add(this.infoContainer);
|
||||
this.infoContainer.setVisible(false);
|
||||
this.infoContainer.disableInteractive();
|
||||
}
|
||||
|
||||
override getModalTitle(_config?: ModalConfig): string {
|
||||
let key = "menu:login";
|
||||
if (import.meta.env.VITE_SERVER_URL === "https://apibeta.pokerogue.net") {
|
||||
@ -143,6 +147,7 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
|
||||
this.processExternalProvider(config);
|
||||
const originalLoginAction = this.submitAction;
|
||||
this.submitAction = _ => {
|
||||
if (globalScene.tweens.getTweensOf(this.modalContainer).length === 0) {
|
||||
// Prevent overlapping overrides on action modification
|
||||
this.submitAction = originalLoginAction;
|
||||
this.sanitizeInputs();
|
||||
@ -164,6 +169,7 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
|
||||
onFail(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return true;
|
||||
@ -221,6 +227,7 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
|
||||
};
|
||||
|
||||
this.usernameInfoImage.on("pointerdown", () => {
|
||||
if (globalScene.tweens.getTweensOf(this.infoContainer).length === 0) {
|
||||
const localStorageKeys = Object.keys(localStorage); // this gets the keys for localStorage
|
||||
const keyToFind = "data_";
|
||||
const dataKeys = localStorageKeys.filter(ls => ls.indexOf(keyToFind) >= 0);
|
||||
@ -250,6 +257,7 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
|
||||
}
|
||||
return onFail(this.ERR_NO_SAVES);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.saveDownloadImage.on("pointerdown", () => {
|
||||
|
@ -134,7 +134,11 @@ export abstract class ModalUiHandler extends UiHandler {
|
||||
|
||||
for (let a = 0; a < this.buttonBgs.length; a++) {
|
||||
if (a < this.buttonBgs.length) {
|
||||
this.buttonBgs[a].on("pointerdown", _ => config.buttonActions[a]());
|
||||
this.buttonBgs[a].on("pointerdown", _ => {
|
||||
if (globalScene.tweens.getTweensOf(this.modalContainer).length === 0) {
|
||||
config.buttonActions[a]();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,6 +98,7 @@ export default class RegistrationFormUiHandler extends FormModalUiHandler {
|
||||
|
||||
const originalRegistrationAction = this.submitAction;
|
||||
this.submitAction = _ => {
|
||||
if (globalScene.tweens.getTweensOf(this.modalContainer).length === 0) {
|
||||
// Prevent overlapping overrides on action modification
|
||||
this.submitAction = originalRegistrationAction;
|
||||
this.sanitizeInputs();
|
||||
@ -143,6 +144,7 @@ export default class RegistrationFormUiHandler extends FormModalUiHandler {
|
||||
onFail(registerError);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user