Site
- add new request for start game in tournament - fix some bug with style
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
|
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2024/10/01 13:16:39 by edbernar #+# #+# #
|
# Created: 2024/10/01 13:16:39 by edbernar #+# #+# #
|
||||||
# Updated: 2024/10/02 04:48:02 by edbernar ### ########.fr #
|
# Updated: 2024/10/02 13:31:25 by edbernar ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
@ -30,6 +30,11 @@
|
|||||||
# 3 : message : send a message to the tournament chat
|
# 3 : message : send a message to the tournament chat
|
||||||
# - username : name of the player who send the message
|
# - username : name of the player who send the message
|
||||||
# - message : message to send
|
# - message : message to send
|
||||||
|
#
|
||||||
|
# 4 : startGame : tell the client (client will launch a matchmaking like invitation)
|
||||||
|
# - id : id of the player
|
||||||
|
# - username : name of the player
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
#client actions (actions sent by the client) :
|
#client actions (actions sent by the client) :
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/09/19 23:08:31 by edbernar #+# #+# */
|
/* Created: 2024/09/19 23:08:31 by edbernar #+# #+# */
|
||||||
/* Updated: 2024/10/01 00:21:50 by edbernar ### ########.fr */
|
/* Updated: 2024/10/02 13:34:58 by edbernar ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ class ProfilPage
|
|||||||
CN.new("Invitation", `Can't invite ${userInfo.username} (offline)`)
|
CN.new("Invitation", `Can't invite ${userInfo.username} (offline)`)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pageRenderer.changePage("waitingGamePage", false, {username: userInfo.username, id: userInfo.id});
|
pageRenderer.changePage("waitingGamePage", false, {username: userInfo.username, id: userInfo.id, isTournament: false});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,12 @@
|
|||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/10/01 13:42:29 by edbernar #+# #+# */
|
/* Created: 2024/10/01 13:42:29 by edbernar #+# #+# */
|
||||||
/* Updated: 2024/10/02 04:55:51 by edbernar ### ########.fr */
|
/* Updated: 2024/10/02 13:39:23 by edbernar ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
import { pageRenderer } from '/static/javascript/main.js';
|
||||||
|
|
||||||
const playerNb = [1, 2, 4, 5, 13, 14, 15, 16];
|
const playerNb = [1, 2, 4, 5, 13, 14, 15, 16];
|
||||||
const playerList = {
|
const playerList = {
|
||||||
player1: {id: 0, username: null, pfp: null},
|
player1: {id: 0, username: null, pfp: null},
|
||||||
@ -116,6 +118,11 @@ class TournamentPage
|
|||||||
newText.innerText = `${content.username} : ${content.message}`;
|
newText.innerText = `${content.username} : ${content.message}`;
|
||||||
divChat.appendChild(newText);
|
divChat.appendChild(newText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static startGame(content)
|
||||||
|
{
|
||||||
|
pageRenderer.changePage("waitingGamePage", false, {username: content.username, id: content.id, isTournament: true})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function newInfo(message)
|
function newInfo(message)
|
||||||
|
@ -16,3 +16,6 @@ typeTournament({action: 1, id: 8, username: "GlitchPhantom", pfp: "https://image
|
|||||||
typeTournament({action: 1, id: 9, username: "FrostBiteX", pfp: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQJWyvMlk1053PLnD3PRrz2g_LdQtW2H-M-GQ&s"});
|
typeTournament({action: 1, id: 9, username: "FrostBiteX", pfp: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQJWyvMlk1053PLnD3PRrz2g_LdQtW2H-M-GQ&s"});
|
||||||
typeTournament({action: 1, id: 10, username: "LunarEcho", pfp: "https://hypixel.net/attachments/1928357/"});
|
typeTournament({action: 1, id: 10, username: "LunarEcho", pfp: "https://hypixel.net/attachments/1928357/"});
|
||||||
typeTournament({action: 2,id: 3});
|
typeTournament({action: 2,id: 3});
|
||||||
|
|
||||||
|
typeTournament({action: 3, username: "Eddy", message: "Bonsoir"});
|
||||||
|
typeTournament({action: 4, username: "Eddy", message: "Bonsoir"});
|
@ -6,7 +6,7 @@
|
|||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/10/01 13:29:50 by edbernar #+# #+# */
|
/* Created: 2024/10/01 13:29:50 by edbernar #+# #+# */
|
||||||
/* Updated: 2024/10/02 04:51:32 by edbernar ### ########.fr */
|
/* Updated: 2024/10/02 13:29:36 by edbernar ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -30,6 +30,8 @@ function typeTournament(content)
|
|||||||
TournamentPage.leaveOpponent(content);
|
TournamentPage.leaveOpponent(content);
|
||||||
else if (content.action == 3)
|
else if (content.action == 3)
|
||||||
TournamentPage.newMessage(content);
|
TournamentPage.newMessage(content);
|
||||||
|
else if (content.action == 4)
|
||||||
|
TournamentPage.startGame(content);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
console.warn("Request tournament not for this page...");
|
console.warn("Request tournament not for this page...");
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/09/14 21:20:45 by edbernar #+# #+# */
|
/* Created: 2024/09/14 21:20:45 by edbernar #+# #+# */
|
||||||
/* Updated: 2024/10/01 01:08:24 by edbernar ### ########.fr */
|
/* Updated: 2024/10/02 13:43:43 by edbernar ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -41,14 +41,16 @@ class WaitingGamePage
|
|||||||
sentence.innerText = text + points;
|
sentence.innerText = text + points;
|
||||||
}, 500);
|
}, 500);
|
||||||
timeout = setTimeout(() => {
|
timeout = setTimeout(() => {
|
||||||
console.log("dsadsadas");
|
|
||||||
if (opponentInfo && typeof(opponentInfo) != 'boolean')
|
if (opponentInfo && typeof(opponentInfo) != 'boolean')
|
||||||
sendRequest("game", {action: 0, skinId: lastSelected ? lastSelected.id : 0, opponent: opponentInfo.id});
|
sendRequest("game", {action: 0, skinId: lastSelected ? lastSelected.id : 0, opponent: opponentInfo.id});
|
||||||
else
|
else
|
||||||
sendRequest("game", {action: 0, skinId: lastSelected ? lastSelected.id : 0, isRanked: opponentInfo ? true : false});
|
sendRequest("game", {action: 0, skinId: lastSelected ? lastSelected.id : 0, isRanked: opponentInfo ? true : false});
|
||||||
timeout = null;
|
timeout = null;
|
||||||
}, 1500);
|
}, (opponentInfo && typeof(opponentInfo) != 'boolean' && !opponentInfo.isTournament) ? 1500 : 500);
|
||||||
returnButton.addEventListener('click', returnToLobby);
|
if (!opponentInfo || typeof(opponentInfo) == 'boolean' || (typeof(opponentInfo) != 'boolean' && !opponentInfo.isTournament))
|
||||||
|
returnButton.addEventListener('click', returnToLobby);
|
||||||
|
else
|
||||||
|
returnButton.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
static dispose()
|
static dispose()
|
||||||
|
@ -162,8 +162,13 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
width: 95%;
|
width: 95%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
flex-direction: column;
|
||||||
background-color: #090909;
|
background-color: #090909;
|
||||||
|
align-items: center;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
margin-top: 0;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user