UiContainer
Extends: BGE.UI.UiWidget
Properties
backgroundRGBA(integer) — RGBA value for the background of the window/containershowBackground(boolean) — RGBA value for the background of the window/containerchildren(dynamic)theme(BGE.UI.Theme) — This container's own theme override. When invalid, effectiveTheme() ' falls back to m.game.defaultTheme.focusEnabled(boolean) — Does this container register its focusable children with the shared ' BGE.UI.FocusManager (Game.focusManager)? gameUi wants this (issue ' #133); debugUi opts out (set to false by Game.bs) since debug UI ' should be non-blocking and never capture input away from gameplay ' entities - its widgets, if any, would just never be focusable, and it ' still gets onInput()'s plain broadcast like any other GameEntity. ' Focus is global (issue #178): every focusEnabled container anywhere in ' the tree shares the same one focused widget, via Game.focusManager ' (driven once per frame by Game.processFocusManagerInput() - not ' per-container) - not tracked per-container.
Constructor
new UiContainer(game: BGE.Game): UiContainerParameters
game(BGE.Game)
Instance Methods
onRemove(): void
Method for handling any actions needed when this is removed from view Clears all children
Returns
void
addChild(element: UiWidget): void
Parameters
element(UiWidget)
Returns
void
childCount(): integer
Gets the number of children currently added to this container
Returns
integer
removeChild(element: UiWidget): void
Parameters
element(UiWidget)
Returns
void
clearChildren(): void
Returns
void
onUpdate(deltaTime: float): void
Method for handling any updates based on time since previous frame Calls same method in all children. Also resets the shared FocusManager's input-consumption latch - safe to call redundantly from every container's onUpdate() (idempotent).
Parameters
deltaTime(float) — milliseconds since last frame
Returns
void
setCanvas(canvas?: BGE.Canvas): void
Set the canvas this UIWidget Draws to Sets the canvas on all children
Parameters
canvas(BGE.Canvas, optional, default: "invalid") — The canvas this should draw to - if invalid, then will draw to the game canvas
Returns
void
draw(parent?: UiWidget): void
Method called each frame to draw any images of this entity
Parameters
parent(UiWidget, optional, default: "invalid")
Returns
void
getValue(): void
Function to get the value of the UIContainer, which will be an object of all the values of the children
Returns
void
effectiveTheme(): BGE.UI.Theme
The theme this container's widgets should pull colors/fonts from: this container's own m.theme if set, else the game's defaultTheme.
Returns
BGE.UI.Theme
isContainer(): boolean
Returns
boolean
onInput(input: BGE.GameInput): void
Method to process input per frame. Broadcasts to every child unconditionally (same as every other GameEntity notification method on this class, e.g. onAudioEvent()/onGameEvent()) - a plain, non-focusable widget added to a container still gets notified of every input this way, and a nested UiContainer child gets it too, running its own broadcast in turn. Focus itself is driven separately, once per frame, by Game.processFocusManagerInput() calling BGE.UI.FocusManager.update() directly - not from here. Doing it here instead (once per focusEnabled container reached by this same broadcast) would call update() more than once for one event whenever containers nest, double-firing the one globally-focused widget's dispatch.
Parameters
input(BGE.GameInput) — GameInput object for the last frame
Returns
void
onECPKeyboard(char: integer): void
Method to process an ECP keyboard event
Parameters
char(integer)
Returns
void
onECPInput(data: roInputEvent): void
Method to process an External Control Protocol event
Parameters
data(roInputEvent)
Returns
void
onAudioEvent(msg: roAudioPlayerEvent): void
Method to handle audio events
Parameters
msg(roAudioPlayerEvent) — roAudioPlayerEvent
Returns
void
onPause(): void
Called when the game pauses Calls same method in all children
Returns
void
onResume(pauseTimeMs: integer): void
Called when the game unpauses Calls same method in all children
Parameters
pauseTimeMs(integer) — The number of milliseconds the game was paused
Returns
void
onUrlEvent(msg: roUrlEvent): void
Called on url event
Parameters
msg(roUrlEvent) — roUrlEvent
Returns
void
onGameEvent(eventName: string, data: roAssociativeArray): void
General purpose event handler for in-game events. Calls same method in all children
Parameters
eventName(string) — Event name that describes the event typedata(roAssociativeArray) — Any extra data to go along with the event
Returns
void
onChangeRoom(newRoom: Room): void
Method called when the current room changes. This method is only called when the entity is marked as persistant, otherwise entities are destroyed on room changes. Calls same method in all children
Parameters
newRoom(Room) — The next room
Returns
void
onDestroy(): void
Method called when this entity is destroyed
Returns
void