1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:37:28 +08:00

Only set initial source in Reset()

This commit is contained in:
smoogipoo 2021-04-19 19:55:59 +09:00
parent c7183f92f7
commit acbf4580a4
2 changed files with 17 additions and 4 deletions

View File

@ -29,17 +29,22 @@ namespace osu.Game.Screens.Play
/// </summary>
protected readonly DecoupleableInterpolatingFramedClock AdjustableSource;
/// <summary>
/// The source clock.
/// </summary>
protected IClock SourceClock { get; private set; }
/// <summary>
/// Creates a new <see cref="GameplayClockContainer"/>.
/// </summary>
/// <param name="sourceClock">The source <see cref="IClock"/> used for timing.</param>
protected GameplayClockContainer(IClock sourceClock)
{
SourceClock = sourceClock;
RelativeSizeAxes = Axes.Both;
AdjustableSource = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
AdjustableSource.ChangeSource(sourceClock);
IsPaused.BindValueChanged(OnIsPausedChanged);
}
@ -86,6 +91,8 @@ namespace osu.Game.Screens.Play
/// </summary>
public virtual void Reset()
{
ChangeSource(SourceClock);
AdjustableSource.Seek(0);
AdjustableSource.Stop();
@ -93,6 +100,12 @@ namespace osu.Game.Screens.Play
Start();
}
/// <summary>
/// Changes the source clock.
/// </summary>
/// <param name="sourceClock">The new source.</param>
protected void ChangeSource(IClock sourceClock) => AdjustableSource.ChangeSource(SourceClock = sourceClock);
protected override void Update()
{
if (!IsPaused.Value)

View File

@ -33,7 +33,7 @@ namespace osu.Game.Screens.Play
/// </summary>
public const double MINIMUM_SKIP_TIME = 1000;
protected Track Track => (Track)AdjustableSource.Source;
protected Track Track => (Track)SourceClock;
public readonly BindableNumber<double> UserPlaybackRate = new BindableDouble(1)
{
@ -164,7 +164,7 @@ namespace osu.Game.Screens.Play
public void StopUsingBeatmapClock()
{
removeSourceClockAdjustments();
AdjustableSource.ChangeSource(new TrackVirtual(beatmap.Track.Length));
ChangeSource(new TrackVirtual(beatmap.Track.Length));
}
private bool speedAdjustmentsApplied;