From 6a39dc214a877515bc2d5494b5975b513f4c1628 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sun, 17 Apr 2022 20:58:21 +0200 Subject: show player names in visualizer --- web/pw-server/src/lib/components/Visualizer.svelte | 31 +++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'web/pw-server/src/lib/components') diff --git a/web/pw-server/src/lib/components/Visualizer.svelte b/web/pw-server/src/lib/components/Visualizer.svelte index a1da923..8517a39 100644 --- a/web/pw-server/src/lib/components/Visualizer.svelte +++ b/web/pw-server/src/lib/components/Visualizer.svelte @@ -4,9 +4,22 @@ import init_wasm_module from "planetwars-rs"; export let matchLog = null; + export let matchData: object; // match object as returned by api let initialized = false; + const PLAYER_COLORS = [ + "#ff8000", + "#0080ff", + "#ff6693", + "#3fcb55", + "#cbc33f", + "#cf40e9", + "#ff3f0d", + "#1beef0", + "#0dc5ff", + ]; + onMount(async () => { await init_wasm_module(); @@ -44,7 +57,11 @@
-
+
    + {#each matchData["players"] as player, i} +
  • {player["bot_name"] || "player"}
  • + {/each} +
0 / 0
@@ -70,4 +87,16 @@ -- cgit v1.2.3