Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/gamesetup_mp/gamesetup_mp.js
Show First 20 Lines • Show All 341 Lines • ▼ Show 20 Lines | function switchSetupPage(newPage) | ||||
Engine.GetGUIObjectByName("continueButton").hidden = newPage == "pageConnecting" || newPage == "pagePassword"; | Engine.GetGUIObjectByName("continueButton").hidden = newPage == "pageConnecting" || newPage == "pagePassword"; | ||||
} | } | ||||
function startHost(playername, servername, port, password) | function startHost(playername, servername, port, password) | ||||
{ | { | ||||
startConnectionStatus("server"); | startConnectionStatus("server"); | ||||
Engine.ConfigDB_CreateAndWriteValueToFile("user", "playername.multiplayer", playername, "config/user.cfg"); | Engine.ConfigDB_CreateAndSaveValue("user", "playername.multiplayer", playername); | ||||
Engine.ConfigDB_CreateAndWriteValueToFile("user", "multiplayerhosting.port", port, "config/user.cfg"); | Engine.ConfigDB_CreateAndSaveValue("user", "multiplayerhosting.port", port); | ||||
let hostFeedback = Engine.GetGUIObjectByName("hostFeedback"); | let hostFeedback = Engine.GetGUIObjectByName("hostFeedback"); | ||||
// Disallow identically named games in the multiplayer lobby | // Disallow identically named games in the multiplayer lobby | ||||
if (Engine.HasXmppClient() && | if (Engine.HasXmppClient() && | ||||
Engine.GetGameList().some(game => game.name == servername)) | Engine.GetGameList().some(game => game.name == servername)) | ||||
{ | { | ||||
cancelSetup(); | cancelSetup(); | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | function startJoin(playername, ip, port) | ||||
startConnectionStatus("client"); | startConnectionStatus("client"); | ||||
// Future-proofing: there could be an XMPP client even if we join a game directly. | // Future-proofing: there could be an XMPP client even if we join a game directly. | ||||
if (Engine.HasXmppClient()) | if (Engine.HasXmppClient()) | ||||
Engine.LobbySetPlayerPresence("playing"); | Engine.LobbySetPlayerPresence("playing"); | ||||
// Only save the player name and host address if they're valid. | // Only save the player name and host address if they're valid. | ||||
Engine.ConfigDB_CreateAndWriteValueToFile("user", "playername.multiplayer", playername, "config/user.cfg"); | Engine.ConfigDB_CreateAndSaveValue("user", "playername.multiplayer", playername); | ||||
Engine.ConfigDB_CreateAndWriteValueToFile("user", "multiplayerserver", ip, "config/user.cfg"); | Engine.ConfigDB_CreateAndSaveValue("user", "multiplayerserver", ip); | ||||
Engine.ConfigDB_CreateAndWriteValueToFile("user", "multiplayerjoining.port", port, "config/user.cfg"); | Engine.ConfigDB_CreateAndSaveValue("user", "multiplayerjoining.port", port); | ||||
return true; | return true; | ||||
} | } | ||||
/** | /** | ||||
* Connect via the lobby. | * Connect via the lobby. | ||||
*/ | */ | ||||
function startJoinFromLobby(playername, hostJID, password) | function startJoinFromLobby(playername, hostJID, password) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator