Remove scores from song select leaderboard when leaving the screen

This commit is contained in:
Dean Herbert 2024-01-06 20:44:07 +09:00
parent fbc40ffc65
commit d3710f0bfd
No known key found for this signature in database
2 changed files with 18 additions and 3 deletions

View File

@ -152,6 +152,15 @@ namespace osu.Game.Online.Leaderboards
/// </summary> /// </summary>
public void RefetchScores() => Scheduler.AddOnce(refetchScores); public void RefetchScores() => Scheduler.AddOnce(refetchScores);
/// <summary>
/// Clear all scores from the display.
/// </summary>
public void ClearScores()
{
cancelPendingWork();
SetScores(null);
}
/// <summary> /// <summary>
/// Call when a retrieval or display failure happened to show a relevant message to the user. /// Call when a retrieval or display failure happened to show a relevant message to the user.
/// </summary> /// </summary>
@ -220,9 +229,7 @@ namespace osu.Game.Online.Leaderboards
{ {
Debug.Assert(ThreadSafety.IsUpdateThread); Debug.Assert(ThreadSafety.IsUpdateThread);
cancelPendingWork(); ClearScores();
SetScores(null);
setState(LeaderboardState.Retrieving); setState(LeaderboardState.Retrieving);
currentFetchCancellationSource = new CancellationTokenSource(); currentFetchCancellationSource = new CancellationTokenSource();

View File

@ -146,6 +146,14 @@ namespace osu.Game.Screens.Select
} }
} }
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) public override void OnResuming(ScreenTransitionEvent e)
{ {
base.OnResuming(e); base.OnResuming(e);