1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Store last set score to a SessionStatic

This commit is contained in:
Bartłomiej Dach 2023-12-27 18:38:29 +01:00
parent c2d60006cb
commit d4423d4933
No known key found for this signature in database
3 changed files with 13 additions and 0 deletions

View File

@ -9,6 +9,7 @@ using osu.Game.Input;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.Mods; using osu.Game.Overlays.Mods;
using osu.Game.Scoring;
namespace osu.Game.Configuration namespace osu.Game.Configuration
{ {
@ -27,6 +28,7 @@ namespace osu.Game.Configuration
SetDefault(Static.LastModSelectPanelSamplePlaybackTime, (double?)null); SetDefault(Static.LastModSelectPanelSamplePlaybackTime, (double?)null);
SetDefault<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null); SetDefault<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null);
SetDefault(Static.TouchInputActive, RuntimeInfo.IsMobile); SetDefault(Static.TouchInputActive, RuntimeInfo.IsMobile);
SetDefault<ScoreInfo>(Static.LastLocalUserScore, null);
} }
/// <summary> /// <summary>
@ -73,5 +75,10 @@ namespace osu.Game.Configuration
/// Used in touchscreen detection scenarios (<see cref="TouchInputInterceptor"/>). /// Used in touchscreen detection scenarios (<see cref="TouchInputInterceptor"/>).
/// </summary> /// </summary>
TouchInputActive, TouchInputActive,
/// <summary>
/// Stores the local user's last score (can be completed or aborted).
/// </summary>
LastLocalUserScore,
} }
} }

View File

@ -207,6 +207,7 @@ namespace osu.Game.Scoring
clone.Statistics = new Dictionary<HitResult, int>(clone.Statistics); clone.Statistics = new Dictionary<HitResult, int>(clone.Statistics);
clone.MaximumStatistics = new Dictionary<HitResult, int>(clone.MaximumStatistics); clone.MaximumStatistics = new Dictionary<HitResult, int>(clone.MaximumStatistics);
clone.HitEvents = new List<HitEvent>(clone.HitEvents);
// Ensure we have fresh mods to avoid any references (ie. after gameplay). // Ensure we have fresh mods to avoid any references (ie. after gameplay).
clone.clearAllMods(); clone.clearAllMods();

View File

@ -11,6 +11,7 @@ using osu.Framework.Allocation;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer;
@ -37,6 +38,9 @@ namespace osu.Game.Screens.Play
[Resolved] [Resolved]
private SpectatorClient spectatorClient { get; set; } private SpectatorClient spectatorClient { get; set; }
[Resolved]
private SessionStatics statics { get; set; }
private TaskCompletionSource<bool> scoreSubmissionSource; private TaskCompletionSource<bool> scoreSubmissionSource;
protected SubmittingPlayer(PlayerConfiguration configuration = null) protected SubmittingPlayer(PlayerConfiguration configuration = null)
@ -176,6 +180,7 @@ namespace osu.Game.Screens.Play
{ {
bool exiting = base.OnExiting(e); bool exiting = base.OnExiting(e);
submitFromFailOrQuit(); submitFromFailOrQuit();
statics.SetValue(Static.LastLocalUserScore, Score.ScoreInfo.DeepClone());
return exiting; return exiting;
} }