1
0
mirror of https://github.com/ppy/osu.git synced 2024-05-14 09:01:21 +08:00

Don't apply decoupling to SpectatorPlayerClocks

See inline comment for reasoning. It's a bit complicated.
This commit is contained in:
Dean Herbert 2023-09-22 14:26:33 +09:00
parent 6629a47ed3
commit 8367bb6bee
9 changed files with 14 additions and 10 deletions

View File

@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
[SetUp]
public void SetUp() => Schedule(() =>
{
gameplayClock = new GameplayClockContainer(manualClock)
gameplayClock = new GameplayClockContainer(manualClock, false, false)
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]

View File

@ -25,7 +25,7 @@ namespace osu.Game.Tests.NonVisual
private partial class TestGameplayClockContainer : GameplayClockContainer
{
public TestGameplayClockContainer(IFrameBasedClock underlyingClock)
: base(underlyingClock)
: base(underlyingClock, false, false)
{
AdjustmentsFromMods.AddAdjustment(AdjustableProperty.Frequency, new BindableDouble(2.0));
}

View File

@ -31,7 +31,7 @@ namespace osu.Game.Tests.OnlinePlay
[SetUp]
public void Setup()
{
syncManager = new SpectatorSyncManager(master = new GameplayClockContainer(new TestManualClock()));
syncManager = new SpectatorSyncManager(master = new GameplayClockContainer(new TestManualClock(), false, false));
player1 = syncManager.CreateManagedClock();
player2 = syncManager.CreateManagedClock();

View File

@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual.Gameplay
private GameplayState gameplayState = TestGameplayState.Create(new OsuRuleset());
[Cached(typeof(IGameplayClock))]
private readonly IGameplayClock gameplayClock = new GameplayClockContainer(new FramedClock());
private readonly IGameplayClock gameplayClock = new GameplayClockContainer(new FramedClock(), false, false);
// best way to check without exposing.
private Drawable hideTarget => hudOverlay.ChildrenOfType<SkinComponentsContainer>().First();

View File

@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.Gameplay
private GameplayState gameplayState = TestGameplayState.Create(new OsuRuleset());
[Cached(typeof(IGameplayClock))]
private readonly IGameplayClock gameplayClock = new GameplayClockContainer(new FramedClock());
private readonly IGameplayClock gameplayClock = new GameplayClockContainer(new FramedClock(), false, false);
[Cached]
public readonly EditorClipboard Clipboard = new EditorClipboard();

View File

@ -39,7 +39,7 @@ namespace osu.Game.Tests.Visual.Gameplay
private GameplayState gameplayState = TestGameplayState.Create(new OsuRuleset());
[Cached(typeof(IGameplayClock))]
private readonly IGameplayClock gameplayClock = new GameplayClockContainer(new FramedClock());
private readonly IGameplayClock gameplayClock = new GameplayClockContainer(new FramedClock(), false, false);
private IEnumerable<HUDOverlay> hudOverlays => CreatedDrawables.OfType<HUDOverlay>();

View File

@ -67,7 +67,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart)
{
var gameplayClockContainer = new GameplayClockContainer(spectatorPlayerClock);
// Importantly, we don't want to apply decoupling because SpectatorPlayerClock updates its IsRunning directly.
// If we applied decoupling, this state change wouldn't actually cause the clock to stop.
// TODO: Can we just use Start/Stop rather than this workaround, now that DecouplingClock is more sane?
var gameplayClockContainer = new GameplayClockContainer(spectatorPlayerClock, applyOffsets: false, requireDecoupling: false);
clockAdjustmentsFromMods.BindAdjustments(gameplayClockContainer.AdjustmentsFromMods);
return gameplayClockContainer;
}

View File

@ -55,13 +55,14 @@ namespace osu.Game.Screens.Play
/// </summary>
/// <param name="sourceClock">The source <see cref="IClock"/> used for timing.</param>
/// <param name="applyOffsets">Whether to apply platform, user and beatmap offsets to the mix.</param>
public GameplayClockContainer(IClock sourceClock, bool applyOffsets = false)
/// <param name="requireDecoupling">Whether decoupling logic should be applied on the source clock.</param>
public GameplayClockContainer(IClock sourceClock, bool applyOffsets, bool requireDecoupling)
{
RelativeSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
GameplayClock = new FramedBeatmapClock(applyOffsets, requireDecoupling: true, sourceClock),
GameplayClock = new FramedBeatmapClock(applyOffsets, requireDecoupling, sourceClock),
Content
};
}

View File

@ -65,7 +65,7 @@ namespace osu.Game.Screens.Play
/// <param name="beatmap">The beatmap to be used for time and metadata references.</param>
/// <param name="skipTargetTime">The latest time which should be used when introducing gameplay. Will be used when skipping forward.</param>
public MasterGameplayClockContainer(WorkingBeatmap beatmap, double skipTargetTime)
: base(beatmap.Track, true)
: base(beatmap.Track, applyOffsets: true, requireDecoupling: true)
{
this.beatmap = beatmap;
this.skipTargetTime = skipTargetTime;