Skip to main content

InfoDisplayer

A class in Root.Township, the global namespace.

UI component that shows one text line per InfoDisplayerAccess source, kept up to date as their text or enabled state changes.

Constructors​

MemberWhat it is
InfoDisplayer()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

3 private and internal fields
MemberWhat it is
private InfoDisplayerAccess[] accessesSources whose text is shown.
private Text textPrefabText element copied for each source.
private Dictionary<InfoDisplayerAccess, Text> textsThe text element made for each source.

Methods​

4 private and internal methods
MemberWhat it is
private void OnDisable()Unsubscribes from the sources and hides their text lines.
private void OnEnable()Subscribes to each source and shows a text line for each enabled one, creating it if needed.
private void UpdateEnabled(InfoDisplayerAccess access)Shows or hides a source's text line when it is enabled or disabled.
private void UpdateText(InfoDisplayerAccess access)Updates a source's text line, creating it if needed.