diff options
author | metamuffin <metamuffin@disroot.org> | 2024-07-21 09:48:34 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-07-21 09:48:34 +0200 |
commit | 15c0d3f4236d43c43178f4cc1fc32171ebb732f7 (patch) | |
tree | 23456a1ad14b3b54da9e3db5e9d7e8bc40f15acc /test-client | |
parent | 55da31ebea01103f9002800a309474ae5242d769 (diff) | |
download | hurrycurry-15c0d3f4236d43c43178f4cc1fc32171ebb732f7.tar hurrycurry-15c0d3f4236d43c43178f4cc1fc32171ebb732f7.tar.bz2 hurrycurry-15c0d3f4236d43c43178f4cc1fc32171ebb732f7.tar.zst |
add menu to test-client
Diffstat (limited to 'test-client')
-rw-r--r-- | test-client/main.ts | 7 | ||||
-rw-r--r-- | test-client/protocol.ts | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/test-client/main.ts b/test-client/main.ts index b497ee36..db474784 100644 --- a/test-client/main.ts +++ b/test-client/main.ts @@ -235,6 +235,13 @@ function packet(p: PacketC) { case "movement_sync": players.get(my_id)!.position = last_server_sent_position break; + case "menu": + switch (p.menu) { + case "book": open("https://s.metamuffin.org/static/hurrycurry/book.pdf"); break + case "score": alert("Your score: " + JSON.stringify(p.data)); break + default: console.warn("unknown menu"); + } + break; default: console.warn("unknown packet", p); } diff --git a/test-client/protocol.ts b/test-client/protocol.ts index c63e820f..432f30e2 100644 --- a/test-client/protocol.ts +++ b/test-client/protocol.ts @@ -64,7 +64,7 @@ export type PacketC = export type Menu = { menu: "book" } - | { menu: "score" } & Score + | { menu: "score", data: Score } export interface Score { points: number, |