Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/session/session.js
Show First 20 Lines • Show All 281 Lines • ▼ Show 20 Lines | function init(initData, hotloadData) | ||||
initGUIObjects(); | initGUIObjects(); | ||||
if (hotloadData) | if (hotloadData) | ||||
g_Selection.selected = hotloadData.selection; | g_Selection.selected = hotloadData.selection; | ||||
sendLobbyPlayerlistUpdate(); | sendLobbyPlayerlistUpdate(); | ||||
onSimulationUpdate(); | onSimulationUpdate(); | ||||
setTimeout(displayGamestateNotifications, 1000); | setTimeout(displayGamestateNotifications, 1000); | ||||
// Report the performance after 5 seconds (when we're still near | |||||
// the initial camera view) and a minute (when the profiler will | |||||
// have settled down if framerates as very low), to give some | |||||
// extremely rough indications of performance | |||||
// | |||||
// DISABLED: this information isn't currently useful for anything much, | |||||
// and it generates a massive amount of data to transmit and store | |||||
// setTimeout(function() { reportPerformance(5); }, 5000); | |||||
// setTimeout(function() { reportPerformance(60); }, 60000); | |||||
} | } | ||||
function initGUIObjects() | function initGUIObjects() | ||||
{ | { | ||||
initMenu(); | initMenu(); | ||||
updateGameSpeedControl(); | updateGameSpeedControl(); | ||||
resizeDiplomacyDialog(); | resizeDiplomacyDialog(); | ||||
resizeTradeDialog(); | resizeTradeDialog(); | ||||
▲ Show 20 Lines • Show All 400 Lines • ▼ Show 20 Lines | function updateTopPanel() | ||||
alphaLabel.hidden = isPlayer && !viewPlayer.hidden; | alphaLabel.hidden = isPlayer && !viewPlayer.hidden; | ||||
alphaLabel.size = isPlayer ? "50%+44 0 100%-283 100%" : "155 0 85%-279 100%"; | alphaLabel.size = isPlayer ? "50%+44 0 100%-283 100%" : "155 0 85%-279 100%"; | ||||
Engine.GetGUIObjectByName("pauseButton").enabled = !g_IsObserver || !g_IsNetworked || g_IsController; | Engine.GetGUIObjectByName("pauseButton").enabled = !g_IsObserver || !g_IsNetworked || g_IsController; | ||||
Engine.GetGUIObjectByName("menuResignButton").enabled = !g_IsObserver; | Engine.GetGUIObjectByName("menuResignButton").enabled = !g_IsObserver; | ||||
Engine.GetGUIObjectByName("lobbyButton").enabled = Engine.HasXmppClient(); | Engine.GetGUIObjectByName("lobbyButton").enabled = Engine.HasXmppClient(); | ||||
} | } | ||||
function reportPerformance(time) | |||||
{ | |||||
let settings = g_GameAttributes.settings; | |||||
Engine.SubmitUserReport("profile", 3, JSON.stringify({ | |||||
"time": time, | |||||
"map": settings.Name, | |||||
"seed": settings.Seed, // only defined for random maps | |||||
"size": settings.Size, // only defined for random maps | |||||
"profiler": Engine.GetProfilerState() | |||||
})); | |||||
} | |||||
/** | /** | ||||
* Resign a player. | * Resign a player. | ||||
* @param leaveGameAfterResign If player is quitting after resignation. | * @param leaveGameAfterResign If player is quitting after resignation. | ||||
*/ | */ | ||||
function resignGame(leaveGameAfterResign) | function resignGame(leaveGameAfterResign) | ||||
{ | { | ||||
if (g_IsObserver || g_Disconnected) | if (g_IsObserver || g_Disconnected) | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 1,049 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator