mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Fix unresponsiveness after campaign game ends
Presumably since094a7c2268, when a game played as part of a campaign ended (by the player winning or loosing), after closing the victory dialog by pressing "Stay", the session UI became completely unresponsive, so that no buttons could be clicked. The cause for this was that the child page campaigns/default_menu/endgame/page.xml was never closed, so remained invisibly open above the session GUI and blocked all of the inputs. Additionally the Campaign session class tried to close the page_session.xml page, which was not supposed to happen, it was introduced by mistake in094a7c2268replacing the logic to close the campaigns/default_menu/endgame/page.xml child page again.
This commit is contained in:
parent
54764733dd
commit
9ff42ccae6
3 changed files with 8 additions and 12 deletions
|
|
@ -8,4 +8,6 @@ function init(endGameData)
|
|||
const run = CampaignRun.getCurrentRun();
|
||||
if (endGameData.won)
|
||||
markLevelComplete(run, endGameData.initData.levelID);
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
class CampaignSession
|
||||
{
|
||||
constructor(data, closePageCallback)
|
||||
constructor(data)
|
||||
{
|
||||
this.run = new CampaignRun(data.run).load();
|
||||
registerPlayersFinishedHandler(this.onFinish.bind(this, closePageCallback));
|
||||
registerPlayersFinishedHandler(this.onFinish.bind(this));
|
||||
this.endGameData = {
|
||||
"won": false,
|
||||
"initData": data,
|
||||
|
|
@ -11,7 +11,7 @@ class CampaignSession
|
|||
};
|
||||
}
|
||||
|
||||
onFinish(closePageCallback, players, won)
|
||||
onFinish(players, won)
|
||||
{
|
||||
const playerID = Engine.GetPlayerID();
|
||||
if (players.indexOf(playerID) === -1)
|
||||
|
|
@ -24,7 +24,6 @@ class CampaignSession
|
|||
|
||||
// Run the endgame script.
|
||||
Engine.OpenChildPage(this.getEndGame(), this.endGameData);
|
||||
closePageCallback();
|
||||
}
|
||||
|
||||
getMenu()
|
||||
|
|
|
|||
|
|
@ -277,11 +277,8 @@ function init(initData, hotloadData)
|
|||
restoreSavedGameData(initData.savedGUIData);
|
||||
}
|
||||
|
||||
const promise = new Promise(closePageCallback =>
|
||||
{
|
||||
if (g_InitAttributes.campaignData)
|
||||
g_CampaignSession = new CampaignSession(g_InitAttributes.campaignData, closePageCallback);
|
||||
});
|
||||
if (g_InitAttributes.campaignData)
|
||||
g_CampaignSession = new CampaignSession(g_InitAttributes.campaignData);
|
||||
|
||||
const mapCache = new MapCache();
|
||||
g_Cheats = new Cheats();
|
||||
|
|
@ -345,9 +342,7 @@ function init(initData, hotloadData)
|
|||
|
||||
setTimeout(displayGamestateNotifications, 1000);
|
||||
|
||||
if (g_IsNetworked)
|
||||
return Promise.race([promise, handleNetMessages()]);
|
||||
return promise;
|
||||
return g_IsNetworked ? handleNetMessages() : new Promise(() => {});
|
||||
}
|
||||
|
||||
function registerPlayersInitHandler(handler)
|
||||
|
|
|
|||
Loading…
Reference in a new issue