NameBoard
A class in Root.Township, Alta.QuickAccessActions.
Pooled floating board that shows a player's name, optional title and member status shield above their head. Spawned by the Show Names quick access action. Client only.
- Listed in Players and characters
- Inherits or implements
ScaleLerpPooledObject
Constructors
| Member | What it is |
|---|---|
NameBoard() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
15 private and internal fields
| Member | What it is |
|---|---|
private NameBoardEmblem activeEmblem | The shield emblem currently shown, taken from the pool given to Setup. |
private Color friendColor | Name colour for friends. |
private GameObject friendIcon | Icon object shown next to a friend's name. |
private string friendPrefix | Text put before a friend's name (two spaces by default, to make room for the icon). |
private float hasShieldTextWidth | Text width meant for boards with a shield. Not read in this code. |
private PooledObjectDefinition meshEffectDefinition | Pooled effect definition. Not used in this code. |
private Color nonFriendColor | Name colour for players who aren't friends. |
private float noShieldTextWidth | Text width meant for boards without a shield. Not read in this code. |
private float noTitleNameHeight | Local height of the name text when there is no title. |
private float noTitleNameScale | Maximum name text scale when there is no title. |
private Transform shieldParent | Transform the shield emblem is parented to. |
private TextRenderer titleRenderer | Text renderer for the title line. |
private TextRenderer userNameRenderer | Text renderer for the user name. |
private float withTitleNameHeight | Local height of the name text when a title is shown. |
private float withTitleNameScale | Maximum name text scale when a title is shown. |
Properties
| Member | What it is |
|---|---|
string CurrentUserName { get; private set; } | The user name last passed to Setup, without the friend prefix. |
Methods
| Member | What it is |
|---|---|
override void Release() | Lets the active emblem play its close first, then releases the board. |
void Setup(string userName, bool isFriend, string title = "", PooledObjectDefinition shieldDefinition = null) | Shows a name, friend colour and icon, optional title and optional shield emblem. Moves and scales the name depending on whether there is a title. |
void UpdateFriendship(bool isFriend) | Redraws the name with friend or non-friend colour and prefix, and updates the friend icon. |
protected override void Awake() | Clears the text and shield, then runs the base pooled object setup. |
protected override void FadeFinished() | Clears the board once its fade out finishes, then runs the base handling. |
3 private and internal methods
Used in
Members of other types that take, return or hold a NameBoard: