diff --git a/binaries/data/mods/public/gui/common/modern/sprites.xml b/binaries/data/mods/public/gui/common/modern/sprites.xml
index 3773a2e6e6..61185d923e 100644
--- a/binaries/data/mods/public/gui/common/modern/sprites.xml
+++ b/binaries/data/mods/public/gui/common/modern/sprites.xml
@@ -141,15 +141,15 @@
@@ -433,35 +433,35 @@
/>
-
-
-
-
-
-
diff --git a/binaries/data/mods/public/gui/lobby/prelobby.js b/binaries/data/mods/public/gui/lobby/prelobby.js
index 308098a8a1..7767e92f9d 100644
--- a/binaries/data/mods/public/gui/lobby/prelobby.js
+++ b/binaries/data/mods/public/gui/lobby/prelobby.js
@@ -1,10 +1,15 @@
var g_LobbyIsConnecting = false;
var g_EncrytedPassword = "";
var g_PasswordInputIsHidden = false;
+var g_TermsOfServiceRead = false;
+var g_TermsOfUseRead = false;
+var g_hasSystemMessage = false;
function init()
{
g_EncrytedPassword = Engine.ConfigDB_GetValue("user", "lobby.password");
+ if (Engine.ConfigDB_GetValue("user", "lobby.login") && g_EncrytedPassword)
+ switchPage("connect");
}
function lobbyStop()
@@ -18,7 +23,7 @@ function lobbyStop()
Engine.StopXmppClient();
}
-function lobbyStart()
+function lobbyStartConnect()
{
if (g_LobbyIsConnecting)
return;
@@ -44,27 +49,16 @@ function lobbyStart()
function lobbyStartRegister()
{
- if (g_LobbyIsConnecting != false)
+ if (g_LobbyIsConnecting)
return;
if (Engine.HasXmppClient())
Engine.StopXmppClient();
- var account = Engine.GetGUIObjectByName("connectUsername").caption;
- var password = Engine.GetGUIObjectByName("connectPassword").caption;
- var passwordAgain = Engine.GetGUIObjectByName("registerPasswordAgain").caption;
+ var account = Engine.GetGUIObjectByName("registerUsername").caption;
+ var password = Engine.GetGUIObjectByName("registerPassword").caption;
var feedback = Engine.GetGUIObjectByName("feedback");
- // Check the passwords match.
- if (password != passwordAgain)
- {
- feedback.caption = translate("Passwords do not match");
- Engine.GetGUIObjectByName("connectPassword").caption = "";
- Engine.GetGUIObjectByName("registerPasswordAgain").caption = "";
- switchRegister();
- return;
- }
-
feedback.caption = translate("Registering...");
g_EncrytedPassword = Engine.EncryptPassword(password, account);
Engine.StartRegisterXmppClient(account, g_EncrytedPassword);
@@ -72,64 +66,94 @@ function lobbyStartRegister()
Engine.ConnectXmppClient();
}
-function switchRegister()
+function onTick()
{
- if (Engine.GetGUIObjectByName("pageRegister").hidden)
+ var pageRegisterHidden = Engine.GetGUIObjectByName("pageRegister").hidden;
+ if (pageRegisterHidden)
{
- lobbyStop();
- Engine.GetGUIObjectByName("pageRegister").hidden = false;
- Engine.GetGUIObjectByName("pageConnect").hidden = true;
- Engine.GetGUIObjectByName("connect").enabled = false;
+ var username = Engine.GetGUIObjectByName("connectUsername").caption;
+ var password = Engine.GetGUIObjectByName("connectPassword").caption;
}
else
{
- Engine.GetGUIObjectByName("pageRegister").hidden = true;
- Engine.GetGUIObjectByName("pageConnect").hidden = false;
- Engine.GetGUIObjectByName("connect").enabled = true;
+ var username = Engine.GetGUIObjectByName("registerUsername").caption;
+ var password = Engine.GetGUIObjectByName("registerPassword").caption;
}
-}
-
-function onTick()
-{
- //
- var username = Engine.GetGUIObjectByName("connectUsername").caption;
- var password = Engine.GetGUIObjectByName("connectPassword").caption;
var passwordAgain = Engine.GetGUIObjectByName("registerPasswordAgain").caption;
+ var agreeTerms = Engine.GetGUIObjectByName("registerAgreeTerms");
var feedback = Engine.GetGUIObjectByName("feedback");
- var pageRegisterHidden = Engine.GetGUIObjectByName("pageRegister").hidden;
- var connectButton = Engine.GetGUIObjectByName("connect");
- var registerButton = Engine.GetGUIObjectByName("register");
- var sanitizedName = sanitizePlayerName(username, true, true)
- // If there aren't a username and password entered, we can't start registration or connection.
- if (!username || !password)
+ var continueButton = Engine.GetGUIObjectByName("continue");
+ var sanitizedName = sanitizePlayerName(username, true, true);
+
+ // Do not change feedback while connecting.
+ if (g_LobbyIsConnecting) {}
+ // Do not show feedback on the welcome screen.
+ else if (!Engine.GetGUIObjectByName("pageWelcome").hidden)
{
- connectButton.enabled = false;
- registerButton.enabled = false;
- if (!username && !password)
- feedback.caption = translate("Please enter existing login or desired registration credentials.");
+ feedback.caption = "";
}
- // Check they are using a valid account name.
+ // Check that they entered a username.
+ else if (!username)
+ {
+ continueButton.enabled = false;
+ feedback.caption = translate("Please enter your username");
+ }
+ // Check that they are using a valid username.
else if (username != sanitizedName)
{
- feedback.caption = translate("Usernames can't contain [, ], unicode, whitespace, or commas.");
- connectButton.enabled = false;
- registerButton.enabled = false;
+ continueButton.enabled = false;
+ feedback.caption = translate("Usernames can't contain [, ], unicode, whitespace, or commas");
}
- // Allow them to connect/begin registation if there aren't any problems.
+ // Check that they entered a password.
+ else if (!password)
+ {
+ continueButton.enabled = false;
+ feedback.caption = translate("Please enter your password");
+ }
+ // Allow them to connect if tests pass up to this point.
else if (pageRegisterHidden)
{
- // TODO Do this without comparing the caption
- if (feedback.caption == translate("Usernames can't contain [, ], unicode, whitespace, or commas.") ||
- feedback.caption == translate("Please enter existing login or desired registration credentials."))
+ if (!g_hasSystemMessage)
feedback.caption = "";
- connectButton.enabled = true;
- registerButton.enabled = true;
+ continueButton.enabled = true;
+ }
+ // Check that they entered their password again.
+ else if (!passwordAgain)
+ {
+ continueButton.enabled = false;
+ feedback.caption = translate("Please enter your password again");
+ }
+ // Check that the passwords match.
+ else if (passwordAgain != password)
+ {
+ continueButton.enabled = false;
+ feedback.caption = translate("Passwords do not match");
+ }
+ // Check that they read the Terms of Service.
+ else if (!g_TermsOfServiceRead)
+ {
+ continueButton.enabled = false;
+ feedback.caption = translate("Please read the Terms of Service");
+ }
+ // Check that they read the Terms of Use.
+ else if (!g_TermsOfUseRead)
+ {
+ continueButton.enabled = false;
+ feedback.caption = translate("Please read the Terms of Use");
+ }
+ // Check that they agree to the terms of service and use.
+ else if (!agreeTerms.checked)
+ {
+ continueButton.enabled = false;
+ feedback.caption = translate("Please agree to the Terms of Service and Terms of Use");
+ }
+ // Allow them to register.
+ else
+ {
+ if (!g_hasSystemMessage)
+ feedback.caption = "";
+ continueButton.enabled = true;
}
- // If the password hasn't been entered again, we can't complete registation.
- if (!pageRegisterHidden && !passwordAgain)
- registerButton.enabled = false;
- else if (!pageRegisterHidden)
- registerButton.enabled = true;
if (!g_LobbyIsConnecting)
// The Xmpp Client has not been created
@@ -171,13 +195,62 @@ function onTick()
feedback.caption = toTitleCase(message.text);
Engine.StopXmppClient();
g_LobbyIsConnecting = false;
- switchRegister();
+ Engine.GetGUIObjectByName("connectUsername").caption = username;
+ Engine.GetGUIObjectByName("connectPassword").caption = password;
+ switchPage("connect");
}
else if(message.type == "system" && (message.level == "error" || message.text == "disconnected"))
{
+ g_hasSystemMessage = true;
feedback.caption = toTitleCase(message.text);
Engine.StopXmppClient();
g_LobbyIsConnecting = false;
}
}
}
+
+function switchPage(page)
+{
+ // First hide everything.
+ if (!Engine.GetGUIObjectByName("pageWelcome").hidden)
+ {
+ Engine.GetGUIObjectByName("pageWelcome").hidden = true;
+ }
+ else if (!Engine.GetGUIObjectByName("pageRegister").hidden)
+ {
+ Engine.GetGUIObjectByName("pageRegister").hidden = true;
+ Engine.GetGUIObjectByName("continue").hidden = true;
+ var dialog = Engine.GetGUIObjectByName("dialog");
+ var newSize = dialog.size;
+ newSize.bottom -= 150;
+ dialog.size = newSize;
+ }
+ else if (!Engine.GetGUIObjectByName("pageConnect").hidden)
+ {
+ Engine.GetGUIObjectByName("pageConnect").hidden = true;
+ Engine.GetGUIObjectByName("continue").hidden = true;
+ }
+
+ // Then show appropriate page.
+ switch(page)
+ {
+ case "welcome":
+ Engine.GetGUIObjectByName("pageWelcome").hidden = false;
+ break;
+ case "register":
+ var dialog = Engine.GetGUIObjectByName("dialog");
+ var newSize = dialog.size;
+ newSize.bottom += 150;
+ dialog.size = newSize;
+ Engine.GetGUIObjectByName("pageRegister").hidden = false;
+ Engine.GetGUIObjectByName("continue").caption = translate("Register");
+ Engine.GetGUIObjectByName("continue").hidden = false;
+ break;
+ case "connect":
+ Engine.GetGUIObjectByName("pageConnect").hidden = false;
+ Engine.GetGUIObjectByName("continue").caption = translate("Connect");
+ Engine.GetGUIObjectByName("continue").hidden = false;
+ break;
+ }
+}
+
diff --git a/binaries/data/mods/public/gui/lobby/prelobby.xml b/binaries/data/mods/public/gui/lobby/prelobby.xml
index d92be59c56..c40e109be8 100644
--- a/binaries/data/mods/public/gui/lobby/prelobby.xml
+++ b/binaries/data/mods/public/gui/lobby/prelobby.xml
@@ -24,7 +24,17 @@
Multiplayer Lobby
-
+
Registration
-
+
+
+ Login:
+
+
+
+
+ Password:
+
+
+
+
Password again:
-
+
+
+
+ Terms of Service
- lobbyStartRegister()
+ g_TermsOfServiceRead = true;
+ Engine.PushGuiPage("page_manual.xml", {"page":"lobby/Terms_of_Service", "title":"Terms of Service"})
+
+
+ Terms of Use
+
+ g_TermsOfUseRead = true;
+ Engine.PushGuiPage("page_manual.xml", {"page":"lobby/Terms_of_Use", "title":"Terms of Use"})
+
+
+
+
+ I have read and agree to the Terms of Service and Terms of Use:
+
+
+
+
+
-
-
+
+
Cancel
- if (Engine.GetGUIObjectByName("pageRegister").hidden)
+ if (Engine.GetGUIObjectByName("pageWelcome").hidden)
+ switchPage("welcome");
+ else
{
lobbyStop();
Engine.PopGuiPage();
}
- else
- switchRegister();
-
- Register
-
- if (Engine.GetGUIObjectByName("pageRegister").hidden)
- {
- switchRegister();
- }
- else
- lobbyStartRegister()
-
-
-
+
Connect
- lobbyStart();
+ if (!Engine.GetGUIObjectByName("pageConnect").hidden)
+ lobbyStartConnect();
+ else if (!Engine.GetGUIObjectByName("pageRegister").hidden)
+ lobbyStartRegister();
diff --git a/binaries/data/mods/public/gui/manual/manual.js b/binaries/data/mods/public/gui/manual/manual.js
index 958d042807..ecdbd53827 100644
--- a/binaries/data/mods/public/gui/manual/manual.js
+++ b/binaries/data/mods/public/gui/manual/manual.js
@@ -2,9 +2,22 @@ var hasCallback = false;
function init(data)
{
- Engine.GetGUIObjectByName("mainText").caption = Engine.TranslateLines(Engine.ReadFile("gui/manual/" + data.page + ".txt"));
+ Engine.GetGUIObjectByName("mainText").caption = Engine.TranslateLines(Engine.ReadFile("gui/" + data.page + ".txt"));
if (data.callback)
hasCallback = true;
+ if (data.title)
+ Engine.GetGUIObjectByName("title").caption = data.title;
+ if (data.url)
+ {
+ var urlButton = Engine.GetGUIObjectByName("url");
+ var callback = function(url)
+ {
+ return function()
+ openURL(url);
+ }(data.url)
+ urlButton.onPress = callback;
+ urlButton.hidden = false;
+ }
}
function closeManual()
diff --git a/binaries/data/mods/public/gui/manual/manual.xml b/binaries/data/mods/public/gui/manual/manual.xml
index e3f53eabef..f1fece3c0b 100644
--- a/binaries/data/mods/public/gui/manual/manual.xml
+++ b/binaries/data/mods/public/gui/manual/manual.xml
@@ -8,19 +8,16 @@
-
- Manual
+
+ Information
-
- Online Manual
-
+
+ View Online
Close
diff --git a/binaries/data/mods/public/gui/pregame/mainmenu.xml b/binaries/data/mods/public/gui/pregame/mainmenu.xml
index b6fb75e6b8..1c59d82aa3 100644
--- a/binaries/data/mods/public/gui/pregame/mainmenu.xml
+++ b/binaries/data/mods/public/gui/pregame/mainmenu.xml
@@ -106,7 +106,7 @@
Technical details
- Engine.PushGuiPage("page_manual.xml", { "page": "userreport" });
+ Engine.PushGuiPage("page_manual.xml", {"page":"manual/userreport", "title":translate("Technical Details")});
@@ -137,7 +137,7 @@
Technical details
- Engine.PushGuiPage("page_manual.xml", { "page": "userreport" });
+ Engine.PushGuiPage("page_manual.xml", {"page":"manual/userreport", "title":translate("Technical Details")});
@@ -398,7 +398,7 @@
closeMenu();
@@ -561,7 +561,7 @@
>
-
diff --git a/binaries/data/mods/public/gui/session/menu.js b/binaries/data/mods/public/gui/session/menu.js
index 1cbcf9d491..a527257a1c 100644
--- a/binaries/data/mods/public/gui/session/menu.js
+++ b/binaries/data/mods/public/gui/session/menu.js
@@ -660,7 +660,7 @@ function openManual()
closeMenu();
closeOpenDialogs();
pauseGame();
- Engine.PushGuiPage("page_manual.xml", {"page": "intro", "callback": "resumeGame"});
+ Engine.PushGuiPage("page_manual.xml", {"page": "intro", "title":translate("Manual"), "url":"http://trac.wildfiregames.com/wiki/0adManual", "callback": "resumeGame"});
}
function toggleDeveloperOverlay()