show defending region
This commit is contained in:
parent
70b4857933
commit
62204634e1
@ -4,6 +4,7 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ready {
|
#ready {
|
||||||
|
@ -190,11 +190,11 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
socket.emit("message", Packet.createDefense(amount));
|
socket.emit("message", Packet.createDefense(amount));
|
||||||
});
|
});
|
||||||
|
|
||||||
document
|
document.querySelectorAll(".submit-modal, .cancel-modal").forEach((el) => {
|
||||||
.querySelector(".submit-modal, .cancel-modal")
|
el.addEventListener("click", () => {
|
||||||
.addEventListener("click", (el) => {
|
el.closest(".modal").classList.add("hidden");
|
||||||
el.target.closest(".modal").classList.add("hidden");
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
document.querySelector("#shuffleColors").addEventListener("click", () => {
|
document.querySelector("#shuffleColors").addEventListener("click", () => {
|
||||||
Object.values(players).forEach((player) => {
|
Object.values(players).forEach((player) => {
|
||||||
@ -218,6 +218,8 @@ function showRemainingReinforcements() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showDefenseDom() {
|
function showDefenseDom(region) {
|
||||||
document.querySelector("#defense-modal").classList.remove("hidden");
|
const modal = document.querySelector("#defense-modal");
|
||||||
|
modal.querySelector("span").textContent = region;
|
||||||
|
modal.classList.remove("hidden");
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ class Player {
|
|||||||
|
|
||||||
// If we're the defender, we need to send a packet to state our defense.
|
// If we're the defender, we need to send a packet to state our defense.
|
||||||
if (defender.owner === us) {
|
if (defender.owner === us) {
|
||||||
showDefenseDom();
|
showDefenseDom(defender.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab the defense amount from
|
// Grab the defense amount from
|
||||||
|
Loading…
Reference in New Issue
Block a user