Bunch of changes (see description)
* New script files to organize GUI * Added clientside pickup detection to reduce server load for enter/exit * Added notips command for players to toggle random tips * Select account last IP as part of wildcard (was separate due to old INT) * Save account registration with datetime instead of unix timestamp * Don't force mouse camera on moving anims in SA+ * Add IP ban to server runtime memory in subnet ban command * Add non-roleplay character name account moderation flag * Fix bizowner and bizclan commands * Fix bug that allowed buying items without having the needed cash * Fix set biz blip command * Add dealership help label type command * Added command to show all clan flag types * Added discord config and load from database * Fix angle for directional teleport and anim move directions * Use new colour structure in preparation for locale translations * Add on-foot only item usetype array to prevent using when in veh * Fix wrong const value for exit pickup type * Start using datetime in MySQL tables instead of unix timestamps * Start adding webhooks for discord (unfinished) * Added new discord URL to discord help category * Added house reset pickups/blips utils * Prevent using items when in skin selector * Fix get player command * Fix give player money command * Add coffee shop and vehicle repair shop default biz item templates * Remove old game fixes util (resource now in server config) * Fix bug where characters in clans wouldn't be shown in char select * Slimmed down the amount of timers * Made some potentially large numbers more readable (commas) * Remove colours in message for console output
This commit is contained in:
@@ -93,6 +93,7 @@ function onProcess(event, deltaTime) {
|
||||
forceLocalPlayerEquippedWeaponItem();
|
||||
processWantedLevelReset();
|
||||
processGameSpecifics();
|
||||
processNearbyPickups();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -26,16 +26,7 @@ let textInputAlpha = 180;
|
||||
|
||||
let guiReady = false;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let login = {
|
||||
window: null,
|
||||
logoImage: null,
|
||||
messageLabel: null,
|
||||
passwordLabel: null,
|
||||
passwordInput: null,
|
||||
loginButton: null,
|
||||
};
|
||||
//let mexui = findResourceByName("mexui").exports.getMexUI();
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -51,45 +42,6 @@ let twoFactorAuth = {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let register = {
|
||||
window: null,
|
||||
logoImage: null,
|
||||
messageLabel: null,
|
||||
passwordInput: null,
|
||||
confirmPasswordInput: null,
|
||||
emailInput: null,
|
||||
registerButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let newCharacter = {
|
||||
window: null,
|
||||
firstNameInput: null,
|
||||
lastNameInput: null,
|
||||
skinDropDown: null,
|
||||
spawnAreaDropDown: null,
|
||||
createButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let errorDialog = {
|
||||
window: null,
|
||||
messageLabel: null,
|
||||
okayButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let infoDialog = {
|
||||
window: null,
|
||||
messageLabel: null,
|
||||
okayButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let listDialog = {
|
||||
window: null,
|
||||
messageLabel: null,
|
||||
@@ -98,30 +50,6 @@ let listDialog = {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let yesNoDialog = {
|
||||
window: null,
|
||||
messageLabel: null,
|
||||
yesButton: null,
|
||||
noButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let characterSelect = {
|
||||
window: null,
|
||||
skinImage: null,
|
||||
nameText: null,
|
||||
cashText: null,
|
||||
clanText: null,
|
||||
lastPlayedText: null,
|
||||
previousCharacterButton: null,
|
||||
nextCharacterButton: null,
|
||||
selectCharacterButton: null,
|
||||
newCharacterButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let placesOfOrigin = [
|
||||
"Liberty City",
|
||||
"Vice City",
|
||||
@@ -155,84 +83,14 @@ function initGUIScript() {
|
||||
function initGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Initializing GUI ...`);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating login GUI ...`);
|
||||
login.window = mexui.window(game.width/2-150, game.height/2-129, 300, 258, 'LOGIN', {
|
||||
main: {
|
||||
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
|
||||
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.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: robotoFont,
|
||||
},
|
||||
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: robotoFont,
|
||||
},
|
||||
caret: {
|
||||
lineColour: toColour(255, 255, 255, 255),
|
||||
},
|
||||
placeholder: {
|
||||
textColour: toColour(200, 200, 200, 150),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
},
|
||||
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: 10.0,
|
||||
textFont: robotoFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
},
|
||||
}, checkLogin);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created login GUI`);
|
||||
|
||||
// ===========================================================================
|
||||
initLoginGUI();
|
||||
initRegisterGUI();
|
||||
initNewCharacterGUI();
|
||||
initCharacterSelectGUI();
|
||||
initInfoDialogGUI();
|
||||
initErrorDialogGUI();
|
||||
initYesNoDialogGUI();
|
||||
//initResetPasswordGUI();
|
||||
|
||||
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', {
|
||||
@@ -312,361 +170,6 @@ function initGUI() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`);
|
||||
newCharacter.window = mexui.window(game.width/2-130, game.height/2-100, 300, 200, 'Character Name', {
|
||||
main: {
|
||||
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
|
||||
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),
|
||||
}
|
||||
});
|
||||
newCharacter.window.titleBarIconSize = toVector2(0,0);
|
||||
newCharacter.window.titleBarHeight = 0;
|
||||
|
||||
newCharacter.window.image(115, 10, 65, 65, mainLogoPath, {
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
newCharacter.messageLabel = newCharacter.window.text(20, 75, 260, 20, 'Name your character', {
|
||||
main: {
|
||||
textSize: 10.0,
|
||||
textAlign: 0.5,
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textFont: robotoFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
newCharacter.firstNameInput = newCharacter.window.textInput(20, 100, 260, 25, '', {
|
||||
main: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
},
|
||||
caret: {
|
||||
lineColour: toColour(255, 255, 255, 255),
|
||||
},
|
||||
placeholder: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 200),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
}
|
||||
});
|
||||
newCharacter.firstNameInput.placeholder = "First Name";
|
||||
|
||||
newCharacter.lastNameInput = newCharacter.window.textInput(20, 130, 260, 25, '', {
|
||||
main: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
},
|
||||
caret: {
|
||||
lineColour: toColour(255, 255, 255, 255),
|
||||
},
|
||||
placeholder: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(150, 150, 150, 200),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
}
|
||||
});
|
||||
newCharacter.lastNameInput.placeholder = "Last Name";
|
||||
|
||||
newCharacter.createCharacterButton = newCharacter.window.button(20, 160, 260, 25, 'CREATE CHARACTER', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(255, 255, 255, 255),
|
||||
textSize: 12.0,
|
||||
textFont: robotoFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
},
|
||||
}, checkNewCharacter);
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created new character GUI`);
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating register GUI ...`);
|
||||
register.window = mexui.window(game.width/2-130, game.height/2-125, 300, 250, 'Register', {
|
||||
main: {
|
||||
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
|
||||
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.image(115, 10, 65, 65, mainLogoPath, {
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
register.messageLabel = register.window.text(20, 75, 260, 20, 'Create an account', {
|
||||
main: {
|
||||
textSize: 10.0,
|
||||
textAlign: 0.5,
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textFont: robotoFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
register.passwordInput = register.window.textInput(20, 100, 260, 25, '', {
|
||||
main: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
},
|
||||
caret: {
|
||||
lineColour: toColour(255, 255, 255, 255),
|
||||
},
|
||||
placeholder: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 200),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
}
|
||||
});
|
||||
register.passwordInput.masked = true;
|
||||
register.passwordInput.placeholder = "Password";
|
||||
|
||||
register.confirmPasswordInput = register.window.textInput(20, 130, 260, 25, '', {
|
||||
main: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
},
|
||||
caret: {
|
||||
lineColour: toColour(255, 255, 255, 255),
|
||||
},
|
||||
placeholder: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 200),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
}
|
||||
});
|
||||
register.confirmPasswordInput.masked = true;
|
||||
register.confirmPasswordInput.placeholder = "Confirm password";
|
||||
|
||||
register.emailInput = register.window.textInput(20, 160, 260, 25, '', {
|
||||
main: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
},
|
||||
caret: {
|
||||
lineColour: toColour(255, 255, 255, 255),
|
||||
},
|
||||
placeholder: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 200),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
}
|
||||
});
|
||||
register.emailInput.placeholder = "Email";
|
||||
|
||||
register.registerButton = register.window.button(20, 195, 260, 30, 'CREATE ACCOUNT', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(255, 255, 255, 255),
|
||||
textSize: 12.0,
|
||||
textFont: robotoFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
},
|
||||
}, checkRegistration);
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created register GUI`);
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating error GUI ...`);
|
||||
errorDialog.window = mexui.window(game.width/2-200, game.height/2-70, 500, 140, 'ERROR', {
|
||||
main: {
|
||||
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
|
||||
transitionTime: 500,
|
||||
},
|
||||
title: {
|
||||
textSize: 11.0,
|
||||
textColour: toColour(0, 0, 0, 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, 470, 75, 'Error Message', {
|
||||
main: {
|
||||
textSize: 10.0,
|
||||
textAlign: 0.5,
|
||||
textColour: toColour(255, 255, 255, 255),
|
||||
textFont: robotoFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
errorDialog.okayButton = errorDialog.window.button(20, 95, 360, 30, 'OK', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(0, 0, 0, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||
},
|
||||
}, closeErrorDialog);
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created error GUI ...`);
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
|
||||
transitionTime: 500,
|
||||
},
|
||||
title: {
|
||||
textSize: 11.0,
|
||||
textColour: toColour(0, 0, 0, 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: robotoFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
yesNoDialog.yesButton = yesNoDialog.window.button(20, 95, 175, 30, 'YES', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(0, 0, 0, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||
},
|
||||
}, yesNoDialogAnswerYes);
|
||||
|
||||
yesNoDialog.noButton = yesNoDialog.window.button(205, 95, 175, 30, 'NO', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(0, 0, 0, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||
},
|
||||
}, yesNoDialogAnswerNo);
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created prompt GUI`);
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating info dialog GUI ...`);
|
||||
infoDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 140, 'Information', {
|
||||
main: {
|
||||
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
|
||||
},
|
||||
title: {
|
||||
textSize: 11.0,
|
||||
textColour: toColour(0, 0, 0, 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: robotoFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
infoDialog.okayButton = infoDialog.window.button(20, 95, 360, 30, 'OK', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(0, 0, 0, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||
},
|
||||
}, closeInfoDialog);
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created info dialog GUI`);
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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: {
|
||||
@@ -725,132 +228,6 @@ function initGUI() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
|
||||
},
|
||||
title: {
|
||||
textSize: 11.0,
|
||||
textColour: toColour(0, 0, 0, 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),
|
||||
}
|
||||
});
|
||||
|
||||
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: robotoFont,
|
||||
},
|
||||
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: robotoFont,
|
||||
},
|
||||
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: robotoFont,
|
||||
},
|
||||
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: robotoFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
}
|
||||
});
|
||||
|
||||
characterSelect.selectCharacterButton = characterSelect.window.button(85, 130, 260, 25, 'SELECT', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(0, 0, 0, 255),
|
||||
textSize: 12.0,
|
||||
textFont: robotoFont,
|
||||
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(0, 0, 0, 255),
|
||||
textSize: 12.0,
|
||||
textFont: robotoFont,
|
||||
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(0, 0, 0, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
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(0, 0, 0, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
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`);
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] All GUI created successfully!`);
|
||||
closeAllWindows();
|
||||
|
||||
@@ -859,92 +236,6 @@ function initGUI() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let checkLogin = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking login with server ...`);
|
||||
triggerNetworkEvent("vrr.checkLogin", login.passwordInput.lines[0]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let loginFailed = function(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 = "";
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let loginSuccess = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports login was successful`);
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let checkRegistration = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking registration with server ...`);
|
||||
triggerNetworkEvent("vrr.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let checkNewCharacter = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking new character with server ...`);
|
||||
let skinId = false;
|
||||
|
||||
if(newCharacter.firstNameInput.lines[0].length < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(newCharacter.lastNameInput.lines[0].length < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
triggerNetworkEvent("vrr.checkNewCharacter",
|
||||
newCharacter.firstNameInput.lines[0],
|
||||
newCharacter.lastNameInput.lines[0],
|
||||
);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let registrationFailed = function(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 = "";
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let newCharacterFailed = function(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;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let registrationSuccess = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports registration was successful`);
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let twoFactorAuthFailed = function(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports two-factor authentication failed. Reason: ${errorMessage}`);
|
||||
login.messageLabel.text = errorMessage;
|
||||
@@ -968,29 +259,6 @@ let checkTwoFactorAuth = function() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let characterSelectSuccess = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports character selection was successful`);
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let closeErrorDialog = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Closing error dialog`);
|
||||
errorDialog.window.shown = false;
|
||||
mexui.setInput(false);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let closeInfoDialog = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Closing info dialog`);
|
||||
infoDialog.window.shown = false;
|
||||
mexui.setInput(false);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let closeAllWindows = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Closing all GUI windows`);
|
||||
infoDialog.window.shown = false;
|
||||
@@ -1007,42 +275,6 @@ let closeAllWindows = function() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let yesNoDialogAnswerNo = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer NO to server prompt`);
|
||||
triggerNetworkEvent("vrr.promptAnswerNo");
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let yesNoDialogAnswerYes = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer YES to server prompt`);
|
||||
triggerNetworkEvent("vrr.promptAnswerYes");
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let showRegistration = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing registration window`);
|
||||
closeAllWindows();
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
register.window.shown = true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let showLogin = function() {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing login window`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
login.window.shown = true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let showTwoFactorAuth = function() {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing two-factor authentication window`);
|
||||
@@ -1053,96 +285,6 @@ let showTwoFactorAuth = function() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let showCharacterSelect = function(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;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let showError = function(errorMessage, errorTitle) {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing error window. Error: ${errorTitle} - ${errorMessage}`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
errorDialog.messageLabel.text = errorMessage;
|
||||
errorDialog.window.shown = true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let showYesNo = function(promptMessage, promptTitle) {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing prompt window. Prompt: ${promptTitle} - ${promptMessage}`);
|
||||
mexui.setInput(true);
|
||||
yesNoDialog.messageLabel.text = promptMessage;
|
||||
yesNoDialog.window.shown = true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let showInfo = function(infoMessage, infoTitle) {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing info dialog window. Info: ${infoTitle} - ${infoMessage}`);
|
||||
mexui.setInput(true);
|
||||
infoDialog.messageLabel.text = infoMessage;
|
||||
infoDialog.window.shown = true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let showNewCharacter = function() {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing new character dialog window`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
setHUDEnabled(false);
|
||||
newCharacter.window.shown = true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let selectNextCharacter = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting next character info from server for character select window`);
|
||||
triggerNetworkEvent("vrr.nextCharacter");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let selectPreviousCharacter = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting previous character info from server for character select window`);
|
||||
triggerNetworkEvent("vrr.previousCharacter");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let selectThisCharacter = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Tell server the current shown character was selected in character select window`);
|
||||
triggerNetworkEvent("vrr.selectCharacter");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let switchCharacterSelect = function(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}`;
|
||||
characterSelect.skinImage = characterSelect.window.image(310, 32, 100, 90, "files/images/skins/none.png");
|
||||
characterSelect.window.shown = true;
|
||||
}
|
||||
|
||||
let isAnyGUIActive = function() {
|
||||
if(!guiReady) {
|
||||
if(infoDialog.window.shown) {
|
||||
@@ -1187,37 +329,16 @@ let isAnyGUIActive = function() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("vrr.showLogin", function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show login window`);
|
||||
showLogin();
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("vrr.showRegistration", function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show registration window`);
|
||||
showRegistration();
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("vrr.showNewCharacter", function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show new character window`);
|
||||
showNewCharacter();
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("vrr.showCharacterSelect", function(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show character selection window`);
|
||||
showCharacterSelect(firstName, lastName, cash, clan, lastPlayed, skinId);
|
||||
showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId);
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("vrr.switchCharacterSelect", function(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to update character selection window with new info`);
|
||||
switchCharacterSelect(firstName, lastName, cash, clan, lastPlayed, skinId);
|
||||
switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId);
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1231,7 +352,7 @@ addNetworkHandler("vrr.showError", function(errorMessage, errorTitle) {
|
||||
|
||||
addNetworkHandler("vrr.showPrompt", function(promptMessage, promptTitle) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show prompt window`);
|
||||
showYesNo(promptMessage, promptTitle);
|
||||
showYesNoPromptGUI(promptMessage, promptTitle);
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
0
scripts/client/gui/bizmgr.js
Normal file
0
scripts/client/gui/bizmgr.js
Normal file
210
scripts/client/gui/charselect.js
Normal file
210
scripts/client/gui/charselect.js
Normal file
@@ -0,0 +1,210 @@
|
||||
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(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
|
||||
},
|
||||
title: {
|
||||
textSize: 11.0,
|
||||
textColour: toColour(0, 0, 0, 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),
|
||||
}
|
||||
});
|
||||
|
||||
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: robotoFont,
|
||||
},
|
||||
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: robotoFont,
|
||||
},
|
||||
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: robotoFont,
|
||||
},
|
||||
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: robotoFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
}
|
||||
});
|
||||
|
||||
characterSelect.selectCharacterButton = characterSelect.window.button(85, 130, 260, 25, 'SELECT', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(0, 0, 0, 255),
|
||||
textSize: 12.0,
|
||||
textFont: robotoFont,
|
||||
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(0, 0, 0, 255),
|
||||
textSize: 12.0,
|
||||
textFont: robotoFont,
|
||||
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(0, 0, 0, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
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(0, 0, 0, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
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;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showNewCharacter() {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing new character dialog window`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
setHUDEnabled(false);
|
||||
newCharacter.window.shown = true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function selectNextCharacter() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting next character info from server for character select window`);
|
||||
triggerNetworkEvent("vrr.nextCharacter");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function selectPreviousCharacter() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting previous character info from server for character select window`);
|
||||
triggerNetworkEvent("vrr.previousCharacter");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function selectThisCharacter() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Tell server the current shown character was selected in character select window`);
|
||||
triggerNetworkEvent("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}`;
|
||||
characterSelect.skinImage = characterSelect.window.image(310, 32, 100, 90, "files/images/skins/none.png");
|
||||
characterSelect.window.shown = true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function characterSelectSuccess() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports character selection was successful`);
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
0
scripts/client/gui/clanmgr.js
Normal file
0
scripts/client/gui/clanmgr.js
Normal file
74
scripts/client/gui/error.js
Normal file
74
scripts/client/gui/error.js
Normal file
@@ -0,0 +1,74 @@
|
||||
let errorDialog = {
|
||||
window: null,
|
||||
messageLabel: null,
|
||||
okayButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initErrorDialogGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating error GUI ...`);
|
||||
errorDialog.window = mexui.window(game.width/2-200, game.height/2-70, 500, 140, 'ERROR', {
|
||||
main: {
|
||||
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
|
||||
transitionTime: 500,
|
||||
},
|
||||
title: {
|
||||
textSize: 11.0,
|
||||
textColour: toColour(0, 0, 0, 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, 470, 75, 'Error Message', {
|
||||
main: {
|
||||
textSize: 10.0,
|
||||
textAlign: 0.5,
|
||||
textColour: toColour(255, 255, 255, 255),
|
||||
textFont: robotoFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
errorDialog.okayButton = errorDialog.window.button(20, 95, 360, 30, 'OK', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(0, 0, 0, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
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) {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing error window. Error: ${errorTitle} - ${errorMessage}`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
errorDialog.messageLabel.text = errorMessage;
|
||||
errorDialog.window.shown = true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function closeErrorDialog() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Closing error dialog`);
|
||||
errorDialog.window.shown = false;
|
||||
mexui.setInput(false);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
0
scripts/client/gui/housemgr.js
Normal file
0
scripts/client/gui/housemgr.js
Normal file
72
scripts/client/gui/info.js
Normal file
72
scripts/client/gui/info.js
Normal file
@@ -0,0 +1,72 @@
|
||||
let infoDialog = {
|
||||
window: null,
|
||||
messageLabel: null,
|
||||
okayButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initInfoDialogGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating info dialog GUI ...`);
|
||||
infoDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 140, 'Information', {
|
||||
main: {
|
||||
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
|
||||
},
|
||||
title: {
|
||||
textSize: 11.0,
|
||||
textColour: toColour(0, 0, 0, 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: robotoFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
infoDialog.okayButton = infoDialog.window.button(20, 95, 360, 30, 'OK', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(0, 0, 0, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
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 showInfo(infoMessage, infoTitle) {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing info dialog window. Info: ${infoTitle} - ${infoMessage}`);
|
||||
mexui.setInput(true);
|
||||
infoDialog.messageLabel.text = infoMessage;
|
||||
infoDialog.window.shown = true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
124
scripts/client/gui/login.js
Normal file
124
scripts/client/gui/login.js
Normal file
@@ -0,0 +1,124 @@
|
||||
let login = {
|
||||
window: null,
|
||||
logoImage: null,
|
||||
messageLabel: null,
|
||||
passwordLabel: null,
|
||||
passwordInput: null,
|
||||
loginButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initLoginGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating login GUI ...`);
|
||||
login.window = mexui.window(game.width/2-150, game.height/2-129, 300, 258, 'LOGIN', {
|
||||
main: {
|
||||
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
|
||||
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.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: robotoFont,
|
||||
},
|
||||
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: robotoFont,
|
||||
},
|
||||
caret: {
|
||||
lineColour: toColour(255, 255, 255, 255),
|
||||
},
|
||||
placeholder: {
|
||||
textColour: toColour(200, 200, 200, 150),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
},
|
||||
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: 10.0,
|
||||
textFont: robotoFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
},
|
||||
}, checkLogin);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function checkLogin() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking login with server ...`);
|
||||
triggerNetworkEvent("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`);
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
152
scripts/client/gui/newchar.js
Normal file
152
scripts/client/gui/newchar.js
Normal file
@@ -0,0 +1,152 @@
|
||||
let newCharacter = {
|
||||
window: null,
|
||||
firstNameInput: null,
|
||||
lastNameInput: null,
|
||||
skinDropDown: null,
|
||||
spawnAreaDropDown: null,
|
||||
createButton: null,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initNewCharacterGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`);
|
||||
newCharacter.window = mexui.window(game.width/2-130, game.height/2-100, 300, 200, 'Character Name', {
|
||||
main: {
|
||||
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
|
||||
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),
|
||||
}
|
||||
});
|
||||
newCharacter.window.titleBarIconSize = toVector2(0,0);
|
||||
newCharacter.window.titleBarHeight = 0;
|
||||
|
||||
newCharacter.window.image(115, 10, 65, 65, mainLogoPath, {
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
newCharacter.messageLabel = newCharacter.window.text(20, 75, 260, 20, 'Name your character', {
|
||||
main: {
|
||||
textSize: 10.0,
|
||||
textAlign: 0.5,
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textFont: robotoFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
newCharacter.firstNameInput = newCharacter.window.textInput(20, 100, 260, 25, '', {
|
||||
main: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
},
|
||||
caret: {
|
||||
lineColour: toColour(255, 255, 255, 255),
|
||||
},
|
||||
placeholder: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 200),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
}
|
||||
});
|
||||
newCharacter.firstNameInput.placeholder = "First Name";
|
||||
|
||||
newCharacter.lastNameInput = newCharacter.window.textInput(20, 130, 260, 25, '', {
|
||||
main: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
},
|
||||
caret: {
|
||||
lineColour: toColour(255, 255, 255, 255),
|
||||
},
|
||||
placeholder: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(150, 150, 150, 200),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
}
|
||||
});
|
||||
newCharacter.lastNameInput.placeholder = "Last Name";
|
||||
|
||||
newCharacter.createCharacterButton = newCharacter.window.button(20, 160, 260, 25, 'CREATE CHARACTER', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(255, 255, 255, 255),
|
||||
textSize: 12.0,
|
||||
textFont: robotoFont,
|
||||
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 ...`);
|
||||
let skinId = false;
|
||||
|
||||
if(newCharacter.firstNameInput.lines[0].length < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(newCharacter.lastNameInput.lines[0].length < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
triggerNetworkEvent("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;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
161
scripts/client/gui/register.js
Normal file
161
scripts/client/gui/register.js
Normal file
@@ -0,0 +1,161 @@
|
||||
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(game.width/2-130, game.height/2-125, 300, 250, 'Register', {
|
||||
main: {
|
||||
backgroundColour: toColour(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
|
||||
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.image(115, 10, 65, 65, mainLogoPath, {
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
register.messageLabel = register.window.text(20, 75, 260, 20, 'Create an account', {
|
||||
main: {
|
||||
textSize: 10.0,
|
||||
textAlign: 0.5,
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textFont: robotoFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
register.passwordInput = register.window.textInput(20, 100, 260, 25, '', {
|
||||
main: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
},
|
||||
caret: {
|
||||
lineColour: toColour(255, 255, 255, 255),
|
||||
},
|
||||
placeholder: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 200),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
}
|
||||
});
|
||||
register.passwordInput.masked = true;
|
||||
register.passwordInput.placeholder = "Password";
|
||||
|
||||
register.confirmPasswordInput = register.window.textInput(20, 130, 260, 25, '', {
|
||||
main: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
},
|
||||
caret: {
|
||||
lineColour: toColour(255, 255, 255, 255),
|
||||
},
|
||||
placeholder: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 200),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
}
|
||||
});
|
||||
register.confirmPasswordInput.masked = true;
|
||||
register.confirmPasswordInput.placeholder = "Confirm password";
|
||||
|
||||
register.emailInput = register.window.textInput(20, 160, 260, 25, '', {
|
||||
main: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
},
|
||||
caret: {
|
||||
lineColour: toColour(255, 255, 255, 255),
|
||||
},
|
||||
placeholder: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 200),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
}
|
||||
});
|
||||
register.emailInput.placeholder = "Email";
|
||||
|
||||
register.registerButton = register.window.button(20, 195, 260, 30, 'CREATE ACCOUNT', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(255, 255, 255, 255),
|
||||
textSize: 12.0,
|
||||
textFont: robotoFont,
|
||||
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 ...`);
|
||||
triggerNetworkEvent("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;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function registrationSuccess() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Server reports registration was successful`);
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
0
scripts/client/gui/resetpass.js
Normal file
0
scripts/client/gui/resetpass.js
Normal file
95
scripts/client/gui/yesno.js
Normal file
95
scripts/client/gui/yesno.js
Normal file
@@ -0,0 +1,95 @@
|
||||
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(windowColour[0], windowColour[1], windowColour[2], windowColour[3]),
|
||||
transitionTime: 500,
|
||||
},
|
||||
title: {
|
||||
textSize: 11.0,
|
||||
textColour: toColour(0, 0, 0, 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: robotoFont,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
});
|
||||
|
||||
yesNoDialog.yesButton = yesNoDialog.window.button(20, 95, 175, 30, 'YES', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(0, 0, 0, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
textAlign: 0.5,
|
||||
},
|
||||
focused: {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||
},
|
||||
}, yesNoDialogAnswerYes);
|
||||
|
||||
yesNoDialog.noButton = yesNoDialog.window.button(205, 95, 175, 30, 'NO', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(0, 0, 0, 255),
|
||||
textSize: 10.0,
|
||||
textFont: robotoFont,
|
||||
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) {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing prompt window. Prompt: ${promptTitle} - ${promptMessage}`);
|
||||
mexui.setInput(true);
|
||||
yesNoDialog.messageLabel.text = promptMessage;
|
||||
yesNoDialog.window.shown = true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function yesNoDialogAnswerNo() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer NO to server prompt`);
|
||||
triggerNetworkEvent("vrr.promptAnswerNo");
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function yesNoDialogAnswerYes() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer YES to server prompt`);
|
||||
triggerNetworkEvent("vrr.promptAnswerYes");
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -113,7 +113,7 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
|
||||
break;
|
||||
|
||||
case VRR_BIZLABEL_INFO_ENTERVEH:
|
||||
bizInfoText = "Enter a vehicle to purchase it";
|
||||
bizInfoText = "Enter a vehicle to buy it";
|
||||
break;
|
||||
|
||||
case VRR_BIZLABEL_INFO_NONE:
|
||||
|
||||
@@ -55,6 +55,8 @@ let calledDeathEvent = false;
|
||||
let interiorLightsEnabled = true;
|
||||
let interiorLightsColour = toColour(0, 0, 0, 150);
|
||||
|
||||
let mouseCameraEnabled = false
|
||||
let mouseCameraEnabled = false;
|
||||
|
||||
let currentPickup = false;
|
||||
|
||||
// ===========================================================================
|
||||
@@ -57,6 +57,7 @@ function addAllNetworkHandlers() {
|
||||
addNetworkHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent);
|
||||
addNetworkHandler("vrr.spawned", onServerSpawnedPlayer);
|
||||
addNetworkHandler("vrr.money", setLocalPlayerCash);
|
||||
addNetworkHandler("vrr.armour", setLocalPlayerArmour);
|
||||
|
||||
addNetworkHandler("vrr.excludeGroundSnow", excludeModelFromGroundSnow);
|
||||
addNetworkHandler("vrr.removeWorldObject", removeWorldObject);
|
||||
@@ -89,6 +90,10 @@ function addAllNetworkHandlers() {
|
||||
addNetworkHandler("vrr.syncElement", forceSyncElementProperties);
|
||||
addNetworkHandler("vrr.elementPosition", setElementPosition);
|
||||
addNetworkHandler("vrr.elementCollisions", setElementCollisionsEnabled);
|
||||
|
||||
addNetworkHandler("vrr.showRegistration", showRegistrationGUI);
|
||||
addNetworkHandler("vrr.showNewCharacter", showNewCharacterGUI);
|
||||
addNetworkHandler("vrr.showLogin", showLoginGUI);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -334,4 +339,10 @@ function setLocalPlayerPedPartsAndProps(parts, props) {
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerArmour(armour) {
|
||||
localPlayer.armour = armour;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -726,4 +726,20 @@ function getPlayerFromParams(params) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processNearbyPickups() {
|
||||
let pickups = getElementsByType(ELEMENT_PICKUP);
|
||||
for(let i in pickups) {
|
||||
if(getDistance(pickups[i].position, localPlayer.position) < 5) {
|
||||
//if(pickups[i].interior == localPlayer.interior && pickups[i].dimension == localPlayer.dimension) {
|
||||
if(currentPickup != pickups[i]) {
|
||||
currentPickup = pickups[i];
|
||||
triggerNetworkEvent("vrr.pickup", pickups[i].id);
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user