mirror of
https://github.com/thib8956/tic-tac-toe-ws.git
synced 2025-08-24 00:11:56 +00:00
Add spectator mode
This commit is contained in:
13
common.ts
13
common.ts
@@ -1,8 +1,8 @@
|
||||
export type MessageKind = "click" | "hello" | "update" | "endgame" | "reset";
|
||||
export type MessageKind = "click" | "hello" | "update" | "endgame" | "reset" | "spectate";
|
||||
|
||||
export interface Message {
|
||||
kind: MessageKind,
|
||||
data: Click | Update | Hello | EndGame | Reset,
|
||||
data: Click | Update | Hello | EndGame | Reset | Spectate,
|
||||
}
|
||||
|
||||
export interface Click {
|
||||
@@ -10,8 +10,10 @@ export interface Click {
|
||||
y: number
|
||||
}
|
||||
|
||||
export type Symbol = "x" | "o";
|
||||
|
||||
export interface Update {
|
||||
last: { x: number, y: number, symbol: "x" | "o" }
|
||||
last: { x: number, y: number, symbol: Symbol }
|
||||
}
|
||||
|
||||
export interface Hello {
|
||||
@@ -25,3 +27,8 @@ export interface EndGame {
|
||||
|
||||
type Reset = undefined;
|
||||
|
||||
|
||||
export interface Spectate {
|
||||
grid: (Symbol | undefined)[]
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user