Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup_mp/gamesetup_mp.js
Show First 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
function startConnectionStatus(type) | function startConnectionStatus(type) | ||||
{ | { | ||||
g_GameType = type; | g_GameType = type; | ||||
g_IsConnecting = true; | g_IsConnecting = true; | ||||
g_IsRejoining = false; | g_IsRejoining = false; | ||||
Engine.GetGUIObjectByName("connectionStatus").caption = translate("Connecting to server..."); | Engine.GetGUIObjectByName("connectionStatus").caption = translate("Connecting to server..."); | ||||
initNetMessages(); | |||||
} | } | ||||
function onTick() | function initNetMessages() | ||||
{ | { | ||||
if (!g_IsConnecting) | Engine.GetGUIObjectByName("multiplayerPages").onNetworkMessage = message => { | ||||
return; | |||||
pollAndHandleNetworkClient(); | |||||
} | |||||
function pollAndHandleNetworkClient() | |||||
{ | |||||
while (true) | |||||
{ | |||||
var message = Engine.PollNetworkClient(); | |||||
if (!message) | |||||
break; | |||||
log(sprintf(translate("Net message: %(message)s"), { "message": uneval(message) })); | log(sprintf(translate("Net message: %(message)s"), { "message": uneval(message) })); | ||||
// If we're rejoining an active game, we don't want to actually display | // If we're rejoining an active game, we don't want to actually display | ||||
// the game setup screen, so perform similar processing to gamesetup.js | // the game setup screen, so perform similar processing to gamesetup.js | ||||
// in this screen | // in this screen | ||||
if (g_IsRejoining) | if (g_IsRejoining) | ||||
switch (message.type) | switch (message.type) | ||||
▲ Show 20 Lines • Show All 213 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator