Fix `IsCatchingUp` not being in correct state

This commit is contained in:
Dean Herbert 2022-08-15 20:16:14 +09:00
parent 9bc2e91de0
commit 87760bbc06
2 changed files with 6 additions and 8 deletions

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
@ -21,22 +19,22 @@ public class TestSceneGameplaySamplePlayback : PlayerTestScene
[Test]
public void TestAllSamplesStopDuringSeek()
{
DrawableSlider slider = null;
PoolableSkinnableSample[] samples = null;
ISamplePlaybackDisabler sampleDisabler = null;
DrawableSlider? slider = null;
PoolableSkinnableSample[] samples = null!;
ISamplePlaybackDisabler sampleDisabler = null!;
AddUntilStep("get variables", () =>
{
sampleDisabler = Player;
slider = Player.ChildrenOfType<DrawableSlider>().MinBy(s => s.HitObject.StartTime);
samples = slider?.ChildrenOfType<PoolableSkinnableSample>().ToArray();
samples = slider.ChildrenOfType<PoolableSkinnableSample>().ToArray();
return slider != null;
});
AddUntilStep("wait for slider sliding then seek", () =>
{
if (!slider.Tracking.Value)
if (slider?.Tracking.Value != true)
return false;
if (!samples.Any(s => s.Playing))

View File

@ -148,7 +148,7 @@ private void updateClock()
if (state == PlaybackState.Valid && proposedTime != manualClock.CurrentTime)
direction = proposedTime >= manualClock.CurrentTime ? 1 : -1;
double timeBehind = Math.Abs(proposedTime - CurrentTime);
double timeBehind = Math.Abs(proposedTime - referenceClock.CurrentTime);
IsCatchingUp.Value = timeBehind > 200;
WaitingOnFrames.Value = state == PlaybackState.NotValid;