Skip to main content

InboxPanel

A class in Root.Township, Alta.Meta.UI.ServerManagement.

Client menu panel showing the player's inbox: group invites, friend requests, API status messages and player reports, with accept and decline buttons.

Constructors​

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

Fields​

14 private and internal fields
MemberWhat it is
private Button acceptButtonAccept button; its label comes from the selected notification.
private IAnalyticsService analyticsServiceAnalytics service passed to friend request and report notifications.
private UINotification currentShowingThe notification whose details are shown now.
private Dictionary<ListElementWithButton, UINotification> dataMappingMaps each list row to its notification.
private Button declineButtonDecline button; its label comes from the selected notification.
private ListElementWithButton friendRequestElementRow prefab for friend requests.
private ListElementWithButton groupInviteElementRow prefab for group invites.
private TextRenderer infoTextText showing the selected notification's full message, or "Inbox is empty".
private PanelComponent[] panelsToRefreshOther panels marked for reload after an accept or decline.
private ListElementWithButton playerReportElementRow prefab for player reports.
private PlayerReportInboxInfoPanel reportInfoPanelPanel that shows a player report's details.
private ListElementWithButton selectedThe selected list row.
private ListElementWithButton statusElementRow prefab for API status messages and anything else.
private UIList uiListThe list that holds the notification rows.

Methods​

MemberWhat it is
void Inject(IAnalyticsService analyticsService)VContainer injection point that supplies the analytics service.
override async void RefreshData()Rebuilds the inbox behind a loading screen.
7 private and internal methods
MemberWhat it is
private void ForceRefresh()Marks this panel and every panel in panelsToRefresh to reload next time they are shown.
private async Task<IEnumerable<UINotification>> GetAllNotifications()Fetches group invites, friend requests, API status and reports awaiting action from the API, sorted by time. Each source fails on its own.
private static IEnumerable<UINotification> GetFirstTenInReverseOrder(IEnumerable<UINotification> allNotifications)Returns the newest ten notifications, newest first.
private async void HandleAccept(Button obj)Accepts the shown notification (with a loading screen if it asks for one), removes its row and refreshes.
private async void HandleDecline(Button obj)Declines the shown notification behind a loading screen, removes its row and refreshes.
private void HandleSelectedElement(ListElementWithButton element)Shows the selected notification's message and sets up the accept and decline buttons for it.
private async Task SetupInbox()Builds a row for each of the newest ten notifications, picking the prefab by notification type, and reselects the one that was shown.

Used in​

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