ClientScore beta
Class of @v12-engine/client
export declare class ClientScoreThe 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
constructor(registry: Registry, known: () => ReadonlyMap<PlayerId, PlayerState>, look?: ScoreLook);Constructs a new instance of the ClientScore class
byType
byType(player: PlayerId, id: string): Readonly<Record<string, number>>;A player's numbers of a stat kept by type, by type
counted
get counted(): boolean;Whether the game counts a score at all (RuleSettings.score)
format
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
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
graphStats(): ScoreStatDef[];The stats the graph offers: as the look says, or those on the timeline
hide
hide(): void;Closes the score screen
label
label(stat: ScoreStatDef | string): string;What a stat is called: the look's words, its label, or its id
line
get line(): Accessor<ScoreLineState | undefined>;The timeline this screen was last told. A signal
look
look: ScoreLook;How the game shows it (GameView.hud.score), changed while it runs
on
on(listener: (state: ScoreState | undefined) => void): () => void;Hears each new telling of the numbers. Returns what stops it
players
players(): PlayerState[];The players told of, by team then id, with their names and colours as this screen has them
show
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
get shown(): Accessor<string | false>;The tab the score screen shows, or false while it is closed. A signal
stat
stat(id: string): ScoreStatDef | undefined;A stat by id
state
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
stats(options?: {
hidden?: boolean;
}): readonly ScoreStatDef[];The stats of the game, in order: those it hides (hidden) too when asked
tabs
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
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
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
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
toggle(): void;Opens the score screen where it is closed, closes it where it is open