Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/prelobby/login/login.js
function init() | var g_RdbLobby; | ||||
var g_ConfigPrefix; | |||||
var g_RdbHandle; | |||||
function init(attribs) | |||||
{ | { | ||||
if (attribs.rdbLobby) | |||||
Engine.GetGUIObjectByName("windowLabel").caption = translate("Connect to the replay database"); | |||||
g_RdbLobby = attribs.rdbLobby; | |||||
g_ConfigPrefix = g_RdbLobby ? "rdb" : "lobby"; | |||||
if (g_RdbLobby) { | |||||
g_RdbHandle = Engine.RdbGetHandle(); | |||||
} | |||||
g_LobbyMessages.connected = onLogin; | g_LobbyMessages.connected = onLogin; | ||||
Engine.GetGUIObjectByName("continue").caption = translate("Connect"); | Engine.GetGUIObjectByName("continue").caption = translate("Connect"); | ||||
// Shorten the displayed password for visual reasons only | // Shorten the displayed password for visual reasons only | ||||
Engine.GetGUIObjectByName("username").caption = Engine.ConfigDB_GetValue("user", "lobby.login"); | Engine.GetGUIObjectByName("username").caption = Engine.ConfigDB_GetValue("user", g_ConfigPrefix + ".login"); | ||||
Engine.GetGUIObjectByName("password").caption = Engine.ConfigDB_GetValue("user", "lobby.password").substr(0, 10); | Engine.GetGUIObjectByName("password").caption = Engine.ConfigDB_GetValue("user", g_ConfigPrefix + ".password").substr(0, 10); | ||||
initLobbyTerms(); | initLobbyTerms(); | ||||
Context not available. | |||||
{ | { | ||||
setFeedback(translate("Connecting…")); | setFeedback(translate("Connecting…")); | ||||
Engine.StartXmppClient( | if (g_RdbLobby) { | ||||
Engine.GetGUIObjectByName("username").caption, | if (Engine.RdbHasClient()) | ||||
getEncryptedPassword(), | Engine.RdbStopClient(); | ||||
Engine.ConfigDB_GetValue("user", "lobby.room"), | Engine.RdbStartClient(g_RdbHandle, Engine.GetGUIObjectByName("username").caption, getEncryptedPassword()); | ||||
Engine.GetGUIObjectByName("username").caption, | } else { | ||||
+Engine.ConfigDB_GetValue("user", "lobby.history")); | Engine.StartXmppClient( | ||||
Engine.GetGUIObjectByName("username").caption, | |||||
getEncryptedPassword(), | |||||
Engine.ConfigDB_GetValue("user", "lobby.room"), | |||||
Engine.GetGUIObjectByName("username").caption, | |||||
+Engine.ConfigDB_GetValue("user", "lobby.history")); | |||||
Engine.ConnectXmppClient(); | Engine.ConnectXmppClient(); | ||||
} | |||||
} | } | ||||
function onLogin(message) | function onLogin(message) | ||||
{ | { | ||||
saveCredentials(); | saveCredentials(); | ||||
Engine.SwitchGuiPage("page_lobby.xml", { | Engine.SwitchGuiPage("page_" + g_ConfigPrefix + ".xml", { | ||||
"dialog": false | "dialog": false | ||||
}); | }); | ||||
} | } | ||||
Context not available. |
Wildfire Games · Phabricator