1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-05 09:42:54 +08:00

Clear previous LastLocalUserScore when returning to song select

This seems like the lowest friction way of fixing
https://github.com/ppy/osu/issues/30885.

We could also only null this on application, but this feels worse
because

- It would require local handling (potentially complex) in
  `BeatmapOffsetControl` if we want to continue displaying the graph and
button after clicking it.
- It would make the session static very specific in usage and
  potentially make future usage not possible due to being nulled in only
a very specific scenario.

One might argue that it would be nice to have this non-null until the
next play, but if such a usage comes up I'd propose we rename this
session static and add a new one with that purpose.
This commit is contained in:
Dean Herbert 2024-11-28 17:30:50 +09:00
parent 5d7aafaab3
commit ced8dda1a2
No known key found for this signature in database
2 changed files with 10 additions and 1 deletions

View File

@ -10,6 +10,7 @@ using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
using osu.Game.Scoring;
using osu.Game.Screens.Play;
namespace osu.Game.Configuration
{
@ -77,7 +78,8 @@ namespace osu.Game.Configuration
TouchInputActive,
/// <summary>
/// Stores the local user's last score (can be completed or aborted).
/// Contains the local user's last score (can be completed or aborted) after exiting <see cref="Player"/>.
/// Will be cleared to <c>null</c> when leaving <see cref="PlayerLoader"/>.
/// </summary>
LastLocalUserScore,

View File

@ -28,6 +28,7 @@ using osu.Game.Localisation;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using osu.Game.Performance;
using osu.Game.Scoring;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Play.PlayerSettings;
using osu.Game.Skinning;
@ -78,6 +79,8 @@ namespace osu.Game.Screens.Play
private FillFlowContainer disclaimers = null!;
private OsuScrollContainer settingsScroll = null!;
private Bindable<ScoreInfo?> lastScore = null!;
private Bindable<bool> showStoryboards = null!;
private bool backgroundBrightnessReduction;
@ -179,6 +182,8 @@ namespace osu.Game.Screens.Play
{
muteWarningShownOnce = sessionStatics.GetBindable<bool>(Static.MutedAudioNotificationShownOnce);
batteryWarningShownOnce = sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce);
lastScore = sessionStatics.GetBindable<ScoreInfo?>(Static.LastLocalUserScore);
showStoryboards = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
const float padding = 25;
@ -347,6 +352,8 @@ namespace osu.Game.Screens.Play
highPerformanceSession?.Dispose();
highPerformanceSession = null;
lastScore.Value = null;
return base.OnExiting(e);
}