|
|
|
@@ -34,6 +34,18 @@ function initGamePostSetup(state) { |
|
|
|
field.appendChild(label); |
|
|
|
field.appendChild(bar); |
|
|
|
|
|
|
|
holder.appendChild(field); |
|
|
|
} else if (val.type == "counter") { |
|
|
|
const field = document.createElement("div"); |
|
|
|
field.id = "player-info-" + key; |
|
|
|
field.setAttribute("max", val.max); |
|
|
|
field.setAttribute("value", val.value); |
|
|
|
field.classList.add("counter-holder"); |
|
|
|
|
|
|
|
const counter = document.createElement("div"); |
|
|
|
counter.classList.add("stat-counter"); |
|
|
|
field.appendChild(counter); |
|
|
|
|
|
|
|
holder.appendChild(field); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -76,6 +88,9 @@ function updatePlayerInfo(state) { |
|
|
|
if (val.type == "meter") { |
|
|
|
const field = document.querySelector("#player-info-" + key + " > .stat-bar"); |
|
|
|
field.style.width = (val.value / val.max * 100) + "%"; |
|
|
|
} else if (val.type == "counter") { |
|
|
|
const field = document.querySelector("#player-info-" + key + " > .stat-counter"); |
|
|
|
field.innerText = val.name + ": " + val.value; |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|