This commit is contained in:
Kum1ta
2024-10-01 21:30:56 +02:00
parent a8863ad379
commit 2e133231da
6 changed files with 57 additions and 27 deletions

View File

@ -28,18 +28,30 @@
</div> </div>
</div> </div>
<div class="popup-background" id="popup-background"> <div class="popup-background" id="popup-skin-selector">
<div class="popup-skin"> <div class="popup-skin">
<h1>Select your skin</h1> <h1>Select your skin</h1>
<div class="color-grid"> <div class="color-grid">
<div class="color-box"></div> <div class="color-box color-box-skin"></div>
<div class="color-box"></div> <div class="color-box color-box-skin"></div>
<div class="color-box"></div> <div class="color-box color-box-skin"></div>
<div class="color-box"></div> <div class="color-box color-box-skin"></div>
<div class="color-box"></div> <div class="color-box color-box-skin"></div>
<div class="color-box"></div> <div class="color-box color-box-skin"></div>
<div class="color-box"></div> <div class="color-box color-box-skin"></div>
<div class="color-box"></div> <div class="color-box color-box-skin"></div>
</div>
</div>
</div>
<div class="popup-background" id="popup-goal-selector">
<div class="popup-skin">
<h1>Select your skin</h1>
<div class="color-grid">
<div class="color-box color-box-goal"></div>
<div class="color-box color-box-goal"></div>
<div class="color-box color-box-goal"></div>
<div class="color-box color-box-goal"></div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -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/01 14:00:29 by edbernar ### ########.fr # # Updated: 2024/10/01 17:49:33 by edbernar ### ########.fr #
# # # #
# **************************************************************************** # # **************************************************************************** #
@ -18,16 +18,22 @@
# - isFull : true/false # - isFull : true/false
# - started : true/false # - started : true/false
# - code : code of the tournament # - code : code of the tournament
#
# 1 : someoneJoin : tell the client someone join the tournament (considering clients will place selon the order of the join) # 1 : someoneJoin : tell the client someone join the tournament (considering clients will place selon the order of the join)
# - id : id of the player # - id : id of the player
# - name : name of the player # - username : name of the player
# - pfp : pfp of the player # - pfp : pfp of the player
#
# 2 : someoneLeave : tell the client someone leave the tournament (if game not started, players will be replaced in the order of the join) # 2 : someoneLeave : tell the client someone leave the tournament (if game not started, players will be replaced in the order of the join)
# - id : id of the player who leave # - id : id of the player who leave
#client actions (actions sent by the client) : #client actions (actions sent by the client) :
# 0 : start : start a tournament. if code == "", create a new tournament, else join the tournament with the code # 0 : start : start a tournament. if code == "", create a new tournament, else join the tournament with the code
# - code : code of the tournament # - code : code of the tournament
# 1 : leave : leave the tournament # 1 : leave : leave the tournament
#
# 2 : message tournament : send a message to the tournament chat
# - message : message to send

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */ /* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/13 13:59:46 by edbernar #+# #+# */ /* Created: 2024/09/13 13:59:46 by edbernar #+# #+# */
/* Updated: 2024/09/30 23:53:04 by edbernar ### ########.fr */ /* Updated: 2024/10/01 19:55:19 by edbernar ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -64,8 +64,8 @@ class barSelecter
availableSkins[6].texture = files.skinThreeTexture; availableSkins[6].texture = files.skinThreeTexture;
availableSkins[7].texture = files.skinFourTexture; availableSkins[7].texture = files.skinFourTexture;
div.addEventListener('click', () => { div.addEventListener('click', () => {
const popup = document.getElementById('popup-background'); const popup = document.getElementById('popup-skin-selector');
const skins = document.getElementsByClassName('color-box'); const skins = document.getElementsByClassName('color-box-skin');
popup.style.display = 'flex'; popup.style.display = 'flex';
for (let i = 0; i < skins.length; i++) for (let i = 0; i < skins.length; i++)
@ -80,20 +80,20 @@ class barSelecter
} }
popup.removeEventListener('click', this.hideSkinSelector); popup.removeEventListener('click', this.hideSkinSelector);
popup.addEventListener('click', this.hideSkinSelector); popup.addEventListener('click', this.hideSkinSelector);
}) });
} }
hideSkinSelector(event) hideSkinSelector(event)
{ {
const popup = document.getElementById('popup-background'); const popup = document.getElementById('popup-skin-selector');
if (event.target.getAttribute('class') == 'popup-background') if (event.target.getAttribute('class') == 'popup-skin-selector')
popup.style.display = 'none'; popup.style.display = 'none';
} }
changeSkin (event) changeSkin (event)
{ {
const popup = document.getElementById('popup-background'); const popup = document.getElementById('popup-skin-selector');
const id = event.target.getAttribute('skinId'); const id = event.target.getAttribute('skinId');
popup.style.display = 'none'; popup.style.display = 'none';

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */ /* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/22 17:08:46 by madegryc #+# #+# */ /* Created: 2024/08/22 17:08:46 by madegryc #+# #+# */
/* Updated: 2024/10/01 15:12:03 by edbernar ### ########.fr */ /* Updated: 2024/10/01 16:46:24 by edbernar ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -68,6 +68,12 @@ class LobbyPage
{ {
document.body.children[i].style.animation = 'animShowMenuDiv 0.5s'; document.body.children[i].style.animation = 'animShowMenuDiv 0.5s';
} }
setTimeout(() => {
for (let i = 0; i < document.body.children.length; i++)
{
document.body.children[i].style.animation = null;
}
}, 600);
startButton.addEventListener('click', startMode); startButton.addEventListener('click', startMode);
methButton.addEventListener('click', goBackHome); methButton.addEventListener('click', goBackHome);
document.getElementsByClassName('menuSelected')[gameMode].style.display = 'flex'; document.getElementsByClassName('menuSelected')[gameMode].style.display = 'flex';

View File

@ -3,10 +3,10 @@
/* ::: :::::::: */ /* ::: :::::::: */
/* Map.js :+: :+: :+: */ /* Map.js :+: :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ +:+ +:+ */
/* By: hubourge <hubourge@student.42.fr> +#+ +:+ +#+ */ /* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/20 14:52:55 by hubourge #+# #+# */ /* Created: 2024/08/20 14:52:55 by hubourge #+# #+# */
/* Updated: 2024/09/30 18:13:05 by hubourge ### ########.fr */ /* Updated: 2024/10/01 19:42:54 by edbernar ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -1122,4 +1122,4 @@ function createRing(colorO) {
return new THREE.Mesh(geometry, material); return new THREE.Mesh(geometry, material);
} }
export { Map }; export { Map, createStar, createBox, createRectangle, createRing, colorList };

View File

@ -6,7 +6,7 @@
/* 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/01 14:15:12 by edbernar ### ########.fr */ /* Updated: 2024/10/01 18:36:53 by edbernar ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -21,17 +21,21 @@ const playerList = {
player15: {id: 0, name: null, pfp: null}, player15: {id: 0, name: null, pfp: null},
player16: {id: 0, name: null, pfp: null}, player16: {id: 0, name: null, pfp: null},
}; };
let divInfo = null;
class TournamentPage class TournamentPage
{ {
static create(code) static create(code)
{ {
console.log("Code game : ", code); divInfo = document.getElementById('code-tournament');
document.getElementById('code-tournament').innerText = code;
divInfo.innerText = 'Tournament';
} }
static dispose() static dispose()
{ {
divInfo = null;
} }
static newOpponent(content) static newOpponent(content)
@ -50,8 +54,8 @@ class TournamentPage
console.warn("Tournament is full."); console.warn("Tournament is full.");
return ; return ;
} }
console.warn('Put pfp on player' + playerNb[i]); document.getElementById('user-' + playerNb[i]).innerText = content.username;
console.warn('Put username on player' + playerNb[i]); document.getElementById('pfp-' + playerNb[i]).style.backgroundImage = `url(${content.pfp})`;
playerList['player' + playerNb[i]].id = content.id; playerList['player' + playerNb[i]].id = content.id;
playerList['player' + playerNb[i]].pfp = content.pfp; playerList['player' + playerNb[i]].pfp = content.pfp;
playerList['player' + playerNb[i]].username = content.username; playerList['player' + playerNb[i]].username = content.username;
@ -73,6 +77,8 @@ class TournamentPage
console.warn(`Opponent can't be remove cause he is not in this tournament`); console.warn(`Opponent can't be remove cause he is not in this tournament`);
return ; return ;
} }
document.getElementById('user-' + playerNb[i]).innerText = "Nobody";
document.getElementById('pfp-' + playerNb[i]).style.backgroundImage = null;
while (i < playerNb.length - 1) while (i < playerNb.length - 1)
{ {
playerList['player' + playerNb[i]] = playerList['player' + playerNb[i + 1]]; playerList['player' + playerNb[i]] = playerList['player' + playerNb[i + 1]];