Add event to just update strength numbers
This commit is contained in:
parent
9d1d64f1d9
commit
f645c234ce
@ -56,16 +56,21 @@ function updateMapDom() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showStrengths();
|
||||||
|
|
||||||
|
showRemainingReinforcements();
|
||||||
|
}
|
||||||
|
|
||||||
|
function showStrengths() {
|
||||||
for (let region of Region.getAllRegions()) {
|
for (let region of Region.getAllRegions()) {
|
||||||
const element = document.querySelector(`.node[data-name=${region.name}]`);
|
const element = document.querySelector(`.node[data-name=${region.name}]`);
|
||||||
element.querySelector(".strength").textContent = region.displayStrength();
|
element.querySelector(".strength").textContent = region.displayStrength();
|
||||||
element.style.backgroundColor =
|
element.style.backgroundColor =
|
||||||
region.owner === null ? "white" : region.owner.getColor();
|
region.owner === null ? "white" : region.owner.getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
showRemainingReinforcements();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.addEventListener("updateStrengths", showStrengths);
|
||||||
document.addEventListener("gameStateUpdate", () => {
|
document.addEventListener("gameStateUpdate", () => {
|
||||||
if (!game.isWaiting()) {
|
if (!game.isWaiting()) {
|
||||||
document.querySelector("#ready-button").style.display = "none";
|
document.querySelector("#ready-button").style.display = "none";
|
||||||
|
@ -79,6 +79,7 @@ class Strength {
|
|||||||
let result = proofSessionVerifier.verify(BigInt(data.z));
|
let result = proofSessionVerifier.verify(BigInt(data.z));
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
this.assumedStrength = plainText;
|
this.assumedStrength = plainText;
|
||||||
|
document.dispatchEvent(new CustomEvent("updateStrengths"));
|
||||||
controller.abort();
|
controller.abort();
|
||||||
} else {
|
} else {
|
||||||
console.warn(`Failed to verify ciphertext! ${result}`);
|
console.warn(`Failed to verify ciphertext! ${result}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user