Ui beta
Interface of @v12-engine/client
export interface UiThe HUD's model: what it shows, in signals, the client writes and components read (client.ui)
Members
addedParts
addedParts: Accessor<readonly HudWidgetDef[]>;The parts the game added to the HUD, besides its own
batch
batch: <T>(fn: Accessor<T>) => T;Runs what sets several of these, and has the screen take them together, once it is done: what shows the selection and its commands never sees one of now with the other of before
cardSize
cardSize: Accessor<{
columns: number;
rows: number;
}>;How many columns and rows the command card has
chatLines
chatLines: Accessor<readonly ChatLine[]>;The lines of chat on the screen now, for a while each
chatOpen
chatOpen: Accessor<'allies' | 'all' | null>;Which chat the player is typing in, allies or all; null while none is open
choice
choice: Accessor<ChoiceShown | null>;The choice a cinematic asks now, with the way to pick (C3), or none
cinematic
cinematic: Accessor<CinematicInfo | null>;A cinematic playing: the HUD makes way for it
clock
clock: Accessor<ClockInfo | null>;The time of day, for a game that has days; null where there is none
commands
commands: Accessor<CommandButton[]>;The buttons of the command card
connection
connection: Accessor<ConnectionState>;How the connection to the server is: connected, trying or lost
debugOpen
debugOpen: Accessor<boolean>;Whether the debug panel is up
debugVersion
debugVersion: Accessor<number>;Bumped when a debug toggle changes, so the panel re-reads them
dialogLook
dialogLook: Accessor<DialogLook>;How the dialog box looks: the view's, and what code changed of it
dialogPrefs
dialogPrefs: Accessor<DialogPrefs>;What the player set of the dialog: subtitles or not, how fast lines are typed (the settings)
dispose
dispose(): void;Stops what is waiting to take a line of chat or a message off the screen
fade
fade: Accessor<{
opacity: number;
seconds: number;
}>;The screen blacked out, as far as it is (see GameClient.fade)
filterMessage
filterMessage: ((text: string, kind: UiMessage['kind']) => string | null | undefined) | undefined;What says something in the middle of the screen goes through first, where the game has a say (GameView.hud.onMessage): other words, or null for none
formation
formation: Accessor<string | undefined>;The formation the player's orders to a point take, by id; the rules' when undefined (controller.setFormation)
game
game: Accessor<GameInfo>;What the game itself puts on the HUD
groups
groups: Accessor<GroupInfo[]>;The control groups the player made, for the row of groups
hiddenParts
hiddenParts: Accessor<ReadonlySet<string>>;The ids of the HUD's parts the game hid
hints
hints(): boolean;Whether the rules' hints are shown (the settings' Hints), and showing them or not
hovered
hovered: Accessor<string | undefined>;The id of the button the pointer is over (controller.hover)
hudConsole
hudConsole: Accessor<HudConsole>;How the HUD's console is laid out (HudConsole): centred, or in the corners
hudHidden
hudHidden: Accessor<boolean>;The HUD is hidden (see client.hideHud): lines of dialog still show
hudKept
hudKept: Accessor<ReadonlySet<string> | null>;The parts that stay while the HUD is hidden, or null for none (see PlayOptions.hud)
hudSize
hudSize: Accessor<number>;How big the HUD is drawn, times its usual size: 1 as it is (the setting HUD size, 0.5 to 2)
idleWorkers
idleWorkers: Accessor<number>;How many of the player's workers are idle
legend
legend: Accessor<boolean>;Whether the list of shortcuts is up
levels
levels: Accessor<Readonly<Record<Bus | 'master', number>>>;The volumes the player set (sounds.setLevel)
line
line: Accessor<LineInfo | null>;The line of dialog said to the player now
log
log: Accessor<readonly MessageLogLine[]>;What was said so far on the screen and in the chat, the newest last
logOpen
logOpen: Accessor<boolean>;Whether the window of the log is up
messages
messages: Accessor<UiMessage[]>;The messages said on the screen now, for a while each
minimapLook
minimapLook: Accessor<MinimapLook>;The game's say over the minimap now (MinimapLook)
mode
mode: Accessor<ModeInfo>;What the pointer is doing: normal, aiming an ability, placing a building
muted
muted: Accessor<boolean>;Whether all sound is off (sounds.setMuted)
objectives
objectives: Accessor<ObjectiveInfo[]>;What the player is set to do, in a mission
outcome
outcome: Accessor<Outcome>;How the game ended for the player: playing, won or lost
places
places: Accessor<HudPlaces>;The places of the HUD's layout, in the HUD's pixels (HudPlaces)
portraitBoxes
portraitBoxes: Accessor<number>;How many portrait boxes of the HUD are up (the selection's sheet, the group's panel, the hero's): a line's speaker talks there (DialogLook.portraitIn)
portraits
portraits: Accessor<HudPortraits>;What the selection's sheet and the hero's panel show as faces (HudPortraits)
pushChat
pushChat(line: Omit<ChatLine, 'id'>): void;A line of chat for the screen, for a while
pushLog
pushLog(entry: Omit<MessageLogLine, 'id' | 'tick'> & {
tick?: number;
}): void;Puts a line in the log, as the client does with every message and line of chat: a game's own too
pushMessage
pushMessage(text: string, kind?: UiMessage['kind'], seconds?: number): void;Says something in the middle of the screen for a while: seconds when that is not the usual few
quickCast
quickCast: Accessor<boolean>;Quick cast: a key casts at the pointer at once (controller.setQuickCast)
renderer
renderer: Accessor<HudRenderer>;What draws the game: the renderer, the graphics card (HudRenderer)
resources
resources: Accessor<ResourceInfo>;The amounts of the game's resources and its supply, for the top bar
screenBox
screenBox: Accessor<ScreenBox>;Where the picture shows between the screen's bars (ScreenBox): the skip hint and the HUD's kept parts lay out to it
selection
selection: Accessor<SelectionItem[]>;What is selected, each unit once
selectionLocked
selectionLocked: Accessor<boolean>;Whether the selection is locked, so a click does not change it
setAddedParts
setAddedParts: Setter<readonly HudWidgetDef[]>;Sets the parts the game added to the HUD
setCardSize
setCardSize: Setter<{
columns: number;
rows: number;
}>;Sets how many columns and rows the command card has
setChatOpen
setChatOpen: Setter<'allies' | 'all' | null>;Sets which chat is being typed in, or null for none
setChoice
setChoice: Setter<ChoiceShown | null>;Sets the choice a cinematic asks, or null for none
setCinematic
setCinematic: Setter<CinematicInfo | null>;Sets the cinematic that is playing, or null for none
setClock
setClock: (value: ClockInfo | null) => false | ClockInfo | null;Sets the time of day, giving back false where it says what it said before
setCommands
setCommands: (value: CommandButton[]) => false | CommandButton[];Sets the command card's buttons, giving back false where they say what they said before
setConnection
setConnection: Setter<ConnectionState>;Sets how the connection to the server is
setDebugOpen
setDebugOpen: Setter<boolean>;Opens or closes the debug panel
setDialogLook
setDialogLook: Setter<DialogLook>;Sets how the dialog box looks
setDialogPrefs
setDialogPrefs: Setter<DialogPrefs>;Sets what the player set of the dialog: subtitles, how fast lines are typed
setFade
setFade: Setter<{
opacity: number;
seconds: number;
}>;Sets how far the screen is blacked out and over how many seconds it gets there
setFormation
setFormation: Setter<string | undefined>;Sets the formation the player's orders to a point take, by id; undefined for the rules' own
setGame
setGame: (value: GameInfo) => false | GameInfo;Sets what the game itself puts on the HUD, giving back false where it says what it said before
setGroups
setGroups: (value: GroupInfo[]) => false | GroupInfo[];Sets the control groups, giving back false where they say what they said before
setHiddenParts
setHiddenParts: Setter<ReadonlySet<string>>;Sets the ids of the HUD's parts the game hid
setHints
setHints(shown: boolean): void;Sets whether the rules' hints are shown
setHovered
setHovered: Setter<string | undefined>;Sets the id of the button the pointer is over, or undefined for none
setHudConsole
setHudConsole: Setter<HudConsole>;Sets how the HUD's console is laid out
setHudHidden
setHudHidden: Setter<boolean>;Sets whether the HUD is hidden
setHudKept
setHudKept: Setter<ReadonlySet<string> | null>;Sets which parts stay while the HUD is hidden, or null for none
setHudSize
setHudSize: Setter<number>;Sets how big the HUD is drawn
setIdleWorkers
setIdleWorkers: Setter<number>;Sets how many of the player's workers are idle
setLegend
setLegend: Setter<boolean>;Shows or hides the list of shortcuts
setLevels
setLevels: Setter<Readonly<Record<Bus | 'master', number>>>;Sets the volumes the player set, of everything and of each bus
setLine
setLine: Setter<LineInfo | null>;Sets the line of dialog said to the player now, or null for none
setLogOpen
setLogOpen: Setter<boolean>;Sets whether the window of the log is up
setMinimapLook
setMinimapLook: Setter<MinimapLook>;Sets the game's say over the minimap
setMode
setMode: (value: ModeInfo) => false | ModeInfo;Sets what the pointer is doing, giving back false where it says what it said before
setMuted
setMuted: Setter<boolean>;Sets whether all sound is off
setObjectives
setObjectives: (value: ObjectiveInfo[]) => false | ObjectiveInfo[];Sets the player's objectives, giving back false where they say what they said before
setOutcome
setOutcome: Setter<Outcome>;Sets how the game ended for the player
setPlaces
setPlaces: Setter<HudPlaces>;Sets the places of the HUD's layout
setPortraitBoxes
setPortraitBoxes: Setter<number>;Sets how many portrait boxes of the HUD are up: a box counts itself up as it mounts, down as it goes
setPortraits
setPortraits: Setter<HudPortraits>;Sets what the selection's sheet and the hero's panel show as faces
setQuickCast
setQuickCast: Setter<boolean>;Sets quick cast, so a key casts at the pointer at once
setRenderer
setRenderer: Setter<HudRenderer>;Sets what draws the game: the renderer and the graphics card
setResources
setResources: (value: ResourceInfo) => false | ResourceInfo;Sets the resources, giving back false where they say what they said before
setScreenBox
setScreenBox: Setter<ScreenBox>;Sets where the picture shows between the screen's bars
setSelection
setSelection: (value: SelectionItem[]) => false | SelectionItem[];Sets what is selected, giving back false where it says what it said before
setSelectionLocked
setSelectionLocked: Setter<boolean>;Sets whether the selection is locked
setSlot
setSlot<K extends keyof HudModelSlots>(name: K, value: HudModelSlots[K] | undefined): void;Writes a slot, as its describer does: what reads it hears only of a value that says something else
setStats
setStats: Setter<StatsShown>;Sets what the stats window shows
setStopped
setStopped: Setter<ClientStop | null>;Sets why the client stopped drawing the game, or null
setSubgroups
setSubgroups: (value: SubgroupInfo[]) => false | SubgroupInfo[];Sets the selection by type, giving back false where it says what it said before
setTimers
setTimers: (value: TimerInfo[]) => false | TimerInfo[];Sets the timers the rules show, giving back false where they say what they said before
setTitle
setTitle: (value: HudTitle | null) => false | HudTitle | null;Sets what the top bar says the game is, giving back false where it says what it said before
setViewport
setViewport: Setter<{
width: number;
height: number;
}>;Sets the HUD's viewport, the view's size in CSS pixels
slot
slot<K extends keyof HudModelSlots>(name: K): HudModelSlots[K] | undefined;What a feature described for the HUD (HudModelSlots): the hero alone selected (hero), the player's heroes (heroes), the shop open (shop), a game's own. Undefined where nothing describes it. A signal
snapshot
snapshot: () => {
resources: ResourceInfo;
selection: SelectionItem[];
commands: CommandButton[];
mode: ModeInfo;
groups: GroupInfo[];
subgroups: SubgroupInfo[];
title: HudTitle | null;
slots: Partial<HudModelSlots>;
legend: boolean;
debugOpen: boolean;
idleWorkers: number;
quickCast: boolean;
formation: string | undefined;
muted: boolean;
levels: Readonly<Record<Bus | 'master', number>>;
outcome: Outcome;
stopped: ClientStop | null;
connection: ConnectionState;
messages: UiMessage[];
stats: StatsShown;
clock: ClockInfo | null;
game: GameInfo;
objectives: ObjectiveInfo[];
line: LineInfo | null;
cinematic: CinematicInfo | null;
fade: {
opacity: number;
seconds: number;
};
hudHidden: boolean;
hudKept: string[] | null;
hiddenParts: string[];
viewport: {
width: number;
height: number;
};
hudSize: number;
chatLines: readonly ChatLine[];
chatOpen: 'allies' | 'all' | null;
log: readonly MessageLogLine[];
logOpen: boolean;
selectionLocked: boolean;
};All of what the HUD shows, read once, as plain data: for a page that draws it in another framework or in plain elements, and to start from before following it with watch. Nothing in it is a signal or holds one
stats
stats: Accessor<StatsShown>;What the stats window shows: frames a second, ping, tick, entities and game speed
stopped
stopped: Accessor<ClientStop | null>;Why the client stopped drawing the game, with the report of what went wrong; null while it runs
subgroups
subgroups: Accessor<SubgroupInfo[]>;The selection by type, for the group panel's chips (SubgroupInfo)
timers
timers: Accessor<TimerInfo[]>;The timers the rules show the player, counted down (world.timers.show)
title
title: Accessor<HudTitle | null>;What the top bar says the game is (HudTitle): null where nothing says
touchDebug
touchDebug: () => number;Bumps the counter debugVersion reads, so the debug panel reads its toggles again, and gives the new count
viewport
viewport: Accessor<{
width: number;
height: number;
}>;Where the HUD is laid out, in CSS pixels: the view's width and height
watch
watch: <T>(read: () => T, listener: (value: T) => void, options?: {
immediate?: boolean;
}) => () => void;Follows what a read of the state uses, from any code, with no Solid in it: ui.watch(() = ui.selection().length, (count) = draw(count)). Told when the value changes, not as it starts; gives back what stops it (see watch)