Fix switching to new beatmap not working correctly

This commit is contained in:
Dean Herbert
2020-10-28 17:42:04 +09:00
parent 730cc645fb
commit 6169349f7c
2 changed files with 21 additions and 3 deletions

View File

@ -2,18 +2,36 @@
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Online.Spectator;
using osu.Game.Scoring;
namespace osu.Game.Screens.Play
{
public class SpectatorPlayer : ReplayPlayer
{
[Resolved]
private SpectatorStreamingClient spectatorStreaming { get; set; }
public SpectatorPlayer(Score score)
: base(score)
{
}
[BackgroundDependencyLoader]
private void load()
{
spectatorStreaming.OnUserBeganPlaying += userBeganPlaying;
}
private void userBeganPlaying(int userId, SpectatorState state)
{
if (userId == Score.ScoreInfo.UserID)
Schedule(this.Exit);
}
protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart)
{
// if we already have frames, start gameplay at the point in time they exist, should they be too far into the beatmap.