Skip to content

ClientScore beta ​

Class of @v12-engine/client

ts
export declare class ClientScore

The score as this screen is told it (client.score): the numbers (state, a signal), the timeline (line), what each stat is (stats, from the game's rules), read by player, by team, by type, and written as the game wants (format); heard of as it changes (on); and the score screen opened and closed (show, hide, shown)

Members ​

constructor ​

ts
constructor(registry: Registry, known: () => ReadonlyMap<PlayerId, PlayerState>, look?: ScoreLook);

Constructs a new instance of the ClientScore class

byType ​

ts
byType(player: PlayerId, id: string): Readonly<Record<string, number>>;

A player's numbers of a stat kept by type, by type

counted ​

ts
get counted(): boolean;

Whether the game counts a score at all (RuleSettings.score)

format ​

ts
format(stat: ScoreStatDef | string, value: number): string;

A number of a stat as it reads: as the look says, else by the stat's format

get ​

ts
get(player: PlayerId, id: string): number | undefined;

A player's number of a stat, as last told: 0 for one not counted, undefined for a player not told of

graphStats ​

ts
graphStats(): ScoreStatDef[];

The stats the graph offers: as the look says, or those on the timeline

hide ​

ts
hide(): void;

Closes the score screen

label ​

ts
label(stat: ScoreStatDef | string): string;

What a stat is called: the look's words, its label, or its id

line ​

ts
get line(): Accessor<ScoreLineState | undefined>;

The timeline this screen was last told. A signal

look ​

ts
look: ScoreLook;

How the game shows it (GameView.hud.score), changed while it runs

on ​

ts
on(listener: (state: ScoreState | undefined) => void): () => void;

Hears each new telling of the numbers. Returns what stops it

players ​

ts
players(): PlayerState[];

The players told of, by team then id, with their names and colours as this screen has them

show ​

ts
show(tab?: string): void;

Opens the score screen, at a tab (its first when left out). Nothing in a game that counts no score

shown ​

ts
get shown(): Accessor<string | false>;

The tab the score screen shows, or false while it is closed. A signal

stat ​

ts
stat(id: string): ScoreStatDef | undefined;

A stat by id

state ​

ts
get state(): Accessor<ScoreState | undefined>;

The numbers this screen was last told: of the players it may see, as the rules say. A signal

stats ​

ts
stats(options?: {
        hidden?: boolean;
    }): readonly ScoreStatDef[];

The stats of the game, in order: those it hides (hidden) too when asked

tabs ​

ts
tabs(): ScoreTab[];

The tabs of the score screen: the categories in the rules' order, then the graph where there is a timeline; less what the look hides

take ​

ts
take(state: ScoreState | undefined, line: ScoreLineState | undefined): void;

Takes what the last snapshot said: the client's frame does, with the very objects the session keeps while nothing changed

team ​

ts
team(team: number, id: string): number;

A team's number of a stat, of its players told of: added up, or the most or the least of them for max and min

timeline ​

ts
timeline(player: PlayerId, id: string, tickRate?: number): {
        seconds: number[];
        values: number[];
    };

A player's timeline of a stat: its points' times in seconds, and the number at each

toggle ​

ts
toggle(): void;

Opens the score screen where it is closed, closes it where it is open