Move spectator begin/end playing to SubmittingPlayer

This commit is contained in:
Dan Balasescu
2022-07-28 20:44:02 +09:00
parent 1da9830145
commit ce694123eb
4 changed files with 37 additions and 52 deletions

View File

@ -15,6 +15,7 @@ using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Online.API;
using osu.Game.Online.Rooms;
using osu.Game.Online.Spectator;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
@ -33,6 +34,9 @@ namespace osu.Game.Screens.Play
[Resolved]
private IAPIProvider api { get; set; }
[Resolved]
private SpectatorClient spectatorClient { get; set; }
private TaskCompletionSource<bool> scoreSubmissionSource;
protected SubmittingPlayer(PlayerConfiguration configuration = null)
@ -134,6 +138,8 @@ namespace osu.Game.Screens.Play
if (realmBeatmap != null)
realmBeatmap.LastPlayed = DateTimeOffset.Now;
});
spectatorClient.BeginPlaying(GameplayState, Score);
}
public override bool OnExiting(ScreenExitEvent e)
@ -141,7 +147,10 @@ namespace osu.Game.Screens.Play
bool exiting = base.OnExiting(e);
if (LoadedBeatmapSuccessfully)
{
submitScore(Score.DeepClone());
spectatorClient.EndPlaying(GameplayState);
}
return exiting;
}