Site/Django

- some change for skin in requests
This commit is contained in:
Kum1ta
2024-09-25 13:10:49 +02:00
parent 7b49d011df
commit 799b298625
8 changed files with 37 additions and 20 deletions

View File

@ -6,7 +6,7 @@
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/09/13 16:20:58 by tomoron #+# #+# #
# Updated: 2024/09/22 16:10:51 by tomoron ### ########.fr #
# Updated: 2024/09/25 13:02:29 by edbernar ### ########.fr #
# #
# **************************************************************************** #
@ -44,8 +44,18 @@ class Game:
{ "type":1, "pos":{"x": 1.5, "y": 0.2, "z": -mapLength / 4}, "isUp": False },
{ "type":1, "pos":{"x": 1.5, "y": 3.2, "z": -mapLength / 4}, "isUp": True }
]
skins = [
{id: 0, 'color': 0xff53aa, 'texture': None},
{id: 1, 'color': 0xaa24ea, 'texture': None},
{id: 2, 'color': 0x2c9c49, 'texture': None},
{id: 3, 'color': 0x101099, 'texture': None},
{id: 4, 'color': None, 'texture': '/static/img/skin/1.jpg'},
{id: 5, 'color': None, 'texture': '/static/img/skin/2.jpg'},
{id: 6, 'color': None, 'texture': '/static/img/skin/3.jpg'},
{id: 7, 'color': None, 'texture': '/static/img/skin/4.jpg'},
]
def __init__(self, socket, withBot):
def __init__(self, socket, withBot, skinId):
self.p1 = None
self.p2 = None
self.p1Ready = False

View File

@ -76,8 +76,10 @@
<h1>Chat</h1>
<div id="topChatCross"><span>&times;</span></div>
</div>
<div id="messageListChatHome">
<p id="infoChat">You are not connected to the chat</p>
</div>
</div>
<section class="homeSection">
</section>
<section class="homeSection relative" id="project">

View File

@ -3,10 +3,10 @@
# ::: :::::::: #
# ready.py :+: :+: :+: #
# +:+ +:+ +:+ #
# By: tomoron <tomoron@student.42.fr> +#+ +:+ +#+ #
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/09/13 23:41:12 by tomoron #+# #+# #
# Updated: 2024/09/15 13:37:23 by tomoron ### ########.fr #
# Updated: 2024/09/25 09:19:46 by edbernar ### ########.fr #
# #
# **************************************************************************** #

View File

@ -3,10 +3,10 @@
# ::: :::::::: #
# start.py :+: :+: :+: #
# +:+ +:+ +:+ #
# By: tomoron <tomoron@student.42.fr> +#+ +:+ +#+ #
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/09/11 17:07:08 by tomoron #+# #+# #
# Updated: 2024/09/15 13:33:53 by tomoron ### ########.fr #
# Updated: 2024/09/25 09:23:02 by edbernar ### ########.fr #
# #
# **************************************************************************** #
@ -16,5 +16,5 @@ async def start(socket, content):
if(socket.game != None):
socket.sendError("Game already started", 9102)
return;
Game(socket, content.get("with_bot", False))
Game(socket, content.get("with_bot", False), content.get("skinId", 0))

View File

@ -6,13 +6,11 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/04 19:21:10 by edbernar #+# #+# */
/* Updated: 2024/09/22 17:37:10 by edbernar ### ########.fr */
/* Updated: 2024/09/25 08:50:20 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
import { waitForUserList } from "/static/javascript/typeResponse/typePrivateListUser.js";
import { waitForallListUser } from "/static/javascript/typeResponse/typeAllListUser.js";
import { userList } from "/static/javascript/typeResponse/typePrivateListUser.js";
import { showPrivateChat } from "/static/javascript/liveChat/showPrivateChat.js";
import { sendRequest } from "/static/javascript/websocket.js";

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/13 13:59:46 by edbernar #+# #+# */
/* Updated: 2024/09/25 00:05:55 by edbernar ### ########.fr */
/* Updated: 2024/09/25 09:17:42 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -15,6 +15,7 @@ import * as THREE from '/static/javascript/three/build/three.module.js'
let actualBarSelecor = null;
let actualGoalSelecter = null;
let lastSelected = null;
class barSelecter
{
scene = null;
@ -30,7 +31,7 @@ class barSelecter
{id: 5, color: null, texture: '/static/img/skin/2.jpg'},
{id: 6, color: null, texture: '/static/img/skin/3.jpg'},
{id: 7, color: null, texture: '/static/img/skin/4.jpg'},
]
];
selected = lastSelected ? lastSelected : this.availableSkins[0];
bar = this.createBarPlayer(this.selected.color ? this.selected.color : this.selected.texture);
@ -41,6 +42,8 @@ class barSelecter
this.renderer = new THREE.WebGLRenderer({antialias: true});
this.camera = new THREE.PerspectiveCamera(60, (pos.width - 10) / (pos.height - 10));
if (!lastSelected)
lastSelected = this.availableSkins[0];
this.scene.background = new THREE.Color(0x020202);
this.renderer.setSize(pos.width - 10, pos.height - 10);
this.scene.add(this.spotLight);
@ -206,4 +209,4 @@ class goalSelecter
}
}
export { barSelecter, goalSelecter }
export { barSelecter, goalSelecter, lastSelected}

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/22 17:08:46 by madegryc #+# #+# */
/* Updated: 2024/09/24 23:56:38 by edbernar ### ########.fr */
/* Updated: 2024/09/25 09:05:07 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -86,8 +86,10 @@ class LobbyPage
listSelectCard[2].removeEventListener('click', selectGameModeThree);
listSelectCard[3].removeEventListener('click', selectGameModeFour);
listSelectCard = null;
if (barSelector)
barSelector.dispose();
barSelector = null;
if (goalSelector)
goalSelector.dispose();
goalSelector = null;
listSelectCard = null;

View File

@ -6,10 +6,11 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/14 21:20:45 by edbernar #+# #+# */
/* Updated: 2024/09/21 22:35:05 by edbernar ### ########.fr */
/* Updated: 2024/09/25 09:06:34 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
import { lastSelected } from '/static/javascript/lobbyPage/3d.js';
import { sendRequest } from "/static/javascript/websocket.js";
import { pageRenderer } from '/static/javascript/main.js'
@ -37,8 +38,9 @@ class WaitingGamePage
points = '';
sentence.innerText = text + points;
}, 500);
console.log(lastSelected)
timeout = setTimeout(() => {
sendRequest("game", {action: 0});
sendRequest("game", {action: 0, skinId: lastSelected.id});
timeout = null;
}, 1500);
returnButton.addEventListener('click', returnToLobby);