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.
- Listed in Menus, UI and platforms
- Inherits or implements
PanelComponent
Constructors
| Member | What it is |
|---|---|
RecentPlayersPage() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
8 private and internal fields
| Member | What it is |
|---|---|
private ButtonWithEvents backButton | Previous page button. |
private int currentPage | Zero-based page shown. |
private TextRenderer emptyText | Text shown when there are no recent players. |
private ButtonWithEvents forwardButton | Next page button. |
private ButtonWithEvents homeButton | Button that refreshes the list. |
private RecentPlayerElement[] playerListElements | The row views; their count is the page size. |
private RecentPlayerActionPage recentPlayerActionPage | Page opened when a player is chosen. |
private RecentPlayerInteractionInfo[] recentPlayers | The fetched recent player interactions. |
Properties
1 private and internal property
Methods
| Member | What 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
| Member | What 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. |