GameListController beta
Interface of @v12-engine/client
export interface GameListControllerThe games of a server, as its list says them (GET /games): read, read again every few seconds while shown, and one joined or watched. What the Find a game screen shows (findGameScene)
Members
address
address(game: GameListing): string;The address of a game, to connect to: the server's, and its room
draining
readonly draining: Accessor<boolean>;Whether the server takes no new games: stopping
games
readonly games: Accessor<GameListing[]>;The server's games, as last read
join
join(game: GameListing): void;Takes a seat at a game, or watches it
kinds
readonly kinds: Accessor<GameKindListing[]>;The kinds of game the server lets players make (a "New game"), with the settings each offers: none for most
leaveQueue
leaveQueue(): void;Stops waiting
make
make(kind: string, settings?: Record<string, string>): Promise<string | undefined>;Makes a game of a kind the server offers, with settings (the map), and takes a seat at it: its room's name, or nothing when the server said no (said says why)
queue
queue(kind: string, name?: string): void;Waits to be matched with other players for a kind of game (one the server matches for, GameKindListing.queue), and takes a seat at the game made for them once it is: by the ticket the server gives
ratings
readonly ratings: Accessor<RatingsListing | undefined>;The best of a mode where the server keeps ratings (GET /ratings): the top ten, and this browser's player's own place where they played it. Undefined until read, and where the server keeps none
refresh
refresh(): Promise<void>;Reads the list again
refreshRatings
refreshRatings(mode?: string): Promise<void>;Reads the best again, of a mode (the server's first when left out)
said
readonly said: Accessor<string>;What went wrong last, in words: the server is not there. Empty when nothing did
server
readonly server: string;The server, at the address its sockets are: ws://host:8787
start
start(seconds?: number): void;Reads it again every seconds until stop (also called by the screen as it goes)
stop
stop(): void;Stops reading the list every few seconds
waiting
readonly waiting: Accessor<{
kind: string;
waiting: number;
needed: number;
} | undefined>;What is being waited for: the kind, how many wait of how many it takes. None while not waiting
watch
watch(game: GameListing): void;Opens a game to watch rather than play: connects to it and gives the game with no seat