mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-08-15 14:43:32 -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);
|
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;
|
var g_LoadingPage;
|
||||||
|
|
||||||
function init(data)
|
async function init(data)
|
||||||
{
|
{
|
||||||
g_LoadingPage = {
|
g_LoadingPage = {
|
||||||
"initData": data,
|
"initData": data,
|
||||||
|
|
@ -11,14 +11,38 @@ function init(data)
|
||||||
};
|
};
|
||||||
|
|
||||||
Engine.SetCursor("cursor-wait");
|
Engine.SetCursor("cursor-wait");
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// reallyStartGame and cancelOnLoadGameError are reserved names that are called by the engine.
|
||||||
* This is a reserved function name that is executed by the engine when it is ready
|
// reallyStartGame is called when it is ready to start the game (i.e. loading progress has reached
|
||||||
* to start the game (i.e. loading progress has reached 100%).
|
// 100%).
|
||||||
*/
|
// cancnelOnLoadGameError is called when there is an error.
|
||||||
function reallyStartGame()
|
return new Promise(closePageCallback =>
|
||||||
{
|
{
|
||||||
Engine.SwitchGuiPage("page_session.xml", g_LoadingPage.initData);
|
globalThis.reallyStartGame = () =>
|
||||||
Engine.ResetCursor();
|
{
|
||||||
|
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