HudLayout beta
Class of @v12-engine/client
export declare class HudLayoutThe layout of the HUD while a game is on (see the top of this file). The client has one: client.layout
Members
constructor
constructor(
storageKey: string | undefined,
spec?: LayoutSpec | undefined,
legacyKey?: string | undefined);Constructs a new instance of the HudLayout class
all
all(): Record<string, Readonly<SectionState>>;Every section that was moved, scaled, folded or locked, by id
collapse
collapse(id: string, collapsed?: boolean): void;Folds a section away to a tab, or opens it with false
edit
edit(on?: boolean): void;Turns the layout mode on or off
editing
editing(): boolean;Whether the layout mode is on: every section shows its box, to move, scale, fold and lock
fromJSON
fromJSON(layout: Record<string, Partial<SectionState>>): void;Puts a layout from toJSON in place of this one
get
get(id: string): Readonly<Section>;A section as it is now, with what the game lets be done with it. Read inside the HUD, it updates as it changes
keep
keep(): void;Keeps the layout for the next game of the same kind, as it is now: after a drag (see set)
lock
lock(id: string, locked?: boolean): void;Locks a section against moves, or unlocks it with false
moveBy
moveBy(id: string, dx: number, dy: number): void;Moves a section by so much more, as the player drags it. Not while it is locked
onChange
onChange(listener: (id: string | undefined) => void): () => void;Calls back when a section changes (with its id), or the layout mode or all of it (with none), until what this gives back is called
reset
reset(id?: string): void;Back to where the game starts it, one section or all of them
set
set(id: string, change: Partial<SectionState>, options?: {
keep?: boolean;
}): void;Changes a section: where it is, how big, folded, locked. What the game does not allow is left as it is. keep: false does not keep it for the next game yet: while it is dragged, kept once it is let go of
toJSON
toJSON(): Record<string, SectionState>;The whole layout as plain data, to keep or send somewhere