Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup_mp/gamesetup_mp.js
Show First 20 Lines • Show All 278 Lines • ▼ Show 20 Lines | function switchSetupPage(newPage) | ||||
Engine.GetGUIObjectByName("continueButton").hidden = newPage == "pageConnecting"; | Engine.GetGUIObjectByName("continueButton").hidden = newPage == "pageConnecting"; | ||||
} | } | ||||
function startHost(playername, servername, port) | function startHost(playername, servername, port) | ||||
{ | { | ||||
startConnectionStatus("server"); | startConnectionStatus("server"); | ||||
saveSettingAndWriteToUserConfig("playername.multiplayer", playername); | Engine.ConfigDB_CreateAndWriteValueToFile("user", "playername.multiplayer", playername); | ||||
saveSettingAndWriteToUserConfig("multiplayerhosting.port", port); | Engine.ConfigDB_CreateAndWriteValueToFile("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 58 Lines • ▼ Show 20 Lines | function startJoin(playername, ip, port, useSTUN, hostJID = "") | ||||
startConnectionStatus("client"); | startConnectionStatus("client"); | ||||
if (Engine.HasXmppClient()) | if (Engine.HasXmppClient()) | ||||
Engine.LobbySetPlayerPresence("playing"); | Engine.LobbySetPlayerPresence("playing"); | ||||
else | else | ||||
{ | { | ||||
// Only save the player name and host address if they're valid and we're not in the lobby | // Only save the player name and host address if they're valid and we're not in the lobby | ||||
saveSettingAndWriteToUserConfig("playername.multiplayer", playername); | Engine.ConfigDB_CreateAndWriteValueToFile("user", "playername.multiplayer", playername); | ||||
saveSettingAndWriteToUserConfig("multiplayerserver", ip); | Engine.ConfigDB_CreateAndWriteValueToFile("user", "multiplayerserver", ip); | ||||
saveSettingAndWriteToUserConfig("multiplayerjoining.port", port); | Engine.ConfigDB_CreateAndWriteValueToFile("user", "multiplayerjoining.port", port); | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
function getDefaultGameName() | function getDefaultGameName() | ||||
{ | { | ||||
return sprintf(translate("%(playername)s's game"), { | return sprintf(translate("%(playername)s's game"), { | ||||
"playername": multiplayerName() | "playername": multiplayerName() | ||||
}); | }); | ||||
} | } |
Wildfire Games · Phabricator