Skip to main content

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.

Constructors​

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

Fields​

15 private and internal fields
MemberWhat it is
private NameBoardEmblem activeEmblemThe shield emblem currently shown, taken from the pool given to Setup.
private Color friendColorName colour for friends.
private GameObject friendIconIcon object shown next to a friend's name.
private string friendPrefixText put before a friend's name (two spaces by default, to make room for the icon).
private float hasShieldTextWidthText width meant for boards with a shield. Not read in this code.
private PooledObjectDefinition meshEffectDefinitionPooled effect definition. Not used in this code.
private Color nonFriendColorName colour for players who aren't friends.
private float noShieldTextWidthText width meant for boards without a shield. Not read in this code.
private float noTitleNameHeightLocal height of the name text when there is no title.
private float noTitleNameScaleMaximum name text scale when there is no title.
private Transform shieldParentTransform the shield emblem is parented to.
private TextRenderer titleRendererText renderer for the title line.
private TextRenderer userNameRendererText renderer for the user name.
private float withTitleNameHeightLocal height of the name text when a title is shown.
private float withTitleNameScaleMaximum name text scale when a title is shown.

Properties​

MemberWhat it is
string CurrentUserName { get; private set; }The user name last passed to Setup, without the friend prefix.

Methods​

MemberWhat 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
MemberWhat it is
private void Clear()Empties the name and title text and releases the shield emblem.
private void ClearShield()Releases the active shield emblem back to its pool, if any.
private void SetupFriendIcon(bool isFriend)Shows or hides the friend icon and places it at the end of the name text.

Used in​

Members of other types that take, return or hold a NameBoard: