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",
|
"code": "FULL",
|
||||||
"error": "Room Full",
|
"error": "Room Full",
|
||||||
"board": room.board.serialize(),
|
"board": room.board.serialize(),
|
||||||
|
"ready": len(room.players) == 2,
|
||||||
"turn": room.turn.value,
|
"turn": room.turn.value,
|
||||||
"state": room.state.value,
|
"state": room.state.value,
|
||||||
"start_time": (
|
"start_time": (
|
||||||
|
|||||||
25
index.html
25
index.html
@@ -177,7 +177,6 @@
|
|||||||
link.href = "/favicon_update.ico";
|
link.href = "/favicon_update.ico";
|
||||||
link.type = "image/x-icon";
|
link.type = "image/x-icon";
|
||||||
}
|
}
|
||||||
console.log("PLAYING SOUND!!");
|
|
||||||
piecemoveSound.currentTime = Math.round(Math.random() * 4) * 0.5;
|
piecemoveSound.currentTime = Math.round(Math.random() * 4) * 0.5;
|
||||||
piecemoveSound.play()
|
piecemoveSound.play()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@@ -197,7 +196,7 @@
|
|||||||
if (state == -1) {
|
if (state == -1) {
|
||||||
document.getElementById('stats').textCotnent = "";
|
document.getElementById('stats').textCotnent = "";
|
||||||
const now = new Date();
|
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 totalSeconds = Math.floor(differenceMs / 1000);
|
||||||
|
|
||||||
const minutes = Math.floor(totalSeconds / 60);
|
const minutes = Math.floor(totalSeconds / 60);
|
||||||
@@ -206,31 +205,31 @@
|
|||||||
const paddedMinutes = String(minutes).padStart(2, '0');
|
const paddedMinutes = String(minutes).padStart(2, '0');
|
||||||
const paddedSeconds = String(seconds).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 (UID === undefined || turn != color) {
|
||||||
if (turn == 0) {
|
if (turn == 0) {
|
||||||
document.getElementById('turn').textCotnent = "White's Turn";
|
document.getElementById('turn').innerText = "White's Turn";
|
||||||
} else if (turn == 0) {
|
} else if (turn == 0) {
|
||||||
document.getElementById('turn').textCotnent = "Black's Turn";
|
document.getElementById('turn').innerText = "Black's Turn";
|
||||||
}
|
}
|
||||||
} else if (turn == color) {
|
} else if (turn == color) {
|
||||||
document.getElementById('turn').textCotnent = "Your Turn";
|
document.getElementById('turn').innerText = "Your Turn";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('turn').textCotnent = "";
|
document.getElementById('turn').innerText = "";
|
||||||
if (state == 0) {
|
if (state == 0) {
|
||||||
document.getElementById('stats').textCotnent = "Tie";
|
document.getElementById('stats').innerText = "Tie";
|
||||||
} else if (state == 1) {
|
} else if (state == 1) {
|
||||||
document.getElementById('stats').textCotnent = "White Won";
|
document.getElementById('stats').innerText = "White Won";
|
||||||
} else if (state == 2) {
|
} else if (state == 2) {
|
||||||
document.getElementById('stats').textCotnent = "Black Won";
|
document.getElementById('stats').innerText = "Black Won";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('turn').textCotnent = "";
|
document.getElementById('turn').innerText = "";
|
||||||
document.getElementById('clock').textCotnent = "";
|
document.getElementById('clock').innerText = "";
|
||||||
document.getElementById('stats').textCotnent = "Waiting for Opponent";
|
document.getElementById('stats').innerText = "Waiting for Opponent";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user