1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 13:22:55 +08:00

Inline ReadyToStart action binding for added safety

This commit is contained in:
Dean Herbert 2022-08-24 15:56:36 +09:00
parent 6c50f618a3
commit 871365bbb0
2 changed files with 6 additions and 5 deletions

View File

@ -78,7 +78,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
InternalChildren = new[]
{
(Drawable)(syncManager = new SpectatorSyncManager(masterClockContainer)),
(Drawable)(syncManager = new SpectatorSyncManager(masterClockContainer)
{
ReadyToStart = performInitialSeek,
}),
masterClockContainer.WithChild(new GridContainer
{
RelativeSizeAxes = Axes.Both,
@ -154,8 +157,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
base.LoadComplete();
masterClockContainer.Reset();
syncManager.ReadyToStart += onReadyToStart;
}
protected override void Update()
@ -176,7 +177,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
private bool isCandidateAudioSource(SpectatorPlayerClock? clock)
=> clock?.IsRunning == true && !clock.IsCatchingUp && !clock.WaitingOnFrames;
private void onReadyToStart()
private void performInitialSeek()
{
// Seek the master clock to the gameplay time.
// This is chosen as the first available frame in the players' replays, which matches the seek by each individual SpectatorPlayer.

View File

@ -33,7 +33,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
/// <summary>
/// An event which is invoked when gameplay is ready to start.
/// </summary>
public event Action? ReadyToStart;
public Action? ReadyToStart;
public double CurrentMasterTime => masterClock.CurrentTime;