Skip to content

Commit

Permalink
disable modals when the leaderboard is deactivated
Browse files Browse the repository at this point in the history
  • Loading branch information
Qwasyx committed Dec 17, 2023
1 parent bacd138 commit 0a2608d
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public void Initialize() {
_infoButtons.infoButtonClicked += infoButtons_infoButtonClicked;
_uploadDaemon.UploadStatusChanged += uploadDaemon_UploadStatusChanged;
_platformLeaderboardViewController.didActivateEvent += LeaderboardViewActivate;
_platformLeaderboardViewController.didDeactivateEvent += LeaderboardViewDeactivate;
}

[UIAction("#post-parse")]
Expand Down Expand Up @@ -166,6 +167,11 @@ private void LeaderboardViewActivate(bool firstActivation, bool addedToHierarchy
_playerService.GetLocalPlayerInfo();
}

private void LeaderboardViewDeactivate(bool removedFromHierarchy, bool screenSystemDisabling) {
if (_scoreDetailView.detailModalRoot != null) _scoreDetailView.detailModalRoot.Hide(false);
if (_profileDetailView.profileModalRoot != null) _profileDetailView.profileModalRoot.Hide(false);
}

private void infoButtons_infoButtonClicked(int index) {
if (_leaderboardService.currentLoadedLeaderboard == null) { return; }

Expand Down Expand Up @@ -442,6 +448,7 @@ private async Task StartReplay(ScoreMap score) {
public void Dispose() {

_platformLeaderboardViewController.didActivateEvent -= LeaderboardViewActivate;
_platformLeaderboardViewController.didDeactivateEvent -= LeaderboardViewDeactivate;
_playerService.LoginStatusChanged -= playerService_LoginStatusChanged;
_uploadDaemon.UploadStatusChanged -= uploadDaemon_UploadStatusChanged;
_infoButtons.infoButtonClicked -= infoButtons_infoButtonClicked;
Expand Down

0 comments on commit 0a2608d

Please sign in to comment.