RecentPlayerActionPage
A class in Root.Township, the global namespace.
Social tablet page for one recent player: friend, unfriend, mute, report, ban and unban buttons. Actions run on the client through the Alta API; reports and bans are also sent to the server, which raises console events.
- Listed in Global namespace: Q to R
- Inherits or implements
PanelComponent - Nested types
FriendButtonMap
Constructors
| Member | What it is |
|---|---|
RecentPlayerActionPage() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
25 private and internal fields
| Member | What it is |
|---|---|
private IAnalyticsService analyticsService | Analytics service injected by VContainer. |
private Button banButton | Button shown when you can ban and the player isn't banned. |
private Panel banSentPage | Confirmation page shown after a ban. |
private List<RecentPlayerActionPage.FriendButtonMap> friendButtons | Friend buttons mapped to the friendship state each one is shown for. |
private Panel friendRemovalSentPage | Confirmation page shown after unfriending. |
private Panel friendRequestAcceptSentPage | Confirmation page shown after accepting a friend request. |
private Panel friendRequestDenySentPage | Confirmation page shown after denying a friend request. |
private Panel friendRequestSentPage | Confirmation page shown after sending a friend request. |
private static readonly GroupPermissions[] groupBanPermissionFlags | The permission checked by CanBanPlayersOnServer (only Ban). |
private bool? hasBanPermissionResultCache | Cached result of CanBanPlayersOnServer, null until asked. |
private Button muteButton | Button shown while the player is not muted. |
private const SocialAnalyticsEventOrigin Origin | Analytics origin for every event this page sends (the social tablet). |
private RecentPlayerInteractionInfo recentPlayer | The recent player this page was set up for. |
private RecentPlayerElement[] recentPlayerElements | Elements (name, nameplate and so on) filled in with the recent player on Setup. |
private ReportType reportReason | Reason picked for the next report, set by SetReportReason. |
private Panel reportSentPage | Confirmation page shown after a report. |
private JoinedGroupManager serverGroupManagerCache | Cached result of GetServerGroupManager. |
private GameServerInfo serverInfoCache | Cached result of GetServerInfo. |
private SocialTablet socialTablet | The tablet this page is on; its entity carries the sync messages. |
private MethodSyncStruct<int> syncFriendshipStatusUpdateWithPlayer | Message (SyncC) for SyncFriendshipConfirmedWithPlayer, carrying the other player's user id. |
private MethodSyncStruct<SocialTabletActionSyncStruct> syncSocialTabletAction | Message (SyncD) for SyncSocialTabletAction. |
private TaskLock taskLock | Stops a second unfriend, deny, report, ban or unban from starting while one is running. |
private Button unbanButton | Button shown when you can ban and the player is already banned. |
private Panel unBanSentPage | Confirmation page shown after an unban. |
private Button unmuteButton | Button shown while the player is muted. |
Properties
4 private and internal properties
| Member | What it is |
|---|---|
private static bool IsServerIdValid { get; } | False when there is no server id (-1), as on a local test. |
private static int PlayerId { get; } | User id of the local player. |
private int RecentPlayerId { get; } | User id of the recent player this page is showing. |
private static int ServerId { get; } | Current server id: from ServerHandler on the server, from JoinedServerInfo on a client. |
Methods
| Member | What it is |
|---|---|
async void BanPlayer() | Bans the player from the current server through the API and tells the server, which raises SocialTabletPlayerBanned. |
async void DenyFriendRequest() | Declines the player's friend request by removing the friendship. |
void InitSync() | Creates the friendship and tablet action messages on the social tablet's entity. |
void Inject(IAnalyticsService analyticsService) | Receives the analytics service by dependency injection. |
async void MakeFriendRequest() | Sends a friend request (or accepts theirs) and shows the sent page. |
async void ReportPlayer() | Reports the player with the chosen reason and tells the server, which raises SocialTabletPlayerReported. |
async void RespondFriendRequest() | Accepts the player's friend request. |
void SetReportReason(int reason) | Sets the report reason from a ReportType number. |
void Setup(RecentPlayerInteractionInfo recentPlayer) | Shows a recent player: fills the elements and picks the right friend, mute and ban buttons. Ban buttons need the Ban group permission. |
async void UnBanPlayer() | Unbans the player from the current server and tells the server. |
void Unfriend() | Removes the friendship and tells the other player to refresh their friends list. |
18 private and internal methods
| Member | What it is |
|---|---|
private async Task<bool> AddFriend() | Sends a friend request through SocialService. If that makes you friends, refreshes the list and tells the other player via the server. |
private void Awake() | Hooks the mute and unmute buttons to ToggleMute. |
private async Task BanPlayerTask() | Bans the player from this server through SocialService, logs analytics and tells the server so it can raise a console event. |
private async Task<bool> CanBanPlayersOnServer() | Asks the API whether you have Ban permission in the server's group. False on local servers; the result is cached. |
private async Task DenyFriendRequestTask() | Removes the pending friendship and shows the deny confirmation page. |
private async Task<JoinedGroupManager> GetServerGroupManager() | Gets (and caches) the API group manager for the server's group, used for the ban list. |
private async Task<GameServerInfo> GetServerInfo() | Gets (and caches) this server's info from the API. |
private async Task<bool> IsPlayerBanned(int playerId) | Checks the server group's ban list through the API for the given user id. |
private async Task<bool> RemoveFriend() | Removes the friendship through SocialService and tells the other player via the server. |
private async Task ReportPlayerTask() | Reports the player with the chosen reason, logs analytics and tells the server so it can raise a console event. |
private async void SetupBanButton() | Shows the ban or unban button depending on permission and whether the player is already banned. Hides both without permission. |
private void SetupFriendshipButton() | Shows only the friend button that matches the current friendship state. |
private void ShowCorrectMuteButton(bool isMuted) | Shows mute or unmute to match whether the player is muted. |
private void SyncFriendshipConfirmedWithPlayer(IPlayer player, Stream stream, int addedPlayerId) | Server relays a friendship change to the named player; the client that gets it reloads its friend list. |
private async void SyncSocialTabletAction(IPlayer player, Stream stream, SocialTabletActionSyncStruct actionData) | Carries a report, ban or unban to the server, which looks the target up and fires the matching ConsoleEvents event. |
private void ToggleMute(Button _) | Flips voice chat mute for the player and swaps the buttons. |
private async Task UnbanPlayerTask() | Unbans the player through SocialService and tells the server. On a local test it only logs a warning. |
private async Task UnfriendTask() | Removes the friendship and shows the removal confirmation page. |
Used in
Members of other types that take, return or hold a RecentPlayerActionPage: