Move GUI stuff to GUI resource

This commit is contained in:
Vortrex
2022-06-14 07:31:41 -05:00
parent f14c51dba4
commit 93ead8d123
20 changed files with 0 additions and 2120 deletions

View File

@@ -1,283 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: gui.js
// DESC: Provides GUI functionality and styles (using MexUI)
// TYPE: Client (JavaScript)
// ===========================================================================
var app = {};
let mainFont = "Roboto"; // "Arial"
//let mainLogoPath = (typeof gta == "undefined") ? "files/images/mafiac-logo.png" : "files/images/gtac-logo.png";
let mainLogoPath = "files/images/asshat-logo.png";
let primaryColour = [200, 200, 200];
let secondaryColour = [16, 16, 16];
let primaryTextColour = [0, 0, 0];
let focusedColour = [200, 200, 200];
let invalidValueColour = [200, 200, 200];
let focusedColourOffset = 50;
let windowAlpha = 200;
let windowTitleAlpha = 180;
let buttonAlpha = 180;
let textInputAlpha = 180;
let guiReady = false;
// ===========================================================================
let characterData = [];
let currentCharacter = 0;
let inCharacterSelectScreen = false;
let creatingCharacter = false;
// ===========================================================================
function initGUIScript() {
logToConsole(LOG_DEBUG, "[VRR.GUI]: Initializing GUI script ...");
logToConsole(LOG_DEBUG, "[VRR.GUI]: GUI script initialized!");
}
// ===========================================================================
function initGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Initializing GUI ...`);
initLoginGUI();
initRegisterGUI();
initNewCharacterGUI();
initCharacterSelectGUI();
initInfoDialogGUI();
initErrorDialogGUI();
initYesNoDialogGUI();
initTwoFactorAuthenticationGUI();
initListGUI();
initResetPasswordGUI();
initChangePasswordGUI();
initLocaleChooserGUI();
closeAllWindows();
guiReady = true;
logToConsole(LOG_DEBUG, `[VRR.GUI] All GUI created successfully!`);
loadLocaleConfig();
loadAllLocaleStrings();
resetGUIStrings();
resetLocaleChooserOptions();
sendNetworkEventToServer("vrr.guiReady", true);
};
// ===========================================================================
function closeAllWindows() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Closing all GUI windows`);
infoDialog.window.shown = false;
yesNoDialog.window.shown = false;
errorDialog.window.shown = false;
register.window.shown = false;
login.window.shown = false;
newCharacter.window.shown = false;
characterSelect.window.shown = false;
twoFactorAuth.window.shown = false;
listDialog.window.shown = false;
passwordReset.window.shown = false;
passwordChange.window.shown = false;
localeChooser.window.shown = false;
mexui.setInput(false);
mexui.focusedControl = false;
guiSubmitKey = false;
guiLeftKey = false;
guiRightKey = false;
guiUpKey = false;
guiDownKey = false;
setChatWindowEnabled(true);
}
// ===========================================================================
function isAnyGUIActive() {
if (!guiReady) {
return false;
}
if (infoDialog.window.shown == true) {
return true;
}
if (yesNoDialog.window.shown == true) {
return true;
}
if (errorDialog.window.shown == true) {
return true;
}
if (register.window.shown == true) {
return true;
}
if (login.window.shown == true) {
return true;
}
if (newCharacter.window.shown == true) {
return true;
}
if (characterSelect.window.shown == true) {
return true;
}
if (twoFactorAuth.window.shown == true) {
return true;
}
if (listDialog.window.shown == true) {
return true;
}
if (passwordReset.window.shown == true) {
return true;
}
if (passwordChange.window.shown == true) {
return true;
}
if (localeChooser.window.shown == true) {
return true;
}
return false;
}
// ===========================================================================
function setGUIColours(red1, green1, blue1, red2, green2, blue2, red3, green3, blue3) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received new GUI colours from server: ${red1}, ${green1}, ${blue1} / ${red2}, ${green2}, ${blue2} / ${red3}, ${green3}, ${blue3}`);
primaryColour = [red1, green1, blue1];
secondaryColour = [red2, green2, blue2];
primaryTextColour = [red3, green3, blue3];
focusedColour = [red1 + focusedColourOffset, green1 + focusedColourOffset, blue1 + focusedColourOffset];
initGUI();
}
// ===========================================================================
function hideAllGUI() {
closeAllWindows();
setChatWindowEnabled(true);
guiSubmitKey = false;
}
// ===========================================================================
function processGUIKeyPress(keyCode) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Processing key press: ${keyCode}`);
if (!isAnyGUIActive()) {
logToConsole(LOG_DEBUG, `[VRR.GUI] GUI is not active. Cancelling keypress processing.`);
return false;
}
if (keyCode == SDLK_RETURN || keyCode == SDLK_RETURN2) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Key press is submit (${guiSubmitKey})`);
if (guiSubmitKey != false) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Calling submit key function`);
guiSubmitKey.call();
}
} else if (keyCode == getKeyIdFromParams("left") || keyCode == getKeyIdFromParams("a")) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Key press is left (${guiLeftKey})`);
if (guiLeftKey != false) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Calling left key function`);
guiLeftKey.call();
}
} else if (keyCode == getKeyIdFromParams("right") || keyCode == getKeyIdFromParams("d")) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Key press is right (${guiRightKey})`);
if (guiRightKey != false) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Calling right key function`);
guiRightKey.call();
}
} else if (keyCode == getKeyIdFromParams("down") || keyCode == getKeyIdFromParams("s")) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Key press is down (${guiDownKey})`);
if (guiDownKey != false) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Calling down key function`);
guiDownKey.call();
}
} else if (keyCode == getKeyIdFromParams("up") || keyCode == getKeyIdFromParams("w")) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Key press is up (${guiUpKey})`);
if (guiUpKey != false) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Calling up key function`);
guiUpKey.call();
}
}
}
// ===========================================================================
function processToggleGUIKeyPress(keyCode) {
if (keyCode == disableGUIKey) {
sendNetworkEventToServer("vrr.toggleGUI");
}
}
// ===========================================================================
function resetGUIStrings() {
// Login GUI
login.messageLabel.text = getLocaleString("GUILoginWindowLabelEnterPassword");
login.passwordInput.placeholder = getLocaleString("GUILoginWindowPasswordPlaceholder");
login.loginButton.text = toUpperCase(getLocaleString("GUILoginWindowSubmitButton"));
login.forgotPasswordButton.text = toUpperCase(getLocaleString("GUILoginWindowResetPasswordButton"));
login.resetPasswordLabel.text = getLocaleString("GUILoginWindowForgotPasswordLabel");
// Register GUI
register.messageLabel.text = getLocaleString("GUIRegisterWindowLabelCreateAccount");
register.passwordInput.placeholder = getLocaleString("GUIRegisterWindowPasswordPlaceholder");
register.confirmPasswordInput.placeholder = getLocaleString("GUIRegisterWindowConfirmPasswordPlaceholder");
register.emailInput.placeholder = getLocaleString("GUIRegisterWindowEmailPlaceholder");
register.registerButton.text = toUpperCase(getLocaleString("GUIRegisterWindowSubmitButton"));
// Change Password GUI
passwordChange.window.title = toUpperCase(getLocaleString("GUIChangePasswordWindowTitle"));
passwordChange.messageLabel.text = getLocaleString("GUIChangePasswordPasswordLabel");
passwordChange.passwordInput.placeholder = getLocaleString("GUIChangePasswordPasswordPlaceholder");
passwordChange.confirmPasswordInput.placeholder = getLocaleString("GUIChangePasswordConfirmPasswordPlaceholder");
passwordChange.submitButton.text = toUpperCase(getLocaleString("GUIChangePasswordSubmitButton"));
// Reset Password GUI
passwordReset.messageLabel.text = toUpperCase(getLocaleString("GUIResetPasswordConfirmEmailLabel"));
passwordReset.emailInput.placeholder = getLocaleString("GUIResetPasswordEmailPlaceholder");
passwordReset.resetPasswordButton.text = toUpperCase(getLocaleString("GUIResetPasswordSubmitButton"));
passwordReset.backToLoginButton.text = toUpperCase(getLocaleString("GUIResetPasswordLoginButton"));
passwordReset.backToLoginLabel.text = getLocaleString("GUIResetPasswordRememberMessage");
// Character Selection GUI
characterSelect.window.title = toUpperCase(getLocaleString("GUICharacterSelectWindowTitle"));
characterSelect.cashText.text = getLocaleString("GUICharacterSelectMoneyLabel", "0");
characterSelect.clanText.text = getLocaleString("GUICharacterSelectClanLabel", "None");
characterSelect.lastPlayedText.text = getLocaleString("GUICharacterSelectLastPlayedLabel", "Never");
characterSelect.previousCharacterButton.text = toUpperCase(getLocaleString("GUIPreviousCharacterButton"));
characterSelect.nextCharacterButton.text = toUpperCase(getLocaleString("GUINextCharacterButton"));
characterSelect.selectCharacterButton.text = toUpperCase(getLocaleString("GUIPlayAsCharacterButton"));
characterSelect.newCharacterButton.text = toUpperCase(getLocaleString("GUINewCharacterButton"));
// Character Creation GUI
newCharacter.messageLabel.text = getLocaleString("GUINewCharacterMessageLabel");
newCharacter.firstNameInput.placeholder = getLocaleString("GUINewCharacterFirstNamePlaceholder");
newCharacter.lastNameInput.placeholder = getLocaleString("GUINewCharacterLastNamePlaceholder");
newCharacter.createCharacterButton.text = toUpperCase(getLocaleString("GUINewCharacterSubmitButton"));
}

View File

@@ -1,135 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: 2fa.js
// DESC: Provides two factor authentication GUI
// TYPE: Client (JavaScript)
// ===========================================================================
let twoFactorAuth = {
window: null,
logoImage: null,
qrCode: null,
messageLabel: null,
codeLabel: null,
codeInput: null,
submitButton: null,
};
// ===========================================================================
function initTwoFactorAuthenticationGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating two factor auth GUI ...`);
twoFactorAuth.window = mexui.window(game.width/2-150, game.height/2-129, 300, 258, 'LOGIN', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
},
title: {
textSize: 0.0,
textColour: toColour(0, 0, 0, 0),
},
icon: {
textSize: 0.0,
textColour: toColour(0, 0, 0, 0),
},
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
twoFactorAuth.window.titleBarIconSize = toVector2(0,0);
twoFactorAuth.window.titleBarHeight = 0;
twoFactorAuth.qrCode = twoFactorAuth.window.image(100, 20, 100, 100, mainLogoPath, {
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
twoFactorAuth.codeLabel = twoFactorAuth.window.text(20, 135, 260, 20, 'Please enter the code sent to your email!', {
main: {
textSize: 10.0,
textAlign: 0.5,
textColour: toColour(200, 200, 200, 255),
textFont: mainFont,
},
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
twoFactorAuth.codeInput = twoFactorAuth.window.textInput(20, 170, 260, 25, '', {
main: {
backgroundColour: toColour(0, 0, 0, 120),
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], textInputAlpha),
textColour: toColour(200, 200, 200, 255),
textSize: 10.0,
textFont: mainFont,
},
caret: {
lineColour: toColour(255, 255, 255, 255),
},
placeholder: {
textColour: toColour(200, 200, 200, 150),
textSize: 10.0,
textFont: mainFont,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
},
});
twoFactorAuth.codeInput.placeholder = "Code";
twoFactorAuth.submitButton = twoFactorAuth.window.button(20, 205, 260, 30, 'SUBMIT', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(0, 0, 0, 255),
textSize: 10.0,
textFont: mainFont,
textAlign: 0.5,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
},
}, checkTwoFactorAuth);
logToConsole(LOG_DEBUG, `[VRR.GUI] Created two factor auth GUI`);
}
// ===========================================================================
function showTwoFactorAuthGUI() {
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing two-factor authentication window`);
setChatWindowEnabled(false);
mexui.setInput(true);
twoFactorAuth.window.shown = true;
mexui.focusedControl = twoFactorAuth.codeInput;
guiSubmitKey = checkTwoFactorAuth;
}
// ===========================================================================
function twoFactorAuthFailed(errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports two-factor authentication failed. Reason: ${errorMessage}`);
twoFactorAuth.messageLabel.text = errorMessage;
twoFactorAuth.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
twoFactorAuth.codeInput.text = "";
}
// ===========================================================================
function twoFactorAuthSuccess() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports two-factor authentication was successful`);
closeAllWindows();
}
// ===========================================================================
function checkTwoFactorAuth() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking two-factor authentication with server ...`);
sendNetworkEventToServer("vrr.2fa", twoFactorAuth.codeInput.lines[0]);
}
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: bizmgr.js
// DESC: Provides business manager GUI
// TYPE: Client (JavaScript)
// ===========================================================================

View File

@@ -1,157 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: changepass.js
// DESC: Provides change password GUI
// TYPE: Client (JavaScript)
// ===========================================================================
let passwordChange = {
window: null,
logoImage: null,
messageLabel: null,
passwordInput: null,
confirmPasswordInput: null,
submitButton: null,
};
// ===========================================================================
function initChangePasswordGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating password change GUI ...`);
passwordChange.window = mexui.window(game.width/2-130, game.height/2-125, 300, 250, 'Change Password', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
},
title: {
textSize: 0.0,
textColour: toColour(0, 0, 0, 0),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
},
icon: {
textSize: 0.0,
textColour: toColour(0, 0, 0, 0),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
}
});
passwordChange.window.titleBarIconSize = toVector2(0,0);
passwordChange.window.titleBarHeight = 0;
passwordChange.window.titleBarShown = false;
passwordChange.window.image(85, -10, 140, 140, mainLogoPath, {
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
passwordChange.messageLabel = passwordChange.window.text(20, 75, 260, 20, 'Enter a new password', {
main: {
textSize: 10.0,
textAlign: 0.5,
textColour: toColour(200, 200, 200, 255),
textFont: mainFont,
},
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
passwordChange.passwordInput = passwordChange.window.textInput(20, 130, 260, 25, '', {
main: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 255),
textSize: 10.0,
textFont: mainFont,
},
caret: {
lineColour: toColour(255, 255, 255, 255),
},
placeholder: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 200),
textSize: 10.0,
textFont: mainFont,
}
});
passwordChange.passwordInput.masked = true;
passwordChange.passwordInput.placeholder = "Password";
passwordChange.confirmPasswordInput = passwordChange.window.textInput(20, 160, 260, 25, '', {
main: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 255),
textSize: 10.0,
textFont: mainFont,
},
caret: {
lineColour: toColour(255, 255, 255, 255),
},
placeholder: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 200),
textSize: 10.0,
textFont: mainFont,
}
});
passwordChange.confirmPasswordInput.masked = true;
passwordChange.confirmPasswordInput.placeholder = "Confirm password";
passwordChange.submitButton = passwordChange.window.button(20, 195, 260, 30, 'CHANGE PASSWORD', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(255, 255, 255, 255),
textSize: 12.0,
textFont: mainFont,
textAlign: 0.5,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
},
}, checkChangePassword);
logToConsole(LOG_DEBUG, `[VRR.GUI] Created change password GUI`);
}
// ===========================================================================
function passwordChangeFailed(errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports change password failed. Reason: ${errorMessage}`);
passwordChange.messageLabel.text = errorMessage;
passwordChange.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
passwordChange.passwordInput.text = "";
passwordChange.confirmPasswordInput.text = "";
passwordChange.verificationCodeInput.text = "";
}
// ===========================================================================
function checkChangePassword() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking password change with server ...`);
sendNetworkEventToServer("vrr.checkChangePassword", passwordChange.passwordInput.lines[0], passwordChange.confirmPasswordInput.lines[0]);
}
// ===========================================================================
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(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), passwordChange.window.position.y+passwordChange.window.size.y+20));
}
// ===========================================================================
function passwordChangeSuccess() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports password change was successful`);
guiSubmitKey = false;
closeAllWindows();
}
// ===========================================================================

View File

@@ -1,248 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: charselect.js
// DESC: Provides character select GUI
// TYPE: Client (JavaScript)
// ===========================================================================
let characterSelect = {
window: null,
skinImage: null,
nameText: null,
cashText: null,
clanText: null,
lastPlayedText: null,
previousCharacterButton: null,
nextCharacterButton: null,
selectCharacterButton: null,
newCharacterButton: null,
};
// ===========================================================================
function initCharacterSelectGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating character select GUI ...`);
characterSelect.window = mexui.window(game.width/2-215, game.height/2-83, 430, 190, 'SELECT CHARACTER', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
},
title: {
textSize: 12.0,
textFont: mainFont,
textColour: toColour(0, 0, 0, 255),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
},
icon: {
textSize: 10.0,
textFont: mainFont,
textColour: toColour(0, 0, 0, 255),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
}
});
characterSelect.window.titleBarIconSize = toVector2(0, 0);
characterSelect.window.titleBarIconShown = false;
characterSelect.window.titleBarHeight = 30;
characterSelect.nameText = characterSelect.window.text(5, 40, 200, 25, 'Lastname, Firstname', {
main: {
textSize: 14.0,
textAlign: 0.0,
textColour: toColour(255, 255, 255, 220),
textFont: mainFont,
},
focused: {
borderColour: toColour(0, 0, 0, 0),
}
});
characterSelect.cashText = characterSelect.window.text(5, 65, 200, 25, 'Cash: $0', {
main: {
textSize: 9.0,
textAlign: 0.0,
textColour: toColour(255, 255, 255, 220),
textFont: mainFont,
},
focused: {
borderColour: toColour(0, 0, 0, 0),
}
});
characterSelect.clanText = characterSelect.window.text(5, 80, 200, 25, 'Clan: None', {
main: {
textSize: 9.0,
textAlign: 0.0,
textColour: toColour(255, 255, 255, 220),
textFont: mainFont,
},
focused: {
borderColour: toColour(0, 0, 0, 0),
}
});
characterSelect.lastPlayedText = characterSelect.window.text(5, 95, 200, 25, 'Last Played: Never', {
main: {
textSize: 9.0,
textAlign: 0.0,
textColour: toColour(255, 255, 255, 220),
textFont: mainFont,
},
focused: {
borderColour: toColour(0, 0, 0, 0),
}
});
characterSelect.selectCharacterButton = characterSelect.window.button(85, 130, 260, 25, 'PLAY', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
textSize: 10.0,
textFont: mainFont,
textAlign: 0.5,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
}
}, selectThisCharacter);
characterSelect.newCharacterButton = characterSelect.window.button(5, 160, 420, 25, 'NEW CHARACTER', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
textSize: 10.0,
textFont: mainFont,
textAlign: 0.5,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
}
}, showNewCharacter);
characterSelect.previousCharacterButton = characterSelect.window.button(5, 130, 75, 25, 'PREV', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
textSize: 10.0,
textFont: mainFont,
textAlign: 0.5,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
}
}, selectPreviousCharacter);
characterSelect.nextCharacterButton = characterSelect.window.button(350, 130, 75, 25, 'NEXT', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
textSize: 10.0,
textFont: mainFont,
textAlign: 0.5,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
}
}, selectNextCharacter);
characterSelect.skinImage = characterSelect.window.image(310, 32, 100, 90, "files/images/skins/none.png", {
focused: {
borderColour: toColour(0, 0, 0, 0),
}
});
logToConsole(LOG_DEBUG, `[VRR.GUI] Created character select GUI`);
}
// ===========================================================================
function showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId) {
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing character selection window`);
setChatWindowEnabled(false);
mexui.setInput(true);
characterSelect.nameText.text = `${firstName} ${lastName}`;
characterSelect.cashText.text = `Money: $${cash}`;
characterSelect.clanText.text = `Clan: ${clan}`;
characterSelect.lastPlayedText.text = `Last Played: ${lastPlayed}`;
characterSelect.skinImage = characterSelect.window.image(310, 32, 100, 90, "files/images/skins/none.png");
characterSelect.window.shown = true;
guiSubmitKey = selectThisCharacter;
guiLeftKey = selectPreviousCharacter;
guiRightKey = selectNextCharacter;
showLocaleChooserGUI(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), characterSelect.window.position.y+characterSelect.window.size.y+20));
}
// ===========================================================================
function showNewCharacter() {
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing new character dialog window`);
showNewCharacterGUI();
}
// ===========================================================================
function selectNextCharacter() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting next character info from server for character select window`);
sendNetworkEventToServer("vrr.nextCharacter");
}
// ===========================================================================
function selectPreviousCharacter() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting previous character info from server for character select window`);
sendNetworkEventToServer("vrr.previousCharacter");
}
// ===========================================================================
function selectThisCharacter() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Tell server the current shown character was selected in character select window`);
sendNetworkEventToServer("vrr.selectCharacter");
}
// ===========================================================================
function switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Updating character info with data from server`);
setChatWindowEnabled(false);
characterSelect.window.shown = false;
characterSelect.nameText.text = `${firstName} ${lastName}`;
characterSelect.cashText.text = `Money: $${cash}`;
characterSelect.clanText.text = `Clan: ${clan}`;
characterSelect.lastPlayedText.text = `Last Played: ${lastPlayed}`;
if(characterSelect.skinImage != null) {
characterSelect.skinImage.remove();
}
characterSelect.skinImage = (getGame() == VRR_GAME_GTA_III) ? characterSelect.window.image(310, 32, 100, 90, `files/images/skins/gta3/${getSkinImage(skinId)}.png`) : characterSelect.window.image(310, 32, 100, 90, "files/images/skins/none.png");
characterSelect.window.shown = true;
guiSubmitKey = selectThisCharacter;
guiLeftKey = selectPreviousCharacter;
guiRightKey = selectNextCharacter;
}
// ===========================================================================
function characterSelectSuccess() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports character selection was successful`);
closeAllWindows();
}
// ===========================================================================
function getSkinImage(skinId, gameId = getGame()) {
if(skinId < 10) {
return `Skin_00${skinId}.png`;
} else if(skinId > 10 && skinId < 100) {
return `Skin_0${skinId}.png`;
} else if(skinId > 100) {
return `Skin_${skinId}.png`;
}
}
// ===========================================================================

View File

@@ -1,20 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: clanmgr.js
// DESC: Provides clan manager GUI
// TYPE: Client (JavaScript)
// ===========================================================================
let clanManager = {
window: null,
generalTab: null,
ranksTab: null,
membersTab: null,
vehiclesTab: null,
businessesTab: null,
housesTab: null,
};
// ===========================================================================

View File

@@ -1,85 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: error.js
// DESC: Provides error box GUI
// TYPE: Client (JavaScript)
// ===========================================================================
let errorDialog = {
window: null,
messageLabel: null,
okayButton: null,
};
// ===========================================================================
function initErrorDialogGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating error GUI ...`);
errorDialog.window = mexui.window(getScreenWidth()/2-200, getScreenHeight()/2-70, 400, 140, 'ERROR', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
},
title: {
textSize: 11.0,
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
},
icon: {
textSize: 0.0,
textColour: toColour(0, 0, 0, 0),
backgroundColour: toColour(0, 0, 0, 0),
},
});
errorDialog.messageLabel = errorDialog.window.text(15, 50, 370, 20, 'Error Message', {
main: {
textSize: 10.0,
textAlign: 0.5,
textColour: toColour(255, 255, 255, 255),
textFont: mainFont,
},
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
errorDialog.okayButton = errorDialog.window.button(5, 105, 390, 30, 'OK', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
textSize: 10.0,
textFont: mainFont,
textAlign: 0.5,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
},
}, closeErrorDialog);
logToConsole(LOG_DEBUG, `[VRR.GUI] Created error GUI ...`);
}
// ===========================================================================
function showErrorGUI(errorMessage, errorTitle, buttonText) {
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing error window. Error: ${errorTitle} - ${errorMessage}`);
setChatWindowEnabled(false);
mexui.setInput(true);
errorDialog.messageLabel.text = errorMessage;
errorDialog.okayButton.text = buttonText;
errorDialog.window.title = errorTitle;
errorDialog.window.shown = true;
}
// ===========================================================================
function closeErrorDialog() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Closing error dialog`);
errorDialog.window.shown = false;
mexui.setInput(false);
}
// ===========================================================================

View File

@@ -1,8 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: housemgr.js
// DESC: Provides house manager GUI
// TYPE: Client (JavaScript)
// ===========================================================================

View File

@@ -1,18 +0,0 @@
<html>
<head>
<title>Connected RP: Login</title>
<style type="text/css" rel="stylesheet">
.input-box
{
font-family: "Roboto";
font-size: 14px;
border-style: solid;
border-colour: #0066AA;
border-radius: 2px;
color: #0066AA;
};
</style>
</head>
<body>
</body>
</html>

View File

@@ -1,83 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: info.js
// DESC: Provides info dialog box GUI
// TYPE: Client (JavaScript)
// ===========================================================================
let infoDialog = {
window: null,
messageLabel: null,
okayButton: null,
};
// ===========================================================================
function initInfoDialogGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating info dialog GUI ...`);
infoDialog.window = mexui.window(getScreenWidth()/2-200, getScreenHeight()/2-70, 400, 140, 'Information', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
},
title: {
textSize: 11.0,
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
},
icon: {
textSize: 0.0,
textColour: toColour(0, 0, 0, 0),
backgroundColour: toColour(0, 0, 0, 0),
},
});
infoDialog.messageLabel = infoDialog.window.text(15, 50, 370, 20, 'Information Message', {
main: {
textSize: 10.0,
textAlign: 0.5,
textColour: toColour(255, 255, 255, 220),
textFont: mainFont,
},
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
infoDialog.okayButton = infoDialog.window.button(5, 105, 390, 30, 'OK', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
textSize: 10.0,
textFont: mainFont,
textAlign: 0.5,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
},
}, closeInfoDialog);
logToConsole(LOG_DEBUG, `[VRR.GUI] Created info dialog GUI`);
}
// ===========================================================================
function closeInfoDialog() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Closing info dialog`);
infoDialog.window.shown = false;
mexui.setInput(false);
}
// ===========================================================================
function showInfoGUI(infoMessage, infoTitle, buttonText) {
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing info dialog window. Info: ${infoTitle} - ${infoMessage}`);
mexui.setInput(true);
infoDialog.messageLabel.text = infoMessage;
infoDialog.okayButton.text = buttonText;
infoDialog.window.title = infoTitle;
infoDialog.window.shown = true;
}
// ===========================================================================

View File

@@ -1,107 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: list.js
// DESC: Provides simple list GUI
// TYPE: Client (JavaScript)
// ===========================================================================
let listDialog = {
window: null,
messageLabel: null,
listGrid: null,
};
// ===========================================================================
function initListGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating list dialog GUI ...`);
listDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 500, 'List', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
},
title: {
textSize: 11.0,
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
},
icon: {
textSize: 11.0,
textColour: toColour(255, 255, 255, 255),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
hover: {
backgroundColour: toColour(205, 60, 60, windowTitleAlpha),
},
},
});
listDialog.messageLabel = infoDialog.window.text(5, 5, 390, 20, 'Select one', {
main: {
textSize: 10.0,
textAlign: 0.5,
textColour: toColour(255, 255, 255, 220),
textFont: mainFont,
},
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
listDialog.listGrid = listDialog.window.grid(5, 25, 390, 450, {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
},
column: {
lineColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
},
header: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha-50),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], windowTitleAlpha),
},
cell: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], windowTitleAlpha),
},
row: {
lineColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
hover: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 120),
}
}
});
logToConsole(LOG_DEBUG, `[VRR.GUI] Created list dialog GUI`);
}
// ===========================================================================
function showListGUI() {
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing login window`);
setChatWindowEnabled(false);
mexui.setInput(true);
listDialog.window.shown = true;
guiSubmitKey = checkListDialogSelection;
guiUpKey = selectPreviousListItem;
guiDownKey = selectNextListItem;
}
// ===========================================================================
function checkListDialogSelection() {
}
// ===========================================================================
function selectPreviousListItem() {
}
// ===========================================================================
function selectNextListItem() {
}
// ===========================================================================

View File

@@ -1,116 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: localechooser.js
// DESC: Provides locale chooser GUI
// TYPE: Client (JavaScript)
// ===========================================================================
let localeChooser = {
window: null,
flagImages: [],
activeRingImages: [],
};
let flagImageSize = toVector2(30, 30);
let flagImageGap = toVector2(5, 5);
// ===========================================================================
function initLocaleChooserGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating locale chooser GUI ...`);
localeChooser.window = mexui.window(game.width/2-200, game.height-150, 60, 60, 'Choose a language', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
},
title: {
textSize: 11.0,
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
},
icon: {
textSize: 0.0,
textColour: toColour(0, 0, 0, 0),
backgroundColour: toColour(0, 0, 0, 0),
},
});
localeChooser.window.titleBarShown = false;
loadLocaleConfig();
logToConsole(LOG_DEBUG, `[VRR.GUI] Created locale chooser GUI`);
}
// ===========================================================================
function closeLocaleChooserGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Closing locale chooser window`);
localeChooser.window.shown = false;
mexui.setInput(false);
}
// ===========================================================================
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);
}
//closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing locale chooser window`);
mexui.setInput(true);
localeChooser.window.shown = true;
}
// ===========================================================================
function toggleLocaleChooserGUI() {
if(localeChooser.window.shown) {
closeLocaleChooserGUI();
} else {
showLocaleChooserGUI();
}
}
// ===========================================================================
function localeChooserSetLocale(localeId) {
logToConsole(LOG_DEBUG|LOG_WARN, `[VRR.GUI] Asking server to change locale to ${localeId}`);
sendLocaleSelectToServer(localeId);
}
// ===========================================================================
function resetLocaleChooserOptions() {
logToConsole(LOG_DEBUG|LOG_WARN, `[VRR.GUI] Resetting locale chooser options`);
// let tempLocaleOptions = getServerData().localeOptions; // getAvailableLocaleOptions();
let tempLocaleOptions = getAvailableLocaleOptions();
localeChooser.window.size = toVector2((tempLocaleOptions.length*(flagImageSize.x+flagImageGap.x))+flagImageGap.x, flagImageSize.y+flagImageGap.y*2);
localeChooser.window.position = toVector2((getScreenWidth()/2)-(localeChooser.window.size.x/2), getScreenHeight()-100);
for(let i in localeChooser.flagImages) {
localeChooser.flagImages[i].remove();
}
for(let i in tempLocaleOptions) {
let imagePath = `files/images/flags/${tempLocaleOptions[i].flagImageFile}`;
localeChooser.flagImages[i] = localeChooser.window.image((i*(flagImageSize.x+flagImageGap.x))+flagImageGap.x, flagImageGap.y, flagImageSize.x, flagImageSize.y, imagePath, {
focused: {
borderColour: toColour(0, 0, 0, 0),
},
}, function() {
localeChooserSetLocale(tempLocaleOptions[i].id);
});
logToConsole(LOG_DEBUG|LOG_WARN, `[VRR.GUI] Created locale chooser option ${tempLocaleOptions[i].englishName} with image ${imagePath}`);
//localeChooser.activeRingImages.push(activeRingImage);
}
}
// ===========================================================================

View File

@@ -1,198 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: login.js
// DESC: Provides login GUI
// TYPE: Client (JavaScript)
// ===========================================================================
let login = {
window: null,
logoImage: null,
messageLabel: null,
passwordInput: null,
loginButton: null,
forgotPasswordButton: null,
resetPasswordLabel: null,
};
// ===========================================================================
let loginHTML =
`<html>
<head>
<title>Asshat Gaming Roleplay: Login</title>
<style type="text/css" rel="stylesheet">
.input-box
{
font-family: "Roboto";
font-size: 14px;
border-style: solid;
border-colour: #0066AA;
border-radius: 2px;
color: #0066AA;
};
</style>
</head>
<body>
</body>
</html>`;
// ===========================================================================
function initLoginGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating login GUI ...`);
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,
},
title: {
textSize: 0.0,
textColour: toColour(0, 0, 0, 0),
},
icon: {
textSize: 0.0,
textColour: toColour(0, 0, 0, 0),
},
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
login.window.titleBarIconSize = toVector2(0,0);
login.window.titleBarHeight = 0;
login.window.titleBarShown = false;
login.logoImage = login.window.image(100, 20, 100, 100, mainLogoPath, {
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
login.messageLabel = login.window.text(20, 135, 260, 20, 'Please enter your password!', {
main: {
textSize: 10.0,
textAlign: 0.5,
textColour: toColour(200, 200, 200, 255),
textFont: mainFont,
},
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
login.passwordInput = login.window.textInput(20, 170, 260, 25, '', {
main: {
backgroundColour: toColour(0, 0, 0, 120),
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], textInputAlpha),
textColour: toColour(200, 200, 200, 255),
textSize: 10.0,
textFont: mainFont,
},
caret: {
lineColour: toColour(255, 255, 255, 255),
},
placeholder: {
textColour: toColour(200, 200, 200, 150),
textSize: 10.0,
textFont: mainFont,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
},
});
login.passwordInput.masked = true;
login.passwordInput.placeholder = "Password";
login.loginButton = login.window.button(20, 205, 260, 30, 'LOGIN', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(0, 0, 0, 255),
textSize: 12.0,
textFont: mainFont,
textAlign: 0.5,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
},
}, checkLogin);
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),
textSize: 8.0,
textFont: mainFont,
textAlign: 0.5,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
},
}, switchToPasswordResetGUI);
login.resetPasswordLabel = login.window.text(110, 240, 60, 15, 'Forgot your password?', {
main: {
textSize: 8.0,
textAlign: 1.0,
textColour: toColour(180, 180, 180, 255),
textFont: mainFont,
},
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
logToConsole(LOG_DEBUG, `[VRR.GUI] Created login GUI`);
}
// ===========================================================================
function showLoginGUI() {
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing login window`);
setChatWindowEnabled(false);
mexui.setInput(true);
login.window.shown = true;
mexui.focusedControl = login.passwordInput;
guiSubmitKey = checkLogin;
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);
}
// ===========================================================================
function checkLogin() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking login with server ...`);
sendNetworkEventToServer("vrr.checkLogin", login.passwordInput.lines[0]);
}
// ===========================================================================
function loginFailed(errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports login failed`);
login.messageLabel.text = errorMessage;
login.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
login.passwordInput.text = "";
}
// ===========================================================================
function loginSuccess() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports login was successful`);
guiSubmitKey = false;
closeAllWindows();
}
// ===========================================================================
function switchToPasswordResetGUI() {
//closeAllWindows();
//logToConsole(LOG_DEBUG, `[VRR.GUI] Showing password reset dialog window`);
//showResetPasswordGUI();
sendNetworkEventToServer("vrr.checkResetPassword", "");
return false;
}
// ===========================================================================

View File

@@ -1,166 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: newchar.js
// DESC: Provides new character creation GUI
// TYPE: Client (JavaScript)
// ===========================================================================
let newCharacter = {
window: null,
messageLabel: null,
firstNameInput: null,
lastNameInput: null,
createCharacterButton: null,
mainLogoImage: null,
};
// ===========================================================================
function initNewCharacterGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`);
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,
},
title: {
textSize: 12.0,
textFont: mainFont,
textColour: toColour(0, 0, 0, 0),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
},
icon: {
textSize: 0.0,
textColour: toColour(0, 0, 0, 0),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
}
});
newCharacter.window.titleBarIconSize = toVector2(0, 0);
newCharacter.window.titleBarIconShown = false;
newCharacter.window.titleBarShown = false;
newCharacter.window.titleBarHeight = 30;
newCharacter.mainLogoImage = newCharacter.window.image(80, 20, 80, 80, mainLogoPath, {
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
newCharacter.messageLabel = newCharacter.window.text(20, 100, 260, 20, 'Name your character', {
main: {
textSize: 10.0,
textAlign: 0.5,
textColour: toColour(200, 200, 200, 255),
textFont: mainFont,
},
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
newCharacter.firstNameInput = newCharacter.window.textInput(20, 125, 260, 25, '', {
main: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 255),
textSize: 10.0,
textFont: mainFont,
},
caret: {
lineColour: toColour(255, 255, 255, 255),
},
placeholder: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 200),
textSize: 10.0,
textFont: mainFont,
}
});
newCharacter.firstNameInput.placeholder = "First Name";
newCharacter.lastNameInput = newCharacter.window.textInput(20, 155, 260, 25, '', {
main: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 255),
textSize: 10.0,
textFont: mainFont,
},
caret: {
lineColour: toColour(255, 255, 255, 255),
},
placeholder: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(150, 150, 150, 200),
textSize: 10.0,
textFont: mainFont,
}
});
newCharacter.lastNameInput.placeholder = "Last Name";
newCharacter.createCharacterButton = newCharacter.window.button(20, 185, 260, 25, 'CREATE CHARACTER', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(255, 255, 255, 255),
textSize: 10.0,
textFont: mainFont,
textAlign: 0.5,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
},
}, checkNewCharacter);
logToConsole(LOG_DEBUG, `[VRR.GUI] Created new character GUI`);
}
// ===========================================================================
function newCharacterFailed(errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports new character creation failed. Reason: ${errorMessage}`);
newCharacter.messageLabel.text = errorMessage;
newCharacter.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
newCharacter.firstNameInput.text = "";
newCharacter.lastNameInput.text = "";
if(!newCharacter.window.shown) {
closeAllWindows();
setChatWindowEnabled(false);
mexui.setInput(true);
setHUDEnabled(false);
newCharacter.window.shown = true;
}
}
// ===========================================================================
function checkNewCharacter() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking new character with server ...`);
if(newCharacter.firstNameInput.lines[0].length < 2) {
return false;
}
if(newCharacter.lastNameInput.lines[0].length < 2) {
return false;
}
sendNetworkEventToServer("vrr.checkNewCharacter",
newCharacter.firstNameInput.lines[0],
newCharacter.lastNameInput.lines[0],
);
}
// ===========================================================================
function showNewCharacterGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing new character window`);
closeAllWindows();
setChatWindowEnabled(false);
mexui.setInput(true);
newCharacter.window.shown = true;
mexui.focusedInput = newCharacter.firstNameInput;
guiSubmitKey = checkNewCharacter;
showLocaleChooserGUI(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), newCharacter.window.position.y+newCharacter.window.size.y+20));
}
// ===========================================================================

View File

@@ -1,178 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: register.js
// DESC: Provides account registration GUI
// TYPE: Client (JavaScript)
// ===========================================================================
let register = {
window: null,
logoImage: null,
messageLabel: null,
passwordInput: null,
confirmPasswordInput: null,
emailInput: null,
registerButton: null,
};
// ===========================================================================
function initRegisterGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating register GUI ...`);
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,
},
title: {
textSize: 0.0,
textColour: toColour(0, 0, 0, 0),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
},
icon: {
textSize: 0.0,
textColour: toColour(0, 0, 0, 0),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
}
});
register.window.titleBarIconSize = toVector2(0,0);
register.window.titleBarHeight = 0;
register.window.titleBarShown = false;
register.window.image(100, 20, 100, 100, mainLogoPath, {
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
register.messageLabel = register.window.text(20, 125, 260, 20, 'Create an account', {
main: {
textSize: 10.0,
textAlign: 0.5,
textColour: toColour(200, 200, 200, 255),
textFont: mainFont,
},
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
register.passwordInput = register.window.textInput(20, 150, 260, 25, '', {
main: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 255),
textSize: 10.0,
textFont: mainFont,
},
caret: {
lineColour: toColour(255, 255, 255, 255),
},
placeholder: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 200),
textSize: 10.0,
textFont: mainFont,
}
});
register.passwordInput.masked = true;
register.passwordInput.placeholder = "Password";
register.confirmPasswordInput = register.window.textInput(20, 180, 260, 25, '', {
main: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 255),
textSize: 10.0,
textFont: mainFont,
},
caret: {
lineColour: toColour(255, 255, 255, 255),
},
placeholder: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 200),
textSize: 10.0,
textFont: mainFont,
}
});
register.confirmPasswordInput.masked = true;
register.confirmPasswordInput.placeholder = "Confirm password";
register.emailInput = register.window.textInput(20, 210, 260, 25, '', {
main: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 255),
textSize: 10.0,
textFont: mainFont,
},
caret: {
lineColour: toColour(255, 255, 255, 255),
},
placeholder: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 200),
textSize: 10.0,
textFont: mainFont,
}
});
register.emailInput.placeholder = "Email";
register.registerButton = register.window.button(20, 245, 260, 30, 'CREATE ACCOUNT', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(255, 255, 255, 255),
textSize: 12.0,
textFont: mainFont,
textAlign: 0.5,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
},
}, checkRegistration);
logToConsole(LOG_DEBUG, `[VRR.GUI] Created register GUI`);
}
// ===========================================================================
function registrationFailed(errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports registration failed. Reason: ${errorMessage}`);
register.messageLabel.text = errorMessage;
register.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
register.passwordInput.text = "";
register.confirmPasswordInput.text = "";
register.emailInput.text = "";
}
// ===========================================================================
function checkRegistration() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking registration with server ...`);
sendNetworkEventToServer("vrr.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
}
// ===========================================================================
function showRegistrationGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing registration window`);
closeAllWindows();
setChatWindowEnabled(false);
mexui.setInput(true);
register.window.shown = true;
mexui.focusedControl = register.passwordInput;
guiSubmitKey = checkRegistration;
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);
}
// ===========================================================================
function registrationSuccess() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports registration was successful`);
guiSubmitKey = false;
closeAllWindows();
}
// ===========================================================================

View File

@@ -1,195 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: resetpass.js
// DESC: Provides password reset GUI
// TYPE: Client (JavaScript)
// ===========================================================================
let passwordReset = {
window: null,
logoImage: null,
messageLabel: null,
emailInput: null,
resetPasswordButton: null,
backToLoginButton: null,
backToLoginLabel: null,
};
// ===========================================================================
function initResetPasswordGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating password reset GUI ...`);
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,
},
title: {
textSize: 0.0,
textColour: toColour(0, 0, 0, 0),
},
icon: {
textSize: 0.0,
textColour: toColour(0, 0, 0, 0),
},
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
passwordReset.window.titleBarIconSize = toVector2(0,0);
passwordReset.window.titleBarHeight = 0;
passwordReset.window.titleBarShown = false;
passwordReset.logoImage = passwordReset.window.image(100, 20, 100, 100, mainLogoPath, {
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
passwordReset.messageLabel = passwordReset.window.text(20, 135, 260, 20, 'Please confirm your email', {
main: {
textSize: 10.0,
textAlign: 0.5,
textColour: toColour(200, 200, 200, 255),
textFont: mainFont,
},
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
passwordReset.emailInput = passwordReset.window.textInput(20, 170, 260, 25, '', {
main: {
backgroundColour: toColour(0, 0, 0, 120),
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], textInputAlpha),
textColour: toColour(200, 200, 200, 255),
textSize: 10.0,
textFont: mainFont,
},
caret: {
lineColour: toColour(255, 255, 255, 255),
},
placeholder: {
textColour: toColour(200, 200, 200, 150),
textSize: 10.0,
textFont: mainFont,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
},
});
passwordReset.emailInput.placeholder = "Email";
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),
textSize: 12.0,
textFont: mainFont,
textAlign: 0.5,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
},
}, checkResetPassword);
passwordReset.backToLoginButton = passwordReset.window.button(200, 240, 80, 15, 'LOGIN', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
textSize: 8.0,
textFont: mainFont,
textAlign: 0.5,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
},
}, switchToLoginGUI);
passwordReset.backToLoginLabel = passwordReset.window.text(110, 240, 60, 15, 'Remember your password?', {
main: {
textSize: 8.0,
textAlign: 1.0,
textColour: toColour(200, 200, 200, 255),
textFont: mainFont,
},
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
logToConsole(LOG_DEBUG, `[VRR.GUI] Created password reset GUI`);
}
// ===========================================================================
function showResetPasswordGUI() {
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing password reset window`);
setChatWindowEnabled(false);
mexui.setInput(true);
passwordReset.window.shown = true;
mexui.focusedControl = passwordReset.emailInput;
guiSubmitKey = checkResetPassword;
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);
}
// ===========================================================================
function checkResetPassword() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking password reset with server ...`);
sendNetworkEventToServer("vrr.checkResetPassword", passwordReset.emailInput.lines[0]);
}
// ===========================================================================
function resetPasswordFailed(errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports password reset failed`);
passwordReset.messageLabel.text = errorMessage;
passwordReset.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
passwordReset.emailInput.text = "";
}
// ===========================================================================
function resetPasswordCodeInputGUI() {
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();
}
// ===========================================================================
function switchToLoginGUI() {
guiSubmitKey = false;
closeAllWindows();
showLoginGUI();
}
// ===========================================================================

View File

@@ -1,115 +0,0 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: yesno.js
// DESC: Provides yes/no prompt dialog GUI
// TYPE: Client (JavaScript)
// ===========================================================================
let yesNoDialog = {
window: null,
messageLabel: null,
yesButton: null,
noButton: null,
};
// ===========================================================================
function initYesNoDialogGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Created prompt GUI ...`);
yesNoDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 140, 'Question', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
},
title: {
textSize: 11.0,
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
},
icon: {
textSize: 0.0,
textColour: toColour(0, 0, 0, 0),
backgroundColour: toColour(0, 0, 0, 0),
},
});
yesNoDialog.messageLabel = yesNoDialog.window.text(15, 50, 370, 20, 'Would you like to answer this question?', {
main: {
textSize: 10.0,
textAlign: 0.5,
textColour: toColour(255, 255, 255, 255),
textFont: mainFont,
},
focused: {
borderColour: toColour(0, 0, 0, 0),
},
});
yesNoDialog.yesButton = yesNoDialog.window.button(5, 105, 193, 30, 'YES', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
textSize: 10.0,
textFont: mainFont,
textAlign: 0.5,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
},
}, yesNoDialogAnswerYes);
yesNoDialog.noButton = yesNoDialog.window.button(203, 105, 192, 30, 'NO', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
textSize: 10.0,
textFont: mainFont,
textAlign: 0.5,
},
focused: {
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
},
}, yesNoDialogAnswerNo);
logToConsole(LOG_DEBUG, `[VRR.GUI] Created prompt GUI`);
}
// ===========================================================================
function showYesNoPromptGUI(promptMessage, promptTitle, yesButtonText, noButtonText) {
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing prompt window. Prompt: ${promptTitle} - ${promptMessage}`);
mexui.setInput(true);
yesNoDialog.messageLabel.text = "";
yesNoDialog.yesButton.text = "";
yesNoDialog.noButton.text = "";
yesNoDialog.window.title = "";
yesNoDialog.messageLabel.text = promptMessage;
yesNoDialog.yesButton.text = yesButtonText;
yesNoDialog.noButton.text = noButtonText;
yesNoDialog.window.title = promptTitle;
yesNoDialog.window.shown = true;
}
// ===========================================================================
function yesNoDialogAnswerNo() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer NO to server prompt`);
sendNetworkEventToServer("vrr.promptAnswerNo");
closeAllWindows();
}
// ===========================================================================
function yesNoDialogAnswerYes() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer YES to server prompt`);
sendNetworkEventToServer("vrr.promptAnswerYes");
closeAllWindows();
}
// ===========================================================================