mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 16:02:56 +08:00
Don't apply decoupling to SpectatorPlayerClock
s
See inline comment for reasoning. It's a bit complicated.
This commit is contained in:
parent
6629a47ed3
commit
8367bb6bee
@ -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[]
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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>();
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user