Remove Engine.SwitchGuiPage from lobby

Since the page now isn't closed immediately, the `onTick` has to be
cleared.
This commit is contained in:
phosit 2025-04-24 16:40:26 +02:00
parent 3edda64566
commit 340a4d64ca
No known key found for this signature in database
GPG key ID: C9430B600671C268
3 changed files with 10 additions and 4 deletions

View file

@ -3,8 +3,9 @@
*/
class JoinButton
{
constructor(dialog, gameList)
constructor(closePageCallback, dialog, gameList)
{
this.closePageCallback = closePageCallback;
this.gameList = gameList;
this.joinButton = Engine.GetGUIObjectByName("joinButton");
@ -50,7 +51,11 @@ class JoinButton
return;
Engine.StopXmppClient();
Engine.SwitchGuiPage("page_modmod.xml", { "cancelbutton": true });
delete Engine.GetGUIObjectByName("lobbyPage").onTick;
this.closePageCallback({ [Engine.openRequest]: {
"page": "page_modmod.xml",
"argument": { "cancelbutton": true }
} });
return;
}

View file

@ -36,6 +36,7 @@ class QuitButton
returnToMainMenu()
{
Engine.StopXmppClient();
Engine.SwitchGuiPage("page_pregame.xml");
delete Engine.GetGUIObjectByName("lobbyPage").onTick;
this.closePageCallback({ [Engine.openRequest]: { "page": "page_pregame.xml" } });
}
}

View file

@ -18,7 +18,7 @@ class LobbyPage
"buttons": {
"buddyButton": buddyButton,
"accountSettingsButton": accountSettingsButton,
"joinButton": new JoinButton(dialog, gameList),
"joinButton": new JoinButton(closePageCallback, dialog, gameList),
"hostButton": new HostButton(closePageCallback, dialog, xmppMessages,
Engine.GetGUIObjectByName("hostButton"), false),
"hostSavedGameButton": new HostButton(closePageCallback, dialog, xmppMessages,