Skip to main content

RecentPlayerElement

A class in Root.Township, the global namespace.

Client UI: one row in the recent players list. Shows the name, a rough status text and a nameplate coloured by online and friend status, and a marker for incoming friend requests.

Constructors​

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

Fields​

7 private and internal fields
MemberWhat it is
private Color defaultColorNameplate colour for an online non-friend.
private Color friendColorNameplate colour for a friend.
private ComponentEventSubscriber friendshipStatusSubscriberSubscription to friendship changes, disposed when the row is cleared or disabled.
private static readonly Logger loggerNLog logger for this class.
private RecentPlayerElement.NameplateMeshReference[] meshReferencesNameplate meshes that get the status colour.
private GameObject notificationMarker shown when this non-friend has sent a friend request.
private Color offlineColorNameplate colour for a player not on this server.

Properties​

MemberWhat it is
RecentPlayerInteractionInfo InteractionInfo { get; private set; }The recent player record shown in this row.
1 private and internal property
MemberWhat it is
private int Id { get; }The shown player's user id.

Methods​

MemberWhat it is
void Clear()Empties the row and stops listening for friendship changes.
void Setup(RecentPlayerInteractionInfo recentPlayerInteractionInfo)Shows the given recent player.
7 private and internal methods
MemberWhat it is
private Action FriendshipSubscriber(Action handler)Subscribes to local friendship status changes.
private void FriendshipUnsubscriber(Action handler)Unsubscribes from local friendship status changes.
private Color GetNameplateColor(bool isOnline, bool isFriend)Friend colour for friends, else offline or default colour depending on whether they're on this server.
private void Init()Starts listening for friendship changes and refreshes the row.
private void OnDisable()Stops listening for friendship changes.
private void OnEnable()Calls Init.
private void UpdateView()Redraws the name, status text, nameplate colour and friend request marker.

Used in​

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