Make sure we restore the clock rate on exiting

This commit is contained in:
EVAST9919 2017-10-14 05:15:18 +03:00
parent bdcc70e0bb
commit 7a72f2e3f5
1 changed files with 5 additions and 0 deletions

View File

@ -49,6 +49,7 @@ public class Player : OsuScreen
private IAdjustableClock adjustableSourceClock;
private FramedOffsetClock offsetClock;
private DecoupleableInterpolatingFramedClock decoupledClock;
private double clockRate;
private PauseContainer pauseContainer;
@ -149,6 +150,8 @@ private void load(AudioManager audio, OsuConfigManager config, APIAccess api)
foreach (var mod in working.Mods.Value.OfType<IApplicableToClock>())
mod.ApplyToClock(adjustableSourceClock);
clockRate = adjustableSourceClock.Rate;
decoupledClock.ChangeSource(adjustableSourceClock);
});
@ -334,6 +337,8 @@ protected override bool OnExiting(Screen next)
{
if (HasFailed || !ValidForResume || pauseContainer?.AllowExit != false || RulesetContainer?.HasReplayLoaded != false)
{
// We want to make sure we restore the clock rate
adjustableSourceClock.Rate = clockRate;
fadeOut();
return base.OnExiting(next);
}