mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Fix switching to new beatmap not working correctly
This commit is contained in:
parent
730cc645fb
commit
6169349f7c
@ -164,7 +164,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
this.state = state;
|
||||
|
||||
attemptStart();
|
||||
Schedule(attemptStart);
|
||||
}
|
||||
|
||||
private void userFinishedPlaying(int userId, SpectatorState state)
|
||||
@ -175,6 +175,7 @@ namespace osu.Game.Screens.Play
|
||||
if (replay == null) return;
|
||||
|
||||
replay.HasReceivedAllFrames = true;
|
||||
replay = null;
|
||||
}
|
||||
|
||||
private void attemptStart()
|
||||
@ -188,8 +189,6 @@ namespace osu.Game.Screens.Play
|
||||
if (state.BeatmapID == null)
|
||||
return;
|
||||
|
||||
this.MakeCurrent();
|
||||
|
||||
var resolvedBeatmap = beatmaps.QueryBeatmap(b => b.OnlineBeatmapID == state.BeatmapID);
|
||||
|
||||
if (resolvedBeatmap == null)
|
||||
@ -201,6 +200,7 @@ namespace osu.Game.Screens.Play
|
||||
var scoreInfo = new ScoreInfo
|
||||
{
|
||||
Beatmap = resolvedBeatmap,
|
||||
User = targetUser,
|
||||
Mods = state.Mods.Select(m => m.ToMod(resolvedRuleset)).ToArray(),
|
||||
Ruleset = resolvedRuleset.RulesetInfo,
|
||||
};
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user