UnitHudLayer beta
Class of @v12-engine/client/common
export declare class UnitHudLayerThe client's plates: works out each unit's (a plate set for it while the game runs, its type's, the game's, the default), lays it out over its head, and gives the overlay what to draw. The game's own widgets of the page it keeps, places and hides
Members
constructor
constructor(state: GameState, terrain: Terrain,
heightOf: (id: number) => number, options?: {
game?: UnitHudSource;
ofType?: (entity: EntityView) => UnitHudSource | undefined;
look?: UnitHudLook;
camera?: () => {
x: number;
y: number;
z: number;
} | undefined;
bars?: BarsChooser;
measure?: (font: string, text: string) => number;
layer?: HTMLElement;
icons?: IconSet;
now?: () => number;
});Constructs a new instance of the UnitHudLayer class
collect
collect(alpha: number, selected: ReadonlySet<number>, hovered: number | undefined, all: boolean, projectTo: ProjectTo): FrameList<DrawOp>;The plates of everything in view, at alpha between two ticks, as what the overlay draws: a list that is good until the next call. selected is what is selected, hovered what is under the pointer, all whether everyone's bars are asked for
defaultPlate
defaultPlate(entity: EntityView, selected: boolean, all: boolean, look?: BarsLook | undefined): UnitHudPlate | null;The client's plate for a unit: a hero's level and name, then its health (with its shield under it), mana where it is selected or a hero, and what it is building or making. Over what is hurt, selected or a hero, or everything when everyone's are asked for. What bars (item 73) changes, changed: look is what it says of the unit, asked when left out
dispose
dispose(): void;Takes the page elements the plates made away
entries
entries(alpha: number, selected: ReadonlySet<number>, hovered: number | undefined, projectTo: ProjectTo, out: UnitHudEntry[], all?: boolean): UnitHudEntry[];Where every unit in view is, for a system of the game's own: over its head, on the screen, with the HUD the client would give it and the plate it would draw
hudOf
hudOf(entity: EntityView, selected: boolean, hovered: boolean, all: boolean): UnitHudDef | UnitHudPlate | null;The HUD a unit has, as said: set for it while the game runs, set for its type while the game runs, its type's, the game's, or the client's plate. Not yet picked from (plateOf)
look
look: UnitHudLook;The defaults of every unit's HUD where its def does not say (client.unitHud.look)
ops
readonly ops: FrameList<DrawOp>;The shapes the overlay draws this frame, in order; refilled every frame
overrides
readonly overrides: Map<number, UnitHudDef | UnitHudPlate | null>;Plates or HUDs set for units while the game runs (client.unitHud.set): null for none
plateElement
plateElement(id: number): HTMLElement | undefined;A unit's plate drawn as elements of the page this frame (render: 'dom'), for tests and tools
plateNow
plateNow(entity: EntityView, selected: boolean, hovered: boolean, all: boolean): UnitHudPlate | null;The plate a unit has now: its HUD's plate for who looks, from how far, in its state (hudOf, then plateOf)
sideMarks
sideMarks: boolean;Whether a mark by side is drawn under every unit and building in sight (the setting sideMarks)
titleOf
titleOf(def: UnitTypeDef, level: number): string;A hero's level and the name of its type, put together once for each
typeDefs
readonly typeDefs: Map<string, UnitHudSource | null>;HUDs set for unit types while the game runs (client.unitHud.defs), over their UnitLook's: null for none