Skip to content

ChatViewer ​

Inherits: HUDUIElement < Control

Inherited by: ChatBox, MessagesManager, SpeechBubbles

The base class of everything that shows messages: the chat box, a level up toast, the warning label, a loot feed. Give it channels (in the inspector) and override _on_message(). It listens to the message manager (system_hub.chat_manager) and calls _on_message() for each message posted to one of its channels. A viewer placed in the HUD is set up by the interface like any HUD element; a viewer placed anywhere else calls bind(system_hub.chat_manager).

Properties ​

Array[String]channels[]
boolshow_history_on_starttrue

Variables ​

ChatManagerchat_manager

Methods ​

voidinitialize_ui( p_system_hub: GameHost.SystemHub )
voidbind( manager: ChatManager )
voidunbind()
boolaccepts( channel_id: String )
Colorget_channel_color( channel_id: String )
Stringget_channel_name( channel_id: String )
boolaccepts_message( message: ChatMessage )

Property descriptions ​

Array[String] channels = [] ​

The channels this viewer shows (their ids: pick them in the list)

bool show_history_on_start = true ​

When the viewer is set up it also shows the lines the manager remembers for its channels (a viewer that appears late, a chat box that opens after a fight)

Variable descriptions ​

ChatManager chat_manager ​

The message manager this viewer listens to

Method descriptions ​

void initialize_ui( p_system_hub: GameHost.SystemHub ) ​

Sets the viewer up as a HUD element: it listens to the manager of the hub

void bind( manager: ChatManager ) ​

Starts listening to a message manager (and stops listening to the one it had)

void unbind() ​

Stops listening

bool accepts( channel_id: String ) ​

Does this viewer show a channel? By default the channels in its list. A viewer can override this (the fading messages show every channel that is marked as one)

Color get_channel_color( channel_id: String ) ​

The colour of a channel (white when there is no such channel)

String get_channel_name( channel_id: String ) ​

The name of a channel

bool accepts_message( message: ChatMessage ) ​

Does this viewer show this message? By default when it shows one of the channels the message belongs to. A viewer that filters more (the chat box: the kind of a combat line) overrides this