Game
- quit vr when game finish Site - fix xss on live chat
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/18 00:53:53 by edbernar #+# #+# */
|
||||
/* Updated: 2024/10/06 16:04:20 by edbernar ### ########.fr */
|
||||
/* Updated: 2024/10/08 03:10:55 by edbernar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -185,6 +185,10 @@ class MultiOnlineGamePage
|
||||
|
||||
static dispose()
|
||||
{
|
||||
const session = renderer.xr.getSession();
|
||||
|
||||
if (session)
|
||||
session.end();
|
||||
observer.disconnect();
|
||||
VrButton = null;
|
||||
window.removeEventListener('resize', windowUpdater);
|
||||
@ -253,6 +257,8 @@ class MultiOnlineGamePage
|
||||
let intervalEnd = null;
|
||||
let time = 4;
|
||||
|
||||
if (renderer && renderer.xr && renderer.xr.getSession())
|
||||
renderer.xr.getSession().end();
|
||||
if (!map)
|
||||
return ;
|
||||
if (map && map.score)
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/15 12:00:01 by edbernar #+# #+# */
|
||||
/* Updated: 2024/10/06 15:32:02 by edbernar ### ########.fr */
|
||||
/* Updated: 2024/10/08 03:07:37 by edbernar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -14,20 +14,10 @@ import { MultiOnlineGamePage, opponent, ball, player, map } from "/static/javasc
|
||||
import { WaitingGamePage } from "/static/javascript/waitingGame/main.js"
|
||||
import { pageRenderer } from '/static/javascript/main.js'
|
||||
|
||||
let stopSrvUpdate = false
|
||||
|
||||
document.addEventListener('keypress',(e)=>{
|
||||
if(e.key == 'q')
|
||||
{
|
||||
console.log("stopped server updates")
|
||||
stopSrvUpdate = true
|
||||
}
|
||||
});
|
||||
|
||||
function typeGame(content)
|
||||
{
|
||||
if(stopSrvUpdate)
|
||||
return
|
||||
console.log(`New game ${content.action} content: `, content);
|
||||
if (pageRenderer.actualPage == WaitingGamePage)
|
||||
{
|
||||
if (content.action == 1)
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/04 15:15:49 by edbernar #+# #+# */
|
||||
/* Updated: 2024/09/29 14:11:26 by edbernar ### ########.fr */
|
||||
/* Updated: 2024/10/08 02:53:30 by edbernar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -24,15 +24,18 @@ function typeNewPrivateMessage(content)
|
||||
|
||||
if (infoPanel.isOpen && infoPanel.id === content.channel)
|
||||
{
|
||||
const div = document.createElement('div');
|
||||
|
||||
if (content.from != userMeInfo.id)
|
||||
sendRequest("read_message", {id: content.from});
|
||||
messageList.push(content);
|
||||
infoPanel.divMessage.insertAdjacentHTML('beforeend', `
|
||||
<div class="${content.from === userMeInfo.id ? "meMessage" : "opponentMessage"}">
|
||||
<p class="content">${content.content}</p>
|
||||
div.className = content.from === userMeInfo.id ? "meMessage" : "opponentMessage";
|
||||
div.innerHTML = `
|
||||
<p class="content"></p>
|
||||
<p class="time">${content.date}</p>
|
||||
</div>
|
||||
`);
|
||||
`;
|
||||
div.getElementsByClassName('content')[0].innerText = content.content;
|
||||
infoPanel.divMessage.appendChild(div);
|
||||
infoPanel.divMessage.scrollTop = infoPanel.divMessage.scrollHeight;
|
||||
}
|
||||
else if (content.from != userMeInfo.id)
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/07/31 22:17:24 by edbernar #+# #+# */
|
||||
/* Updated: 2024/10/01 13:30:48 by edbernar ### ########.fr */
|
||||
/* Updated: 2024/10/08 03:12:29 by edbernar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -110,6 +110,7 @@ function sendRequest(type, content) {
|
||||
console.warn('Not connected');
|
||||
return ;
|
||||
}
|
||||
console.log(`Send request ${type} content: `, content);
|
||||
if (content instanceof Object)
|
||||
coc = JSON.stringify(content);
|
||||
else
|
||||
|
Reference in New Issue
Block a user