Settings beta
Class of @v12-engine/client
export declare class Settings implements SettingsLikeThe settings of a running game: their definitions, their values as signals and their store, with the client's own and the game's after them
Members
constructor
constructor(client: GameClientApi,
game: GameSettings | undefined,
store?: SettingsStore,
languages?: Languages);Constructs a new instance of the Settings class
applyAll
applyAll(): void;Puts every value to use: the client does, once what they act on is there
def
def(id: string): SettingDef | undefined;The setting of an id, as it is defined
get
get<V extends SettingValue = SettingValue>(id: string): V;What a setting is set to now. A signal: what reads it follows it
list
readonly list: Accessor<readonly SettingDef[]>;Every setting there is, in order: the client's, the game's own after them
onChange
onChange(listener: (id: string, value: SettingValue) => void): () => void;Told each time a setting changes. Gives back what stops it
ready
readonly ready: Promise<void>;Done when what was kept is read and in use. Never rejects: a store that cannot be read leaves the defaults
reset
reset(id?: string): void;Puts one setting, or every one on the settings screen (not those that are hidden), back to what it is when nothing is set
set
set(id: string, value: SettingValue): void;Sets a setting: made to fit it, put to use, kept for the next games, and told to who listens
shown
shown(def: SettingDef): boolean;Whether the settings screen lists a setting: not hidden, and its own shown says yes for the client
snapshot
snapshot(): Record<string, SettingValue>;Every value, as plain data