Merge
This commit is contained in:
@ -195,6 +195,8 @@
|
||||
<p style="text-align: center; margin-bottom: 20px;">Tournament code</p>
|
||||
<input id="tournamentCode" class="search-input" type="text" placeholder="Enter the tournament code (empty for create one)">
|
||||
<span class="line" id="tournament-line2"></span>
|
||||
|
||||
<input type="number" id="nbBot" class="search-input" placeholder="Number of bots (1-7 | default 0)">
|
||||
</div>
|
||||
<div class="skin-select">
|
||||
<div class="barSelection" id="bar2">
|
||||
|
@ -113,8 +113,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<div class="buttonStartGame">
|
||||
<p>Start</p>
|
||||
<div class="buttonStartGame" id="quitButton">
|
||||
<p>Quit</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -6,7 +6,7 @@
|
||||
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/10/01 13:16:39 by edbernar #+# #+# #
|
||||
# Updated: 2024/10/05 02:33:45 by tomoron ### ########.fr #
|
||||
# Updated: 2024/10/10 13:26:17 by edbernar ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@ -48,6 +48,7 @@ from .tournamentActions.fetchAllData import fetchAllData
|
||||
#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
|
||||
# - code : code of the tournament
|
||||
# - nbBot : number of bot in the tournament
|
||||
#
|
||||
# 1 : leave : leave the tournament
|
||||
#
|
||||
|
@ -25,7 +25,7 @@ urlpatterns = [
|
||||
path("multiOnlineGamePage", views.multiOnlineGamePage, name='multiOnlineGamePage'),
|
||||
path("waitingGamePage", views.waitingGamePage, name='waitingGamePage'),
|
||||
path("profilPage", views.profilPage, name='profilPage'),
|
||||
path("game", views.game, name='game'),
|
||||
# path("game", views.game, name='game'),
|
||||
path("wait_game", views.game, name='wait_game'),
|
||||
path("tournament", views.tournament, name='tournament'),
|
||||
path("login42", views.login42, name='login42'),
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/22 17:08:46 by madegryc #+# #+# */
|
||||
/* Updated: 2024/10/08 12:55:12 by edbernar ### ########.fr */
|
||||
/* Updated: 2024/10/10 14:36:51 by edbernar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -43,6 +43,7 @@ class LobbyPage
|
||||
const inputUser = document.getElementById('searchInputUser');
|
||||
const tournamentCodeInput = document.getElementById('tournamentCode');
|
||||
const func = [selectGameModeOne, selectGameModeTwo, selectGameModeThree, selectGameModeFour];
|
||||
const nbBot = document.getElementById('nbBot');
|
||||
|
||||
document.body.style.opacity = 1;
|
||||
if (userMeInfo.id == -1)
|
||||
@ -60,10 +61,16 @@ class LobbyPage
|
||||
initButtonPopMenuLogin();
|
||||
initButtonLaytout();
|
||||
window.addEventListener('click', closePopUpWhenClickOutsite);
|
||||
tournamentCodeInput.addEventListener('keypress', () => {
|
||||
tournamentCodeInput.addEventListener('keypress', (event) => {
|
||||
if (event.key == 'Enter')
|
||||
startTournmament();
|
||||
});
|
||||
tournamentCodeInput.addEventListener('input', () => {
|
||||
if (tournamentCodeInput.value.length == 0)
|
||||
nbBot.style.display = 'flex';
|
||||
else
|
||||
nbBot.style.display = 'none';
|
||||
});
|
||||
listSelectCard = document.getElementsByClassName('select-card');
|
||||
listSelectCard[0].addEventListener('click', selectGameModeOne);
|
||||
listSelectCard[1].addEventListener('click', selectGameModeTwo);
|
||||
@ -178,8 +185,17 @@ function startMatchmaking(ranked)
|
||||
function startTournmament()
|
||||
{
|
||||
const code = document.getElementById('tournamentCode').value;
|
||||
const nbBot = document.getElementById('nbBot').value;
|
||||
|
||||
sendRequest("tournament", {action: 0, code: code});
|
||||
if (code != '')
|
||||
sendRequest("tournament", {action: 0, code: code});
|
||||
else if (nbBot != '')
|
||||
{
|
||||
if (parseInt(nbBot) >= 0 && parseInt(nbBot) <= 7)
|
||||
sendRequest("tournament", {action: 0, code: '', nbBot: parseInt(nbBot)});
|
||||
else
|
||||
CN.new("Error", "You must enter a valid number of bot");
|
||||
}
|
||||
}
|
||||
|
||||
function closePopUpWhenClickOutsite (event)
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/18 00:30:31 by edbernar #+# #+# */
|
||||
/* Updated: 2024/10/08 13:26:01 by edbernar ### ########.fr */
|
||||
/* Updated: 2024/10/10 13:46:36 by edbernar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -145,6 +145,7 @@ class Player
|
||||
this.mapVar.putVideoOnCanvas(3, 'goal');
|
||||
setTimeout(() => {
|
||||
this.mapVar.putVideoOnCanvas(0, null);
|
||||
this.mapVar.putVideoOnCanvas(2, 3);
|
||||
}, 4000);
|
||||
|
||||
ball.setVisibility(false);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/18 00:53:53 by edbernar #+# #+# */
|
||||
/* Updated: 2024/10/09 14:47:25 by edbernar ### ########.fr */
|
||||
/* Updated: 2024/10/10 13:47:22 by edbernar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -149,28 +149,11 @@ class MultiOnlineGamePage
|
||||
}
|
||||
if (e.key == 'c')
|
||||
debug = !debug;
|
||||
if (e.key == 'p')
|
||||
map.putVideoOnCanvas(0, null);
|
||||
if (e.key == 'o')
|
||||
{
|
||||
map.putVideoOnCanvas(3, 'goal');
|
||||
}
|
||||
if (e.key == 'i')
|
||||
map.putVideoOnCanvas(3, 'outstanding');
|
||||
if (e.key == 'u')
|
||||
map.putVideoOnCanvas(3, 3);
|
||||
if (e.key == 'y')
|
||||
map.putVideoOnCanvas(2, 3);
|
||||
if (e.key == 't')
|
||||
map.putVideoOnCanvas(1, 3);
|
||||
if (e.key == 'l')
|
||||
map.reCreate("player");
|
||||
if (e.key == 'k')
|
||||
map.reCreate("opponent");
|
||||
})
|
||||
|
||||
renderer.setAnimationLoop(loop)
|
||||
sendRequest('game', {action: 1});
|
||||
map.putVideoOnCanvas(2, 3);
|
||||
let lastPosition = player.object.position.x;
|
||||
let lastUp = player.isUp;
|
||||
interval = setInterval(() => {
|
||||
@ -197,6 +180,7 @@ class MultiOnlineGamePage
|
||||
if (session)
|
||||
session.end();
|
||||
observer.disconnect();
|
||||
map.putVideoOnCanvas(0, null);
|
||||
VrButton = null;
|
||||
window.removeEventListener('resize', windowUpdater);
|
||||
if (interval)
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/01 13:42:29 by edbernar #+# #+# */
|
||||
/* Updated: 2024/10/08 13:13:38 by edbernar ### ########.fr */
|
||||
/* Updated: 2024/10/10 12:57:56 by edbernar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -50,6 +50,10 @@ class TournamentPage
|
||||
sendRequest("tournament", {action: 3});
|
||||
divTopInfo.innerText = 'Tournament';
|
||||
initTournamentChat();
|
||||
document.getElementById('quitButton').addEventListener('click', () => {
|
||||
sendRequest("tournament", {action: 1});
|
||||
pageRenderer.changePage("lobbyPage", false);
|
||||
});
|
||||
}
|
||||
|
||||
static dispose()
|
||||
|
@ -1,22 +0,0 @@
|
||||
import("/static/javascript/typeResponse/typeTournament.js")
|
||||
.then(module => {
|
||||
window.typeTournament = module.typeTournament;
|
||||
console.log("Module importé : ", typeTournament);
|
||||
})
|
||||
.catch(error => console.error("Erreur d'import :", error));
|
||||
|
||||
typeTournament({action: 0, exist: true, isFull: false, started: false, code: "45FD53"});
|
||||
|
||||
typeTournament({action: 1, id: 3, username: "NeoWander", pfp: "https://www.japanfm.fr/wp-content/uploads/2023/12/gojo-satoru-jjk-scaled.jpg"});
|
||||
typeTournament({action: 1, id: 4, username: "SkyVolt", pfp: "https://i.seadn.io/gae/jCQAQBNKmnS_AZ_2jTqBgBLIVYaRFxLX6COWo-HCHrYJ1cg04oBgDfHvOmpqsWbmUaSfBDHIdrwKtGnte3Ph_VwQPJYJ6VFtAf5B?auto=format&dpr=1&w=1000"});
|
||||
typeTournament({action: 1, id: 5, username: "QuantumFlare", pfp: "https://wallpapers-clan.com/wp-content/uploads/2022/09/one-piece-pfp-1.jpg"});
|
||||
typeTournament({action: 1, id: 6, username: "PixelWhale", pfp: "https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/5e5ff9cd-a751-4cd4-b9c5-00aa21620b7b/deu3q3u-6f1ca041-b5b7-46d7-ab06-f8547a7114cc.jpg/v1/fill/w_748,h_734,q_75,strp/cool_pfp_for_anyone__by_snowierev_deu3q3u-fullview.jpg?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7ImhlaWdodCI6Ijw9NzM0IiwicGF0aCI6IlwvZlwvNWU1ZmY5Y2QtYTc1MS00Y2Q0LWI5YzUtMDBhYTIxNjIwYjdiXC9kZXUzcTN1LTZmMWNhMDQxLWI1YjctNDZkNy1hYjA2LWY4NTQ3YTcxMTRjYy5qcGciLCJ3aWR0aCI6Ijw9NzQ4In1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmltYWdlLm9wZXJhdGlvbnMiXX0.bIIhpuZAj8GkKnWaCQ-QqVf-q58InCQZthNWr5mno7w"});
|
||||
typeTournament({action: 1, id: 7, username: "NovaBlaze", pfp: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRdyTh5ljvubR6s3LeERqK8DHldWwD3DcwBLw&s"});
|
||||
typeTournament({action: 1, id: 8, username: "GlitchPhantom", pfp: "https://images.wondershare.com/filmora/article-images/2022/cool-tiktok-pfp.jpg"});
|
||||
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: 2, id: 3});
|
||||
|
||||
typeTournament({action: 3, username: "Eddy", message: "Bonsoir"});
|
||||
|
||||
typeTournament({action: 4, id:4, username: "Zouave"});
|
@ -6,7 +6,7 @@
|
||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/15 12:00:01 by edbernar #+# #+# */
|
||||
/* Updated: 2024/10/08 03:07:37 by edbernar ### ########.fr */
|
||||
/* Updated: 2024/10/10 13:51:15 by edbernar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -17,7 +17,6 @@ import { pageRenderer } from '/static/javascript/main.js'
|
||||
|
||||
function typeGame(content)
|
||||
{
|
||||
console.log(`New game ${content.action} content: `, content);
|
||||
if (pageRenderer.actualPage == WaitingGamePage)
|
||||
{
|
||||
if (content.action == 1)
|
||||
|
Reference in New Issue
Block a user