Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: binaries/data/mods/public/gui/session_new/session.js
- ===================================================================
- --- binaries/data/mods/public/gui/session_new/session.js (revision 8588)
- +++ binaries/data/mods/public/gui/session_new/session.js (working copy)
- @@ -89,8 +89,8 @@
- function leaveGame()
- {
- - var simState = Engine.GuiInterfaceCall("GetSimulationState");
- - var playerState = simState.players[Engine.GetPlayerID()];
- + var extendedSimState = Engine.GuiInterfaceCall("GetExtendedSimulationState");
- + var playerState = extendedSimState.players[Engine.GetPlayerID()];
- var gameResult;
- if (playerState.state == "won")
- @@ -119,8 +119,8 @@
- Engine.SwitchGuiPage("page_summary.xml",
- { "gameResult" : gameResult,
- - "timeElapsed" : simState.timeElapsed,
- - "playerStates": simState.players
- + "timeElapsed" : extendedSimState.timeElapsed,
- + "playerStates": extendedSimState.players
- });
- }
- Index: binaries/data/mods/public/simulation/components/GuiInterface.js
- ===================================================================
- --- binaries/data/mods/public/simulation/components/GuiInterface.js (revision 8588)
- +++ binaries/data/mods/public/simulation/components/GuiInterface.js (working copy)
- @@ -17,6 +17,10 @@
- this.rallyPoints = undefined;
- };
- +/**
- + * All of the functions defined below are called via Engine.GuiInterfaceCall(name, arg) from GUI scripts, and executed here with arguments (player, arg)
- +*/
- +
- GuiInterface.prototype.GetSimulationState = function(player)
- {
- var ret = {
- @@ -60,6 +64,28 @@
- return ret;
- };
- +GuiInterface.prototype.GetExtendedSimulationState = function(player)
- +{
- + // Get basic simulation info
- + var ret = this.GetSimulationState();
- +
- + // Add timeElapsed
- + var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
- + ret.timeElapsed = cmpTimer.GetTime();
- +
- + // Add statistics to each player
- + var cmpPlayerMan = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager);
- + var n = cmpPlayerMan.GetNumPlayers();
- + for (var i = 0; i < n; ++i)
- + {
- + var playerEnt = cmpPlayerMan.GetPlayerByID(i);
- + var cmpPlayerStatisticsTracker = Engine.QueryInterface(playerEnt, IID_StatisticsTracker);
- + ret.players[i].statistics = cmpPlayerStatisticsTracker.GetStatistics();
- + }
- +
- + return ret;
- +};
- +
- GuiInterface.prototype.GetEntityState = function(player, ent)
- {
- var cmpTempMan = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement