Site/Django
- some change for skin in requests
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
|
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2024/09/13 16:20:58 by tomoron #+# #+# #
|
# 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": 0.2, "z": -mapLength / 4}, "isUp": False },
|
||||||
{ "type":1, "pos":{"x": 1.5, "y": 3.2, "z": -mapLength / 4}, "isUp": True }
|
{ "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.p1 = None
|
||||||
self.p2 = None
|
self.p2 = None
|
||||||
self.p1Ready = False
|
self.p1Ready = False
|
||||||
|
@ -76,7 +76,9 @@
|
|||||||
<h1>Chat</h1>
|
<h1>Chat</h1>
|
||||||
<div id="topChatCross"><span>×</span></div>
|
<div id="topChatCross"><span>×</span></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="messageListChatHome">
|
||||||
<p id="infoChat">You are not connected to the chat</p>
|
<p id="infoChat">You are not connected to the chat</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<section class="homeSection">
|
<section class="homeSection">
|
||||||
</section>
|
</section>
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
# ::: :::::::: #
|
# ::: :::::::: #
|
||||||
# ready.py :+: :+: :+: #
|
# ready.py :+: :+: :+: #
|
||||||
# +:+ +:+ +:+ #
|
# +:+ +:+ +:+ #
|
||||||
# By: tomoron <tomoron@student.42.fr> +#+ +:+ +#+ #
|
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2024/09/13 23:41:12 by tomoron #+# #+# #
|
# 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 #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
# ::: :::::::: #
|
# ::: :::::::: #
|
||||||
# start.py :+: :+: :+: #
|
# start.py :+: :+: :+: #
|
||||||
# +:+ +:+ +:+ #
|
# +:+ +:+ +:+ #
|
||||||
# By: tomoron <tomoron@student.42.fr> +#+ +:+ +#+ #
|
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2024/09/11 17:07:08 by tomoron #+# #+# #
|
# 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):
|
if(socket.game != None):
|
||||||
socket.sendError("Game already started", 9102)
|
socket.sendError("Game already started", 9102)
|
||||||
return;
|
return;
|
||||||
Game(socket, content.get("with_bot", False))
|
Game(socket, content.get("with_bot", False), content.get("skinId", 0))
|
||||||
|
|
||||||
|
@ -6,13 +6,11 @@
|
|||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/08/04 19:21:10 by edbernar #+# #+# */
|
/* 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 { 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 { showPrivateChat } from "/static/javascript/liveChat/showPrivateChat.js";
|
||||||
import { sendRequest } from "/static/javascript/websocket.js";
|
import { sendRequest } from "/static/javascript/websocket.js";
|
||||||
|
|
||||||
|
@ -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/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 actualBarSelecor = null;
|
||||||
let actualGoalSelecter = null;
|
let actualGoalSelecter = null;
|
||||||
let lastSelected = null;
|
let lastSelected = null;
|
||||||
|
|
||||||
class barSelecter
|
class barSelecter
|
||||||
{
|
{
|
||||||
scene = null;
|
scene = null;
|
||||||
@ -30,7 +31,7 @@ class barSelecter
|
|||||||
{id: 5, color: null, texture: '/static/img/skin/2.jpg'},
|
{id: 5, color: null, texture: '/static/img/skin/2.jpg'},
|
||||||
{id: 6, color: null, texture: '/static/img/skin/3.jpg'},
|
{id: 6, color: null, texture: '/static/img/skin/3.jpg'},
|
||||||
{id: 7, color: null, texture: '/static/img/skin/4.jpg'},
|
{id: 7, color: null, texture: '/static/img/skin/4.jpg'},
|
||||||
]
|
];
|
||||||
selected = lastSelected ? lastSelected : this.availableSkins[0];
|
selected = lastSelected ? lastSelected : this.availableSkins[0];
|
||||||
bar = this.createBarPlayer(this.selected.color ? this.selected.color : this.selected.texture);
|
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.renderer = new THREE.WebGLRenderer({antialias: true});
|
||||||
this.camera = new THREE.PerspectiveCamera(60, (pos.width - 10) / (pos.height - 10));
|
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.scene.background = new THREE.Color(0x020202);
|
||||||
this.renderer.setSize(pos.width - 10, pos.height - 10);
|
this.renderer.setSize(pos.width - 10, pos.height - 10);
|
||||||
this.scene.add(this.spotLight);
|
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. +#+ +:+ +#+ */
|
/* 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/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[2].removeEventListener('click', selectGameModeThree);
|
||||||
listSelectCard[3].removeEventListener('click', selectGameModeFour);
|
listSelectCard[3].removeEventListener('click', selectGameModeFour);
|
||||||
listSelectCard = null;
|
listSelectCard = null;
|
||||||
|
if (barSelector)
|
||||||
barSelector.dispose();
|
barSelector.dispose();
|
||||||
barSelector = null;
|
barSelector = null;
|
||||||
|
if (goalSelector)
|
||||||
goalSelector.dispose();
|
goalSelector.dispose();
|
||||||
goalSelector = null;
|
goalSelector = null;
|
||||||
listSelectCard = null;
|
listSelectCard = null;
|
||||||
|
@ -6,10 +6,11 @@
|
|||||||
/* 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/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 { sendRequest } from "/static/javascript/websocket.js";
|
||||||
import { pageRenderer } from '/static/javascript/main.js'
|
import { pageRenderer } from '/static/javascript/main.js'
|
||||||
|
|
||||||
@ -37,8 +38,9 @@ class WaitingGamePage
|
|||||||
points = '';
|
points = '';
|
||||||
sentence.innerText = text + points;
|
sentence.innerText = text + points;
|
||||||
}, 500);
|
}, 500);
|
||||||
|
console.log(lastSelected)
|
||||||
timeout = setTimeout(() => {
|
timeout = setTimeout(() => {
|
||||||
sendRequest("game", {action: 0});
|
sendRequest("game", {action: 0, skinId: lastSelected.id});
|
||||||
timeout = null;
|
timeout = null;
|
||||||
}, 1500);
|
}, 1500);
|
||||||
returnButton.addEventListener('click', returnToLobby);
|
returnButton.addEventListener('click', returnToLobby);
|
||||||
|
Reference in New Issue
Block a user