Compare commits
3 Commits
83b570214a
...
fe7884233c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe7884233c | ||
|
|
83a837f339 | ||
|
|
250ef92502 |
1
app.py
1
app.py
@@ -245,6 +245,7 @@ async def join(request, room_id):
|
||||
"code": "FULL",
|
||||
"error": "Room Full",
|
||||
"board": room.board.serialize(),
|
||||
"ready": len(room.players) == 2,
|
||||
"turn": room.turn.value,
|
||||
"state": room.state.value,
|
||||
"start_time": (
|
||||
|
||||
25
index.html
25
index.html
@@ -177,7 +177,6 @@
|
||||
link.href = "/favicon_update.ico";
|
||||
link.type = "image/x-icon";
|
||||
}
|
||||
console.log("PLAYING SOUND!!");
|
||||
piecemoveSound.currentTime = Math.round(Math.random() * 4) * 0.5;
|
||||
piecemoveSound.play()
|
||||
.then(() => {
|
||||
@@ -197,7 +196,7 @@
|
||||
if (state == -1) {
|
||||
document.getElementById('stats').textCotnent = "";
|
||||
const now = new Date();
|
||||
const differenceMs = Math.abs(start_time.getTime() - now.getTime());
|
||||
const differenceMs = 30 * 60 * 1000 - Math.abs(start_time.getTime() - now.getTime());
|
||||
const totalSeconds = Math.floor(differenceMs / 1000);
|
||||
|
||||
const minutes = Math.floor(totalSeconds / 60);
|
||||
@@ -206,31 +205,31 @@
|
||||
const paddedMinutes = String(minutes).padStart(2, '0');
|
||||
const paddedSeconds = String(seconds).padStart(2, '0');
|
||||
|
||||
document.getElementById('clock').textCotnent = `${paddedMinutes}:${paddedSeconds}`;
|
||||
document.getElementById('clock').innerText = `${paddedMinutes}:${paddedSeconds}`;
|
||||
|
||||
if (UID === undefined || turn != color) {
|
||||
if (turn == 0) {
|
||||
document.getElementById('turn').textCotnent = "White's Turn";
|
||||
document.getElementById('turn').innerText = "White's Turn";
|
||||
} else if (turn == 0) {
|
||||
document.getElementById('turn').textCotnent = "Black's Turn";
|
||||
document.getElementById('turn').innerText = "Black's Turn";
|
||||
}
|
||||
} else if (turn == color) {
|
||||
document.getElementById('turn').textCotnent = "Your Turn";
|
||||
document.getElementById('turn').innerText = "Your Turn";
|
||||
}
|
||||
} else {
|
||||
document.getElementById('turn').textCotnent = "";
|
||||
document.getElementById('turn').innerText = "";
|
||||
if (state == 0) {
|
||||
document.getElementById('stats').textCotnent = "Tie";
|
||||
document.getElementById('stats').innerText = "Tie";
|
||||
} else if (state == 1) {
|
||||
document.getElementById('stats').textCotnent = "White Won";
|
||||
document.getElementById('stats').innerText = "White Won";
|
||||
} else if (state == 2) {
|
||||
document.getElementById('stats').textCotnent = "Black Won";
|
||||
document.getElementById('stats').innerText = "Black Won";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
document.getElementById('turn').textCotnent = "";
|
||||
document.getElementById('clock').textCotnent = "";
|
||||
document.getElementById('stats').textCotnent = "Waiting for Opponent";
|
||||
document.getElementById('turn').innerText = "";
|
||||
document.getElementById('clock').innerText = "";
|
||||
document.getElementById('stats').innerText = "Waiting for Opponent";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user