Changeset View
Standalone View
binaries/data/mods/public/gui/session/session.js
Show First 20 Lines • Show All 575 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
if (!willRejoin && !g_IsObserver) | if (!willRejoin && !g_IsObserver) | ||||
resignGame(true); | resignGame(true); | ||||
// Before ending the game | // Before ending the game | ||||
let replayDirectory = Engine.GetCurrentReplayDirectory(); | let replayDirectory = Engine.GetCurrentReplayDirectory(); | ||||
let simData = getReplayMetadata(); | let simData = getReplayMetadata(); | ||||
let campaignData = null; | |||||
if (Engine.GetInitAttributes().campaignData) | |||||
{ | |||||
campaignData = Engine.GetInitAttributes().campaignData; | |||||
campaignData.endGameData = Engine.GuiInterfaceCall("GetEndGameCampaignData"); | |||||
campaignGameEnded(campaignData); | |||||
elexis: This function (`leaveGame`) is called when clicking on Menu -> Exit, when having officially won… | |||||
Not Done Inline ActionsPoint 1. still needs to be taken care of. Point 2.a is already dealt with imo, point 2.B could wait… wraitii: Point 1. still needs to be taken care of.
Point 2.a is already dealt with imo, point 2.B could… | |||||
Not Done Inline Actionspoint 1 done wraitii: point 1 done | |||||
Not Done Inline ActionsThis assignment looks troublesome. The init attributes should never be changed. I guess one receives a copy instead of a deeply frozen reference. Engine.GetInitAttributes().campaignData duplo One could also examine whether passing Engine.GetInitAttributes() entirely to the summary screen would be good or bad. elexis: This assignment looks troublesome. The init attributes should never be changed. I guess one… | |||||
} | |||||
Engine.EndGame(); | Engine.EndGame(); | ||||
if (g_IsController && Engine.HasXmppClient()) | if (g_IsController && Engine.HasXmppClient()) | ||||
Engine.SendUnregisterGame(); | Engine.SendUnregisterGame(); | ||||
Engine.SwitchGuiPage("page_summary.xml", { | Engine.SwitchGuiPage("page_summary.xml", { | ||||
"sim": simData, | "sim": simData, | ||||
"gui": { | "gui": { | ||||
"assignedPlayer": Engine.GetPlayerID(), | "assignedPlayer": Engine.GetPlayerID(), | ||||
"disconnected": g_Disconnected, | "disconnected": g_Disconnected, | ||||
"isReplay": g_IsReplay, | "isReplay": g_IsReplay, | ||||
"replayDirectory": !g_HasRejoined && replayDirectory, | "replayDirectory": !g_HasRejoined && replayDirectory, | ||||
"replaySelectionData": g_ReplaySelectionData | "replaySelectionData": g_ReplaySelectionData | ||||
} | }, | ||||
"campaignData" : campaignData | |||||
Not Done Inline ActionsSo that's not simulation data? elexis: So that's not simulation data? | |||||
Not Done Inline ActionsI believe (been a while) this data can come from the campaign metadata itself, so keeping it separate makes sense imo. For example a campaign might keep track of how well you are doing, but that's not really 'Sim Data' to me. wraitii: I believe (been a while) this data can come from the campaign metadata itself, so keeping it… | |||||
Not Done Inline ActionsThat data comes from Engine.GetInitAttributes() but that should only contain the gamesettings which determine the simulation. elexis: That data comes from `Engine.GetInitAttributes()` but that should only contain the gamesettings… | |||||
}); | }); | ||||
} | } | ||||
// Return some data that we'll use when hotloading this file after changes | // Return some data that we'll use when hotloading this file after changes | ||||
function getHotloadData() | function getHotloadData() | ||||
{ | { | ||||
return { "selection": g_Selection.selected }; | return { "selection": g_Selection.selected }; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 809 Lines • Show Last 20 Lines |
This function (leaveGame) is called when clicking on Menu -> Exit, when having officially won the game or finished the replay and being asked to leave.
Two bugs seem to arise:
either