Make WaitingOnFrames non-bindable

This commit is contained in:
Dean Herbert 2022-08-24 15:40:47 +09:00
parent d05d8aeb22
commit d33d705684
5 changed files with 8 additions and 13 deletions

View File

@ -146,12 +146,12 @@ namespace osu.Game.Tests.OnlinePlay
} }
private void setWaiting(Func<SpectatorPlayerClock> playerClock, bool waiting) private void setWaiting(Func<SpectatorPlayerClock> playerClock, bool waiting)
=> AddStep($"set player clock {clocksById[playerClock()]} waiting = {waiting}", () => playerClock().WaitingOnFrames.Value = waiting); => AddStep($"set player clock {clocksById[playerClock()]} waiting = {waiting}", () => playerClock().WaitingOnFrames = waiting);
private void setAllWaiting(bool waiting) => AddStep($"set all player clocks waiting = {waiting}", () => private void setAllWaiting(bool waiting) => AddStep($"set all player clocks waiting = {waiting}", () =>
{ {
player1.WaitingOnFrames.Value = waiting; player1.WaitingOnFrames = waiting;
player2.WaitingOnFrames.Value = waiting; player2.WaitingOnFrames = waiting;
}); });
private void setMasterTime(double time) private void setMasterTime(double time)

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
@ -14,7 +13,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
/// </summary> /// </summary>
public class MultiSpectatorPlayer : SpectatorPlayer public class MultiSpectatorPlayer : SpectatorPlayer
{ {
private readonly Bindable<bool> waitingOnFrames = new Bindable<bool>(true);
private readonly SpectatorPlayerClock spectatorPlayerClock; private readonly SpectatorPlayerClock spectatorPlayerClock;
/// <summary> /// <summary>
@ -31,8 +29,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
spectatorPlayerClock.WaitingOnFrames.BindTo(waitingOnFrames);
HUDOverlay.PlayerSettingsOverlay.Expire(); HUDOverlay.PlayerSettingsOverlay.Expire();
HUDOverlay.HoldToQuit.Expire(); HUDOverlay.HoldToQuit.Expire();
} }
@ -53,7 +49,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
base.UpdateAfterChildren(); base.UpdateAfterChildren();
// This is required because the frame stable clock is set to WaitingOnFrames = false for one frame. // This is required because the frame stable clock is set to WaitingOnFrames = false for one frame.
waitingOnFrames.Value = DrawableRuleset.FrameStableClock.WaitingOnFrames.Value || Score.Replay.Frames.Count == 0; spectatorPlayerClock.WaitingOnFrames = DrawableRuleset.FrameStableClock.WaitingOnFrames.Value || Score.Replay.Frames.Count == 0;
} }
protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart) protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart)

View File

@ -178,7 +178,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
} }
private bool isCandidateAudioSource(SpectatorPlayerClock? clock) private bool isCandidateAudioSource(SpectatorPlayerClock? clock)
=> clock?.IsRunning == true && !clock.IsCatchingUp && !clock.WaitingOnFrames.Value; => clock?.IsRunning == true && !clock.IsCatchingUp && !clock.WaitingOnFrames;
private void onReadyToStart() private void onReadyToStart()
{ {

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using osu.Framework.Bindables;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
@ -25,7 +24,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
/// <summary> /// <summary>
/// Whether this clock is waiting on frames to continue playback. /// Whether this clock is waiting on frames to continue playback.
/// </summary> /// </summary>
public Bindable<bool> WaitingOnFrames { get; } = new Bindable<bool>(true); public bool WaitingOnFrames { get; set; } = true;
/// <summary> /// <summary>
/// Whether this clock is behind the master clock and running at a higher rate to catch up to it. /// Whether this clock is behind the master clock and running at a higher rate to catch up to it.

View File

@ -111,7 +111,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
if (playerClocks.Count == 0) if (playerClocks.Count == 0)
return false; return false;
int readyCount = playerClocks.Count(s => !s.WaitingOnFrames.Value); int readyCount = playerClocks.Count(s => !s.WaitingOnFrames);
if (readyCount == playerClocks.Count) if (readyCount == playerClocks.Count)
return performStart(); return performStart();
@ -158,7 +158,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
} }
// Make sure the player clock is running if it can. // Make sure the player clock is running if it can.
clock.IsRunning = !clock.WaitingOnFrames.Value; clock.IsRunning = !clock.WaitingOnFrames;
if (clock.IsCatchingUp) if (clock.IsCatchingUp)
{ {