Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove scores from song select leaderboard when leaving the screen #26410

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions osu.Game/Online/Leaderboards/Leaderboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ protected override void LoadComplete()
/// </summary>
public void RefetchScores() => Scheduler.AddOnce(refetchScores);

/// <summary>
/// Clear all scores from the display.
/// </summary>
public void ClearScores()
{
cancelPendingWork();
SetScores(null);
}

/// <summary>
/// Call when a retrieval or display failure happened to show a relevant message to the user.
/// </summary>
Expand Down Expand Up @@ -220,9 +229,7 @@ private void refetchScores()
{
Debug.Assert(ThreadSafety.IsUpdateThread);

cancelPendingWork();

SetScores(null);
ClearScores();
setState(LeaderboardState.Retrieving);

currentFetchCancellationSource = new CancellationTokenSource();
Expand Down
8 changes: 8 additions & 0 deletions osu.Game/Screens/Select/PlaySongSelect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ Player createPlayer()
}
}

public override void OnSuspending(ScreenTransitionEvent e)
{
// Scores will be refreshed on arriving at this screen.
// Clear them to avoid animation overload on returning to song select.
playBeatmapDetailArea.Leaderboard.ClearScores();
base.OnSuspending(e);
}

public override void OnResuming(ScreenTransitionEvent e)
{
base.OnResuming(e);
Expand Down
Loading