Site/Django
- some change for skin in requests
This commit is contained in:
@ -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";
|
||||
|
||||
|
@ -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,13 +15,14 @@ import * as THREE from '/static/javascript/three/build/three.module.js'
|
||||
let actualBarSelecor = null;
|
||||
let actualGoalSelecter = null;
|
||||
let lastSelected = null;
|
||||
|
||||
class barSelecter
|
||||
{
|
||||
scene = null;
|
||||
renderer = null;
|
||||
camera = null;
|
||||
spotLight = new THREE.SpotLight(0xffffff, 5);
|
||||
availableSkins = [
|
||||
availableSkins = [
|
||||
{id: 0, color: 0xff53aa, texture: null},
|
||||
{id: 1, color: 0xaa24ea, texture: null},
|
||||
{id: 2, color: 0x2c9c49, texture: 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}
|
@ -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,9 +86,11 @@ class LobbyPage
|
||||
listSelectCard[2].removeEventListener('click', selectGameModeThree);
|
||||
listSelectCard[3].removeEventListener('click', selectGameModeFour);
|
||||
listSelectCard = null;
|
||||
barSelector.dispose();
|
||||
if (barSelector)
|
||||
barSelector.dispose();
|
||||
barSelector = null;
|
||||
goalSelector.dispose();
|
||||
if (goalSelector)
|
||||
goalSelector.dispose();
|
||||
goalSelector = null;
|
||||
listSelectCard = null;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user