mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Remove Engine.SwitchGuiPage from loading
This commit is contained in:
parent
02a4cf6aff
commit
d842a134f9
2 changed files with 34 additions and 34 deletions
|
|
@ -31,27 +31,3 @@ function displayGamestateNotifications()
|
|||
|
||||
setTimeout(displayGamestateNotifications, 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called from the engine whenever starting a game fails.
|
||||
*/
|
||||
function cancelOnLoadGameError(msg)
|
||||
{
|
||||
Engine.EndGame();
|
||||
|
||||
if (Engine.HasXmppClient())
|
||||
Engine.StopXmppClient();
|
||||
|
||||
Engine.SwitchGuiPage("page_pregame.xml");
|
||||
|
||||
if (msg)
|
||||
Engine.OpenChildPage("page_msgbox.xml", {
|
||||
"width": 500,
|
||||
"height": 200,
|
||||
"message": msg,
|
||||
"title": translate("Loading Aborted"),
|
||||
"mode": 2
|
||||
});
|
||||
|
||||
Engine.ResetCursor();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
var g_LoadingPage;
|
||||
|
||||
function init(data)
|
||||
async function init(data)
|
||||
{
|
||||
g_LoadingPage = {
|
||||
"initData": data,
|
||||
|
|
@ -11,14 +11,38 @@ function init(data)
|
|||
};
|
||||
|
||||
Engine.SetCursor("cursor-wait");
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a reserved function name that is executed by the engine when it is ready
|
||||
* to start the game (i.e. loading progress has reached 100%).
|
||||
*/
|
||||
function reallyStartGame()
|
||||
{
|
||||
Engine.SwitchGuiPage("page_session.xml", g_LoadingPage.initData);
|
||||
Engine.ResetCursor();
|
||||
// reallyStartGame and cancelOnLoadGameError are reserved names that are called by the engine.
|
||||
// reallyStartGame is called when it is ready to start the game (i.e. loading progress has reached
|
||||
// 100%).
|
||||
// cancnelOnLoadGameError is called when there is an error.
|
||||
return new Promise(closePageCallback =>
|
||||
{
|
||||
globalThis.reallyStartGame = () =>
|
||||
{
|
||||
Engine.ResetCursor();
|
||||
closePageCallback({ [Engine.openRequest]: {
|
||||
"page": "page_session.xml",
|
||||
"argument": data
|
||||
} });
|
||||
};
|
||||
globalThis.cancelOnLoadGameError = async() =>
|
||||
{
|
||||
Engine.ResetCursor();
|
||||
Engine.EndGame();
|
||||
|
||||
if (Engine.HasXmppClient())
|
||||
Engine.StopXmppClient();
|
||||
|
||||
await Engine.OpenChildPage("page_msgbox.xml", {
|
||||
"width": 500,
|
||||
"height": 200,
|
||||
"message": errorMessage,
|
||||
"title": translate("Loading Aborted"),
|
||||
"mode": 2
|
||||
});
|
||||
|
||||
closePageCallback({ [Engine.openRequest]: { "page": "page_pregame.xml" } });
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue