From 0b83e240650ba3018830e736d9190974b0cf82c6 Mon Sep 17 00:00:00 2001 From: phosit Date: Tue, 30 Dec 2025 18:23:43 +0100 Subject: [PATCH] Close register-page before opening login-page The `onTick` of the register-page was still running when connecting to the lobby. This lead to an error when the `connect` message was received. With this commit returning from the login-page will always return to the entrance-page. Previously it returned to the register-page when it was opened by through that page. --- .../mods/public/gui/prelobby/common/feedback/feedback.js | 2 ++ binaries/data/mods/public/gui/prelobby/entrance/entrance.js | 5 +++-- binaries/data/mods/public/gui/prelobby/register/register.js | 3 +-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/binaries/data/mods/public/gui/prelobby/common/feedback/feedback.js b/binaries/data/mods/public/gui/prelobby/common/feedback/feedback.js index 6e46edddec..1f140cbaad 100644 --- a/binaries/data/mods/public/gui/prelobby/common/feedback/feedback.js +++ b/binaries/data/mods/public/gui/prelobby/common/feedback/feedback.js @@ -42,4 +42,6 @@ async function cancelButton() await new Promise(resolve => { Engine.GetGUIObjectByName("cancel").onPress = resolve; }); if (Engine.HasXmppClient()) Engine.StopXmppClient(); + + return false; } diff --git a/binaries/data/mods/public/gui/prelobby/entrance/entrance.js b/binaries/data/mods/public/gui/prelobby/entrance/entrance.js index 03eaeb1af2..40e7b53e7e 100644 --- a/binaries/data/mods/public/gui/prelobby/entrance/entrance.js +++ b/binaries/data/mods/public/gui/prelobby/entrance/entrance.js @@ -13,7 +13,8 @@ function loginButton() Engine.OpenChildPage("page_prelobby_login.xml"); } -function registerButton() +async function registerButton() { - Engine.OpenChildPage("page_prelobby_register.xml"); + if (await Engine.OpenChildPage("page_prelobby_register.xml")) + Engine.OpenChildPage("page_prelobby_login.xml"); } diff --git a/binaries/data/mods/public/gui/prelobby/register/register.js b/binaries/data/mods/public/gui/prelobby/register/register.js index 1a99a07b99..09cf00834b 100644 --- a/binaries/data/mods/public/gui/prelobby/register/register.js +++ b/binaries/data/mods/public/gui/prelobby/register/register.js @@ -40,6 +40,5 @@ async function onRegistered() setFeedback(translate("Registered")); Engine.StopXmppClient(); - - Engine.OpenChildPage("page_prelobby_login.xml"); + return true; }