1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Update LastPlayed on gameplay starting in a SubmittingPlayer

This commit is contained in:
Dean Herbert 2022-07-13 16:36:55 +09:00
parent 4b96d74b0c
commit ab3ec80159

View File

@ -11,6 +11,8 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Logging;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Online.API;
using osu.Game.Online.Rooms;
using osu.Game.Rulesets.Scoring;
@ -117,6 +119,23 @@ namespace osu.Game.Screens.Play
await submitScore(score).ConfigureAwait(false);
}
[Resolved]
private RealmAccess realm { get; set; }
protected override void StartGameplay()
{
base.StartGameplay();
// User expectation is that last played should be updated when entering the gameplay loop
// from multiplayer / playlists / solo, even when using autoplay mod.
realm.WriteAsync(r =>
{
var realmBeatmap = r.Find<BeatmapInfo>(Beatmap.Value.BeatmapInfo.ID);
if (realmBeatmap != null)
realmBeatmap.LastPlayed = DateTimeOffset.Now;
});
}
public override bool OnExiting(ScreenExitEvent e)
{
bool exiting = base.OnExiting(e);