added missing docstring in game_start_page.js
This commit is contained in:
parent
8d878d8eff
commit
e72f9a9790
@ -108,6 +108,10 @@ function areInputsValid(checkRoomCode) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler for the multiplayer room creation button
|
||||||
|
*/
|
||||||
function createMultiPlayerRoom() {
|
function createMultiPlayerRoom() {
|
||||||
if (!areInputsValid(false)) {
|
if (!areInputsValid(false)) {
|
||||||
return;
|
return;
|
||||||
@ -118,6 +122,9 @@ function createMultiPlayerRoom() {
|
|||||||
startGame();
|
startGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler for the join room button
|
||||||
|
*/
|
||||||
function joinMultiPlayerRoom() {
|
function joinMultiPlayerRoom() {
|
||||||
if (!areInputsValid(true)) {
|
if (!areInputsValid(true)) {
|
||||||
return;
|
return;
|
||||||
@ -197,6 +204,10 @@ function changeTheme() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function launches a single player game. It sends the api request to
|
||||||
|
* create a game then it immediately start the game by sendind the startGame api
|
||||||
|
*/
|
||||||
async function startSoloGame(){
|
async function startSoloGame(){
|
||||||
|
|
||||||
if (!areInputsValid(false)) {
|
if (!areInputsValid(false)) {
|
||||||
@ -215,6 +226,10 @@ async function startSoloGame(){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function creates a multiplayer game by sending the createGame api call
|
||||||
|
* then, if no error occured, redirects to the lobby page.
|
||||||
|
*/
|
||||||
async function startGame(){
|
async function startGame(){
|
||||||
username = document.getElementById("game_username").value;
|
username = document.getElementById("game_username").value;
|
||||||
let data = {}
|
let data = {}
|
||||||
@ -231,6 +246,12 @@ async function startGame(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function read the username and the room code in order to
|
||||||
|
* join an already existing game, to do so it calls the joinGame endpoint
|
||||||
|
* with the aftermentioned username and room code as parameter.
|
||||||
|
*/
|
||||||
async function joinGame(){
|
async function joinGame(){
|
||||||
username = document.getElementById("game_username").value;
|
username = document.getElementById("game_username").value;
|
||||||
gameid = document.getElementById("game_room_code").value;
|
gameid = document.getElementById("game_room_code").value;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user