Merge pull request #18353 from frenzibyte/spectator-catch-up-work-alt

Disallow multi-spectator player clocks from being started/stopped externally
This commit is contained in:
Dan Balasescu
2022-05-23 13:59:54 +09:00
committed by GitHub
4 changed files with 46 additions and 22 deletions

View File

@ -34,6 +34,16 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
public void Stop() => IsRunning = false;
void IAdjustableClock.Start()
{
// Our running state should only be managed by an ISyncManager, ignore calls from external sources.
}
void IAdjustableClock.Stop()
{
// Our running state should only be managed by an ISyncManager, ignore calls from external sources.
}
public bool Seek(double position)
{
CurrentTime = position;

View File

@ -144,6 +144,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
// Make sure the player clock is running if it can.
if (!clock.WaitingOnFrames.Value)
clock.Start();
else
clock.Stop();
if (clock.IsCatchingUp)
{

View File

@ -11,6 +11,16 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
/// </summary>
public interface ISpectatorPlayerClock : IFrameBasedClock, IAdjustableClock
{
/// <summary>
/// Starts this <see cref="ISpectatorPlayerClock"/>.
/// </summary>
new void Start();
/// <summary>
/// Stops this <see cref="ISpectatorPlayerClock"/>.
/// </summary>
new void Stop();
/// <summary>
/// Whether this clock is waiting on frames to continue playback.
/// </summary>