Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup_mp/gamesetup_mp.js
Show All 15 Lines | |||||
/** | /** | ||||
* Identifier if server is using password. | * Identifier if server is using password. | ||||
*/ | */ | ||||
var g_ServerHasPassword = false; | var g_ServerHasPassword = false; | ||||
var g_ServerId; | var g_ServerId; | ||||
var g_IsRejoining = false; | var g_IsRejoining = false; | ||||
var g_GameAttributes; // used when rejoining | var g_InitAttributes; // used when rejoining | ||||
var g_PlayerAssignments; // used when rejoining | var g_PlayerAssignments; // used when rejoining | ||||
var g_UserRating; | var g_UserRating; | ||||
function init(attribs) | function init(attribs) | ||||
{ | { | ||||
g_UserRating = attribs.rating; | g_UserRating = attribs.rating; | ||||
switch (attribs.multiplayerGameType) | switch (attribs.multiplayerGameType) | ||||
▲ Show 20 Lines • Show All 189 Lines • ▼ Show 20 Lines | if (g_IsRejoining) | ||||
default: | default: | ||||
error("Unrecognised netstatus type: " + message.status); | error("Unrecognised netstatus type: " + message.status); | ||||
break; | break; | ||||
} | } | ||||
break; | break; | ||||
case "gamesetup": | case "gamesetup": | ||||
g_GameAttributes = message.data; | g_InitAttributes = message.data; | ||||
break; | break; | ||||
case "players": | case "players": | ||||
g_PlayerAssignments = message.newAssignments; | g_PlayerAssignments = message.newAssignments; | ||||
break; | break; | ||||
case "start": | case "start": | ||||
// Copy playernames from initial player assignment to the settings | // Copy playernames from initial player assignment to the settings | ||||
for (let guid in g_PlayerAssignments) | for (let guid in g_PlayerAssignments) | ||||
{ | { | ||||
let player = g_PlayerAssignments[guid]; | let player = g_PlayerAssignments[guid]; | ||||
if (player.player > 0) // not observer or GAIA | if (player.player > 0) // not observer or GAIA | ||||
g_GameAttributes.settings.PlayerData[player.player - 1].Name = player.name; | g_InitAttributes.settings.PlayerData[player.player - 1].Name = player.name; | ||||
} | } | ||||
Engine.SwitchGuiPage("page_loading.xml", { | Engine.SwitchGuiPage("page_loading.xml", { | ||||
"attribs": g_GameAttributes, | "attribs": g_InitAttributes, | ||||
"isRejoining": g_IsRejoining, | "isRejoining": g_IsRejoining, | ||||
"playerAssignments": g_PlayerAssignments | "playerAssignments": g_PlayerAssignments | ||||
}); | }); | ||||
// Process further pending netmessages in the session page | // Process further pending netmessages in the session page | ||||
return; | return; | ||||
case "chat": | case "chat": | ||||
▲ Show 20 Lines • Show All 227 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator