Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/session.js
Show First 20 Lines • Show All 695 Lines • ▼ Show 20 Lines | function updateTopPanel() | ||||
Engine.GetGUIObjectByName("observerText").hidden = isPlayer; | Engine.GetGUIObjectByName("observerText").hidden = isPlayer; | ||||
let alphaLabel = Engine.GetGUIObjectByName("alphaLabel"); | let alphaLabel = Engine.GetGUIObjectByName("alphaLabel"); | ||||
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 && Engine.HasXmppClient(); | ||||
} | } | ||||
/** | /** | ||||
* 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) | ||||
{ | { | ||||
Show All 24 Lines | function leaveGame(willRejoin) | ||||
Engine.EndGame(); | Engine.EndGame(); | ||||
// After the replay file was closed in EndGame | // After the replay file was closed in EndGame | ||||
// Done here to keep EndGame small | // Done here to keep EndGame small | ||||
if (!g_IsReplay) | if (!g_IsReplay) | ||||
Engine.AddReplayToCache(replayDirectory); | Engine.AddReplayToCache(replayDirectory); | ||||
if (g_IsController && Engine.HasXmppClient()) | if (g_IsController && Engine.HasXmppClient && Engine.HasXmppClient()) | ||||
Engine.SendUnregisterGame(); | Engine.SendUnregisterGame(); | ||||
Engine.SwitchGuiPage("page_summary.xml", { | Engine.SwitchGuiPage("page_summary.xml", { | ||||
"sim": simData, | "sim": simData, | ||||
"gui": { | "gui": { | ||||
"dialog": false, | "dialog": false, | ||||
"assignedPlayer": playerID, | "assignedPlayer": playerID, | ||||
"disconnected": g_Disconnected, | "disconnected": g_Disconnected, | ||||
▲ Show 20 Lines • Show All 709 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
/** | /** | ||||
* Send the current list of players, teams, AIs, observers and defeated/won and offline states to the lobby. | * Send the current list of players, teams, AIs, observers and defeated/won and offline states to the lobby. | ||||
* The playerData format from g_GameAttributes is kept to reuse the GUI function presenting the data. | * The playerData format from g_GameAttributes is kept to reuse the GUI function presenting the data. | ||||
*/ | */ | ||||
function sendLobbyPlayerlistUpdate() | function sendLobbyPlayerlistUpdate() | ||||
{ | { | ||||
if (!g_IsController || !Engine.HasXmppClient()) | if (!g_IsController || !Engine.HasXmppClient || !Engine.HasXmppClient()) | ||||
return; | return; | ||||
// Extract the relevant player data and minimize packet load | // Extract the relevant player data and minimize packet load | ||||
let minPlayerData = []; | let minPlayerData = []; | ||||
for (let playerID in g_GameAttributes.settings.PlayerData) | for (let playerID in g_GameAttributes.settings.PlayerData) | ||||
{ | { | ||||
if (+playerID == 0) | if (+playerID == 0) | ||||
continue; | continue; | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Send a report on the gamestatus to the lobby. | * Send a report on the gamestatus to the lobby. | ||||
* Keep in sync with source/tools/XpartaMuPP/LobbyRanking.py | * Keep in sync with source/tools/XpartaMuPP/LobbyRanking.py | ||||
*/ | */ | ||||
function reportGame() | function reportGame() | ||||
{ | { | ||||
// Only 1v1 games are rated (and Gaia is part of g_Players) | // Only 1v1 games are rated (and Gaia is part of g_Players) | ||||
if (!Engine.HasXmppClient() || !Engine.IsRankedGame() || | if (!Engine.HasXmppClient || !Engine.HasXmppClient() || !Engine.IsRankedGame() || | ||||
g_Players.length != 3 || Engine.GetPlayerID() == -1) | g_Players.length != 3 || Engine.GetPlayerID() == -1) | ||||
return; | return; | ||||
let extendedSimState = Engine.GuiInterfaceCall("GetExtendedSimulationState"); | let extendedSimState = Engine.GuiInterfaceCall("GetExtendedSimulationState"); | ||||
let unitsClasses = [ | let unitsClasses = [ | ||||
"total", | "total", | ||||
"Infantry", | "Infantry", | ||||
▲ Show 20 Lines • Show All 180 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator