Merge branch 'master' into spectator-listing

This commit is contained in:
Dean Herbert
2020-11-02 15:48:21 +09:00
58 changed files with 507 additions and 215 deletions

View File

@ -28,7 +28,7 @@ namespace osu.Game.Screens.Play
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
InternalChild = comboBreakSample = new SkinnableSound(new SampleInfo("combobreak"));
InternalChild = comboBreakSample = new SkinnableSound(new SampleInfo("Gameplay/combobreak"));
alwaysPlay = config.GetBindable<bool>(OsuSetting.AlwaysPlayFirstComboBreak);
}

View File

@ -63,6 +63,14 @@ namespace osu.Game.Screens.Play
private readonly FramedOffsetClock platformOffsetClock;
/// <summary>
/// Creates a new <see cref="GameplayClockContainer"/>.
/// </summary>
/// <param name="beatmap">The beatmap being played.</param>
/// <param name="gameplayStartTime">The suggested time to start gameplay at.</param>
/// <param name="startAtGameplayStart">
/// Whether <paramref name="gameplayStartTime"/> should be used regardless of when storyboard events and hitobjects are supposed to start.
/// </param>
public GameplayClockContainer(WorkingBeatmap beatmap, double gameplayStartTime, bool startAtGameplayStart = false)
{
this.beatmap = beatmap;

View File

@ -33,7 +33,7 @@ namespace osu.Game.Screens.Play
AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke());
AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
AddInternal(pauseLoop = new SkinnableSound(new SampleInfo("pause-loop"))
AddInternal(pauseLoop = new SkinnableSound(new SampleInfo("Gameplay/pause-loop"))
{
Looping = true,
Volume = { Value = 0 }

View File

@ -54,25 +54,6 @@ namespace osu.Game.Screens.Play
DrawableRuleset?.SetReplayScore(score);
}
private void userBeganPlaying(int userId, SpectatorState state)
{
if (userId == score.ScoreInfo.UserID)
{
Schedule(() =>
{
if (this.IsCurrentScreen()) this.Exit();
});
}
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (spectatorStreaming != null)
spectatorStreaming.OnUserBeganPlaying -= userBeganPlaying;
}
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.
@ -83,5 +64,29 @@ namespace osu.Game.Screens.Play
return new GameplayClockContainer(beatmap, firstFrameTime.Value, true);
}
public override bool OnExiting(IScreen next)
{
spectatorStreaming.OnUserBeganPlaying -= userBeganPlaying;
return base.OnExiting(next);
}
private void userBeganPlaying(int userId, SpectatorState state)
{
if (userId != score.ScoreInfo.UserID) return;
Schedule(() =>
{
if (this.IsCurrentScreen()) this.Exit();
});
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (spectatorStreaming != null)
spectatorStreaming.OnUserBeganPlaying -= userBeganPlaying;
}
}
}