diff --git a/scripts/client/gui/changepass.js b/scripts/client/gui/changepass.js index 2927eea1..39476dfd 100644 --- a/scripts/client/gui/changepass.js +++ b/scripts/client/gui/changepass.js @@ -133,16 +133,17 @@ function checkChangePassword() { // =========================================================================== -function showChangePasswordGUI() { +function showChangePasswordGUI(errorMessage) { logToConsole(LOG_DEBUG, `[VRR.GUI] Showing change password window`); closeAllWindows(); setChatWindowEnabled(false); mexui.setInput(true); passwordChange.window.shown = true; + passwordChange.messageLabel = errorMessage; mexui.focusedControl = passwordChange.passwordInput; guiSubmitKey = checkChangePassword; - showLocaleChooserGUI(); + showLocaleChooserGUI(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), passwordChange.window.position.y+passwordChange.window.size.y+20)); } // =========================================================================== diff --git a/scripts/client/gui/charselect.js b/scripts/client/gui/charselect.js index d4b8f7ca..434e3a91 100644 --- a/scripts/client/gui/charselect.js +++ b/scripts/client/gui/charselect.js @@ -171,7 +171,7 @@ function showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, ski guiLeftKey = selectPreviousCharacter; guiRightKey = selectNextCharacter; - showLocaleChooserGUI(); + showLocaleChooserGUI(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), characterSelect.window.position.y+characterSelect.window.size.y+20)); } // =========================================================================== diff --git a/scripts/client/gui/localechooser.js b/scripts/client/gui/localechooser.js index 3552bcdc..e0bdf063 100644 --- a/scripts/client/gui/localechooser.js +++ b/scripts/client/gui/localechooser.js @@ -52,8 +52,8 @@ function closeLocaleChooserGUI() { // =========================================================================== -function showLocaleChooserGUI(position = toVector2(0, 0)) { - if(position.x != 0 && position.y != 0) { +function showLocaleChooserGUI(position = toVector2(0.0, 0.0)) { + if(position.x != 0.0 && position.y != 0.0) { localeChooser.window.position = position; } else { localeChooser.window.position = toVector2((getScreenWidth()/2)-(localeChooser.window.size.x/2), getScreenHeight()-100); diff --git a/scripts/client/gui/login.js b/scripts/client/gui/login.js index 98994b71..e33ef2c2 100644 --- a/scripts/client/gui/login.js +++ b/scripts/client/gui/login.js @@ -43,7 +43,7 @@ let loginHTML = function initLoginGUI() { logToConsole(LOG_DEBUG, `[VRR.GUI] Creating login GUI ...`); - login.window = mexui.window(game.width/2-150, game.height/2-135, 300, 275, 'LOGIN', { + login.window = mexui.window(getScreenWidth()/2-150, getScreenHeight()/2-135, 300, 275, 'LOGIN', { main: { backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha), transitionTime: 500, @@ -118,7 +118,7 @@ function initLoginGUI() { }, }, checkLogin); - login.forgotPasswordButton = login.window.button(200, 240, 80, 15, 'RESET PASS', { + login.forgotPasswordButton = login.window.button(180, 240, 100, 15, 'RESET PASS', { main: { backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha), textColour: toColour(0, 0, 0, 255), @@ -131,7 +131,7 @@ function initLoginGUI() { }, }, switchToPasswordResetGUI); - login.resetPasswordLabel = login.window.text(125, 240, 60, 15, 'Forgot your password?', { + login.resetPasswordLabel = login.window.text(110, 240, 60, 15, 'Forgot your password?', { main: { textSize: 8.0, textAlign: 1.0, @@ -157,7 +157,7 @@ function showLoginGUI() { mexui.focusedControl = login.passwordInput; guiSubmitKey = checkLogin; - showLocaleChooserGUI(); + showLocaleChooserGUI(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), login.window.position.y+login.window.size.y+20)); //showSmallGameMessage(`If you don't have a mouse cursor, press ${toUpperCase(getKeyNameFromId(disableGUIKey))} to disable GUI`, COLOUR_WHITE, 7500); } diff --git a/scripts/client/gui/newchar.js b/scripts/client/gui/newchar.js index e823e495..5a13504a 100644 --- a/scripts/client/gui/newchar.js +++ b/scripts/client/gui/newchar.js @@ -20,7 +20,7 @@ let newCharacter = { function initNewCharacterGUI() { logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`); - newCharacter.window = mexui.window(game.width/2-130, game.height/2-115, 300, 230, 'NEW CHARACTER', { + newCharacter.window = mexui.window(getScreenWidth()/2-130, getScreenHeight()/2-115, 300, 230, 'NEW CHARACTER', { main: { backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha), transitionTime: 500, @@ -158,9 +158,9 @@ function showNewCharacterGUI() { mexui.setInput(true); newCharacter.window.shown = true; mexui.focusedInput = newCharacter.firstNameInput; - guiSubmitButton = checkNewCharacter; + guiSubmitKey = checkNewCharacter; - showLocaleChooserGUI(); + showLocaleChooserGUI(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), newCharacter.window.position.y+newCharacter.window.size.y+20)); } // =========================================================================== \ No newline at end of file diff --git a/scripts/client/gui/register.js b/scripts/client/gui/register.js index ffa20936..110e39e4 100644 --- a/scripts/client/gui/register.js +++ b/scripts/client/gui/register.js @@ -21,7 +21,7 @@ let register = { function initRegisterGUI() { logToConsole(LOG_DEBUG, `[VRR.GUI] Creating register GUI ...`); - register.window = mexui.window(game.width/2-150, game.height/2-150, 300, 300, 'Register', { + register.window = mexui.window(getScreenWidth()/2-150, getScreenHeight()/2-150, 300, 300, 'Register', { main: { backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha), transitionTime: 500, @@ -162,7 +162,7 @@ function showRegistrationGUI() { mexui.focusedControl = register.passwordInput; guiSubmitKey = checkRegistration; - showLocaleChooserGUI(); + showLocaleChooserGUI(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), register.window.position.y+register.window.size.y+20)); //showSmallGameMessage(`If you don't have a mouse cursor, press ${toUpperCase(getKeyNameFromId(disableGUIKey))} to disable GUI`, COLOUR_WHITE, 7500); } diff --git a/scripts/client/gui/resetpass.js b/scripts/client/gui/resetpass.js index 4f74645b..f81eafc4 100644 --- a/scripts/client/gui/resetpass.js +++ b/scripts/client/gui/resetpass.js @@ -21,7 +21,7 @@ let passwordReset = { function initResetPasswordGUI() { logToConsole(LOG_DEBUG, `[VRR.GUI] Creating password reset GUI ...`); - passwordReset.window = mexui.window(game.width/2-150, game.height/2-130, 300, 260, 'RESET PASSWORD', { + passwordReset.window = mexui.window(getScreenWidth()/2-150, getScreenHeight()/2-135, 300, 275, 'RESET PASSWORD', { main: { backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha), transitionTime: 500, @@ -42,7 +42,7 @@ function initResetPasswordGUI() { passwordReset.window.titleBarHeight = 0; passwordReset.window.titleBarShown = false; - passwordReset.logoImage = passwordReset.window.image(5, 20, 290, 80, mainLogoPath, { + passwordReset.logoImage = passwordReset.window.image(100, 20, 100, 100, mainLogoPath, { focused: { borderColour: toColour(0, 0, 0, 0), }, @@ -82,7 +82,7 @@ function initResetPasswordGUI() { }); passwordReset.emailInput.placeholder = "Email"; - passwordReset.resetPasswordButton = passwordReset.window.button(20, 205, 260, 30, 'RESET PASSWORD', { + passwordReset.resetPasswordButton = passwordReset.window.button(180, 240, 100, 15, 'RESET PASSWORD', { main: { backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha), textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255), @@ -108,7 +108,7 @@ function initResetPasswordGUI() { }, }, switchToLoginGUI); - passwordReset.backToLoginLabel = passwordReset.window.text(125, 240, 60, 15, 'Remember your password?', { + passwordReset.backToLoginLabel = passwordReset.window.text(110, 240, 60, 15, 'Remember your password?', { main: { textSize: 8.0, textAlign: 1.0, @@ -132,9 +132,9 @@ function showResetPasswordGUI() { mexui.setInput(true); passwordReset.window.shown = true; mexui.focusedControl = passwordReset.emailInput; - guiSubmitButton = checkResetPassword; + guiSubmitKey = checkResetPassword; - showLocaleChooserGUI(); + showLocaleChooserGUI(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), passwordReset.window.position.y+passwordReset.window.size.y+20)); //showSmallGameMessage(`If you don't have a mouse cursor, press ${toUpperCase(getKeyNameFromId(disableGUIKey))} to disable GUI`, COLOUR_WHITE, 7500); } @@ -157,15 +157,31 @@ function resetPasswordFailed(errorMessage) { // =========================================================================== function resetPasswordCodeInputGUI() { - logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports password reset was successful`); - - passwordReset.messageLabel.text = "Check your email for a verification code"; - passwordReset.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255); - passwordReset.emailInput.text = ""; - passwordReset.emailInput.placeholder = "Verification Code"; - - guiSubmitButton = checkResetPassword; + logToConsole(LOG_DEBUG|LOG_WARN, `[VRR.GUI] Server reports password reset email confirmation was successful. Asking for code ...`); closeAllWindows(); + + passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordCodeInputLabel"); + //passwordReset.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255); + passwordReset.emailInput.text = ""; + passwordReset.emailInput.placeholder = getLocaleString("GUIResetPasswordCodePlaceholder"); + + guiSubmitKey = checkResetPassword; + showResetPasswordGUI(); +} + +// =========================================================================== + +function resetPasswordEmailInputGUI() { + logToConsole(LOG_DEBUG|LOG_WARN, `[VRR.GUI] Server reports password reset request was approved. Asking for email ...`); + closeAllWindows(); + + passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordConfirmEmailLabel"); + //passwordReset.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255); + passwordReset.emailInput.text = ""; + passwordReset.emailInput.placeholder = getLocaleString("GUIResetPasswordEmailPlaceholder"); + + guiSubmitKey = checkResetPassword; + showResetPasswordGUI(); } // ===========================================================================