UiComponent
The UiComponent class serves as the base class for all UI components in the game engine. It extends EventEmitter to support event-driven interactions and provides standard methods for managing the visibility and retrieval of the component's underlying DOM element.
UiComponent private
Properties
| Name | Type | Description |
|---|---|---|
ui | Ui | Current Ui instance. |
componentElem | HTMLElement | The root DOM element of the component, created from a template. |
Methods
constructor()
ts
function constructor(ui: Ui, template: string): voidInitializes the component and creates its DOM element via the current Ui instance.
getComponentElem()
ts
function getComponentElem(): HTMLElementReturns the root DOM element of the UI component.
show()
ts
function show(): voidMakes the component visible by setting its display style to block.
hide()
ts
function hide(): voidHides the component by setting its display style to none.
isVisible()
ts
function isVisible(): booleanReturns a boolean indicating whether the component is currently visible in the DOM.