From fe3ba2b80ee1ad0034217ec1693646a6f5d31d95 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 15 Apr 2021 19:07:25 +0900 Subject: [PATCH] Implement IAdjustableClock on GameplayClockContainer --- .../Screens/Play/GameplayClockContainer.cs | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index 6d863f0094..bbffdc2325 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -9,7 +10,7 @@ using osu.Framework.Timing; namespace osu.Game.Screens.Play { - public abstract class GameplayClockContainer : Container + public abstract class GameplayClockContainer : Container, IAdjustableClock { /// /// The final clock which is exposed to underlying components. @@ -90,5 +91,37 @@ namespace osu.Game.Screens.Play protected virtual IFrameBasedClock ClockToProcess => AdjustableClock; protected abstract GameplayClock CreateGameplayClock(IFrameBasedClock source); + + #region IAdjustableClock + + bool IAdjustableClock.Seek(double position) + { + Seek(position); + return true; + } + + void IAdjustableClock.Reset() + { + Restart(); + Stop(); + } + + public void ResetSpeedAdjustments() + { + } + + double IAdjustableClock.Rate + { + get => GameplayClock.Rate; + set => throw new NotSupportedException(); + } + + double IClock.Rate => GameplayClock.Rate; + + public double CurrentTime => GameplayClock.CurrentTime; + + public bool IsRunning => GameplayClock.IsRunning; + + #endregion } }