From cdeb5989afcd90eb40086b68a9f1f85f9260da3b Mon Sep 17 00:00:00 2001 From: sebastianjnuwu Date: Mon, 6 Jan 2025 18:53:52 -0300 Subject: [PATCH] feat(version): v1.0.0 --- socket/src/main.js | 1 + www/src/js/cookie/start.js | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/socket/src/main.js b/socket/src/main.js index 0e27622..51eea6f 100644 --- a/socket/src/main.js +++ b/socket/src/main.js @@ -112,6 +112,7 @@ io.on("connection", (socket) => { const room = ROOMS[room_code]; if (!room) return; + if (room.state === "finished") return; // trocar o socket id // Trocar o socket id diff --git a/www/src/js/cookie/start.js b/www/src/js/cookie/start.js index 4eda438..c1c8451 100644 --- a/www/src/js/cookie/start.js +++ b/www/src/js/cookie/start.js @@ -16,17 +16,17 @@ function $message(text) {
${text}
`); } -/* + // connect the server to the socket const socket = io("http://0.0.0.0:3000", { transports: ["websocket", "polling"], -});*/ +});/* const socket = io("https://socket-hj1h.onrender.com", { transports: ["websocket", "polling"], -}); +});*/ -let cookies = localStorage.getItem("cookie") || 0; +let cookies = Number(localStorage.getItem("cookie")) || 0; let $cps = 0; const $update_cps = () => { @@ -42,7 +42,7 @@ const $update_cookies = () => { socket.emit("update_cookies", { room_player: localStorage.getItem("name"), room_code: localStorage.getItem("code"), - cookies: Number.parseInt(localStorage.getItem("cookie")), + cookies }); }; @@ -214,7 +214,7 @@ socket.on("game_end", ({ ranking }) => { $("#cps").text("0"); $("#click-cookie").text("0"); - localStorage.setItem("cookie", null); + localStorage.setItem("cookie", 0); localStorage.setItem("code", null); $(".room-code").hide();