add support for tokens in monitor
This commit is contained in:
parent
ab7f6014a4
commit
f900542765
5 changed files with 56 additions and 37 deletions
|
|
@ -72,15 +72,19 @@ function redraw_clients(me, clients) {
|
|||
return
|
||||
}
|
||||
clear(player_list)
|
||||
const player_tpl = q("template#player").content.firstElementChild
|
||||
for (const c of Object.values(clients)) {
|
||||
if (c.id === me.id) {
|
||||
continue
|
||||
}
|
||||
const player = node("div", { data: { cid: c.id }, cls: "player" })
|
||||
node("div", { cls: "points", text: prettynum(c.points), appendTo: player })
|
||||
node("div", { cls: "box", appendTo: player })
|
||||
node("div", { cls: "name", text: c.name, appendTo: player })
|
||||
player_list.appendChild(player)
|
||||
const player_el = node(player_tpl.cloneNode(true), {
|
||||
data: { cid: c.id },
|
||||
appendTo: player_list,
|
||||
})
|
||||
q(".name", player_el).textContent = c.name
|
||||
q(".points.fg", player_el).textContent = prettynum(c.points)
|
||||
q(".points.bg", player_el).textContent = prettynum(c.points)
|
||||
q(".tokens", player_el).textContent = '🔴 '.repeat(c.tokens)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -135,6 +139,8 @@ function setup_ws() {
|
|||
const client = value.client
|
||||
clients[client.id] = client
|
||||
redraw_clients(me, clients)
|
||||
} else if (type === "control") {
|
||||
// ignore
|
||||
} else if (type === "session_key") {
|
||||
// ignore
|
||||
} else if (type === "error") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue