Skip to content

Commit

Permalink
refactor: ajustar formatação e estilo do código em arquivos JavaScrip…
Browse files Browse the repository at this point in the history
…t e CSS
  • Loading branch information
sebastianjnuwu committed Jan 1, 2025
1 parent d89ecfb commit 684f8e5
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 155 deletions.
6 changes: 2 additions & 4 deletions www/src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ $(() => {
$("start-screen button").on("click", () => $("#click")[0].play());

$("#play").on("click", () => {

// $("start-screen").remove();
// $("ui").show();
// $("start-screen").remove();
// $("ui").show();
});

});
23 changes: 10 additions & 13 deletions www/src/js/socket.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const socket = io('http://192.168.1.106:3000', {
transports: ['websocket', 'polling']
const socket = io("http://192.168.1.106:3000", {
transports: ["websocket", "polling"],
});

const $countdown = $("#countdown-container");
Expand All @@ -8,44 +8,41 @@ const code = $("#current_code");
const online = $("#online");

socket.emit("room", {
code: null,
nickname: "sebastianjnuwu",
code: null,
nickname: "sebastianjnuwu",
});

socket.on("error", (err) => {
alert(err.message);
});

socket.on('update_room', (room) => {
socket.on("update_room", (room) => {
code.text(room.code);
online.text(room.players.length);
});

$("#start-game").on("click", () => {
socket.emit("start_game", {
code: code.text(),
})
});
});

socket.on("count_down", ({ countdown }) => {

$(".waiting-room").remove();
$countdown.show();
$(".waiting-room").remove();
$countdown.show();

if (countdown > 0) {
countdown_text.text(countdown);
countdown_text.text(countdown);
} else {
countdown_text.text("GO!");
countdown_text.text("GO!");

setTimeout(() => {
$countdown.remove();
$(".game").show();
}, 1000);

}
});

socket.on("started_game", (oi) => {
console.log(oi);
});

Loading

0 comments on commit 684f8e5

Please sign in to comment.