- fix some bug on chat
Game
    - fix some bugs for action 7
This commit is contained in:
Kum1ta
2024-09-22 18:01:53 +02:00
parent 0004d2107f
commit b7332b178f
4 changed files with 30 additions and 20 deletions

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/04 19:17:54 by edbernar #+# #+# */
/* Updated: 2024/09/21 17:14:15 by edbernar ### ########.fr */
/* Updated: 2024/09/22 17:16:00 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -38,11 +38,14 @@ function changeButton(user)
const divMessageListChatHome = document.getElementById("messageListChatHome");
const h2Username = document.createElement("h2");
const h2UsernameNode = document.createTextNode(user.name);
const buttonTypeChatHome = document.getElementById('buttonTypeChatHome');
const div = document.createElement('div');
let returnButton = null;
if (buttonTypeChatHome)
buttonTypeChatHome.remove();
divMessageListChatHome.before(div);
div.innerHTML += `
div.innerHTML = `
<p id="returnButton" style="margin: 8px 10px 0 0; text-align: right;">Return</p>
`;
div.setAttribute('id', 'buttonTypeChatHome');

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/04 19:21:10 by edbernar #+# #+# */
/* Updated: 2024/09/21 17:15:11 by edbernar ### ########.fr */
/* Updated: 2024/09/22 17:37:10 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,13 +20,20 @@ function showListUser() {
const buttons = document.getElementById('buttonTypeChatHome');
const infoChat = document.getElementById("infoChat");
const divMessageListChatHome = document.getElementById("messageListChatHome");
let divUser;
let userList;
const inputMessageDiv = document.getElementById("inputMessageDiv");
let listUser;
sendRequest("get_private_list_user", {});
waitForUserList().then((userList) => {
if (buttons)
buttons.remove();
if (inputMessageDiv)
inputMessageDiv.remove();
if (!userList.length)
infoChat.innerText = "No conversation"
{
if (infoChat)
infoChat.innerText = "No conversation"
}
else
{
divMessageListChatHome.style.height = "100%";
@ -35,8 +42,6 @@ function showListUser() {
divMessageListChatHome.scrollTop = 0;
if (infoChat)
infoChat.remove();
if (buttons)
buttons.remove();
userList.forEach(element => {
let user = document.createElement("div");
user.classList.add("user");
@ -50,9 +55,9 @@ function showListUser() {
user.querySelector("h3").innerText = element.name;
divMessageListChatHome.appendChild(user);
});
divUser = divMessageListChatHome.children;
for (let i = 0; i < divUser.length; i++) {
divUser[i].addEventListener("click", async () => {
listUser = divMessageListChatHome.children;
for (let i = 0; i < listUser.length; i++) {
listUser[i].addEventListener("click", async () => {
showPrivateChat(userList[i]);
});
}

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/20 17:02:47 by edbernar #+# #+# */
/* Updated: 2024/09/19 16:16:32 by edbernar ### ########.fr */
/* Updated: 2024/09/22 17:49:04 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -128,7 +128,6 @@ class Ball
this.lastTime = new Date().getTime();
// this.ballBody.position.x = content.pos[0];
// this.ballBody.position.z = content.pos[1];
console.log(this.object.position);
this.lastPos = [content.pos[0], this.object.position.y, content.pos[1]];
this.velocity = content.velocity;
// this.ballBody.velocity.set(content.velocity[0], 0, content.velocity[1]);

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/20 14:52:55 by hubourge #+# #+# */
/* Updated: 2024/09/20 23:05:19 by edbernar ### ########.fr */
/* Updated: 2024/09/22 17:59:07 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -751,15 +751,18 @@ class Map
{
let nbJumper = 0;
listObject.forEach(obj => {
if (obj.type == 1)
listObject = listObject.content;
for (let i = 0; i < listObject.length; i++ )
{
console.log(listObject[i]);
if (listObject[i].type == 1)
{
this.#createGravityChanger(obj.pos.x, obj.pos.y, obj.pos.z, type + i, obj.isUp ? "jumperTop" : "jumperBottom", obj.isUp);
this.#createGravityChanger(listObject[i].pos.x, listObject[i].pos.y, listObject[i].pos.z, "gravityChanger" + i, listObject[i].isUp ? "jumperTop" : "jumperBottom", listObject[i].isUp);
nbJumper++;
}
else if (obj.type == 2)
scene.add(this.#createWallObstacle(obj.pos.x, obj.pos.y, obj.pos.z, obj.isUp));
});
else if (listObject[i].type == 2)
scene.add(this.#createWallObstacle(listObject[i].pos.x, listObject[i].pos.y, listObject[i].pos.z, listObject[i].isUp));
}
}
#generateObstacle()