Skip to main content

RecentPlayersPage

A class in Root.Township, Alta.SocialTablet.

Social tablet page that lists players you recently met on the current server, a page at a time. Client only.

Constructors​

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

Fields​

8 private and internal fields
MemberWhat it is
private ButtonWithEvents backButtonPrevious page button.
private int currentPageZero-based page shown.
private TextRenderer emptyTextText shown when there are no recent players.
private ButtonWithEvents forwardButtonNext page button.
private ButtonWithEvents homeButtonButton that refreshes the list.
private RecentPlayerElement[] playerListElementsThe row views; their count is the page size.
private RecentPlayerActionPage recentPlayerActionPagePage opened when a player is chosen.
private RecentPlayerInteractionInfo[] recentPlayersThe fetched recent player interactions.

Properties​

1 private and internal property
MemberWhat it is
private int PageOffset { get; }Index of the first player on the current page.

Methods​

MemberWhat it is
override async void RefreshData()Clears the rows and, if on a server, reloads the list behind a loading screen.
protected override void HandleStateChange(Panel panel)Hooks the home button to refresh the list while the panel is active.
14 private and internal methods
MemberWhat it is
private void ClearElement(RecentPlayerElement view)Empties a list row, unhooks its selection and hides it.
private void DisplayNoRecentPlayers()Shows the empty text and hides all rows and paging buttons.
private async Task GetRecentPlayersList()Loads the friend list, then fetches recent player interactions for the joined server from the API and shows the current page.
private bool HasNextPage()True if there are more players after the current page.
private void OnDisable()Marks the page to refresh next time it opens.
private void OnPageBackwards(Button obj)Shows the previous page.
private void OnPageForward(Button obj)Shows the next page.
private void OnPlayerSelected(ListElementWithButton element)Opens the action page for the chosen player.
private void RefreshList(Button obj)Home button handler; calls RefreshData.
private void ResetPanel()Hides the empty text and clears all rows.
private void SetupElement(RecentPlayerElement view, RecentPlayerInteractionInfo player)Fills a row with a player, hooks its selection and shows it.
private void SetupNavigationButtons()Shows and hooks the forward and back buttons only when there is a page in that direction.
private void SetupPlayerElements()Fills the rows with the players on the current page.
private void UpdatePageView(int page)Switches to a page and redraws it, or shows the empty text if there are no recent players.