From 6d97da8b19151fdf9cee4cd46b1ae6733caa9c02 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 2 Oct 2017 04:42:38 +0300 Subject: [PATCH 01/11] Add replay speed adjustment --- osu.Game/Screens/Play/HUDOverlay.cs | 18 +++++++++------- osu.Game/Screens/Play/Player.cs | 2 ++ .../Play/ReplaySettings/PlaybackSettings.cs | 21 ++++++++++++------- .../Screens/Play/ReplaySettingsOverlay.cs | 8 ++++--- 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index ddcf031bd4..c632b7d893 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -32,6 +32,7 @@ namespace osu.Game.Screens.Play public readonly HealthDisplay HealthDisplay; public readonly SongProgress Progress; public readonly ModDisplay ModDisplay; + public readonly ReplaySettingsOverlay ReplaySettingsOverlay; private Bindable showHud; private bool replayLoaded; @@ -55,7 +56,7 @@ namespace osu.Game.Screens.Play HealthDisplay = CreateHealthDisplay(), Progress = CreateProgress(), ModDisplay = CreateModsContainer(), - //ReplaySettingsOverlay = CreateReplaySettingsOverlay(), + ReplaySettingsOverlay = CreateReplaySettingsOverlay(), } }); } @@ -98,7 +99,10 @@ namespace osu.Game.Screens.Play // in the case a replay isn't loaded, we want some elements to only appear briefly. if (!replayLoaded) + { + ReplaySettingsOverlay.Hide(); ModDisplay.Delay(2000).FadeOut(200); + } } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) @@ -176,12 +180,12 @@ namespace osu.Game.Screens.Play Margin = new MarginPadding { Top = 20, Right = 10 }, }; - //protected virtual ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay - //{ - // Anchor = Anchor.TopRight, - // Origin = Anchor.TopRight, - // Margin = new MarginPadding { Top = 100, Right = 10 }, - //}; + protected virtual ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Margin = new MarginPadding { Top = 100, Right = 10 }, + }; public virtual void BindProcessor(ScoreProcessor processor) { diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e120c7f193..9d983fd0a9 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -222,6 +222,8 @@ namespace osu.Game.Screens.Play hudOverlay.ModDisplay.Current.BindTo(working.Mods); + hudOverlay.ReplaySettingsOverlay.PlaybackSettings.BindClock(adjustableSourceClock); + // Bind ScoreProcessor to ourselves scoreProcessor.AllJudged += onCompletion; scoreProcessor.Failed += onFail; diff --git a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs index ea958d05f9..49b5ce4474 100644 --- a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs @@ -3,7 +3,7 @@ using osu.Framework.Allocation; using osu.Game.Configuration; -using osu.Framework.Graphics; +using osu.Framework.Timing; namespace osu.Game.Screens.Play.ReplaySettings { @@ -11,17 +11,24 @@ namespace osu.Game.Screens.Play.ReplaySettings { protected override string Title => @"playback"; + private ReplaySliderBar sliderbar; + [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - Children = new Drawable[] + Child = sliderbar = new ReplaySliderBar { - new ReplaySliderBar - { - LabelText = "Playback speed", - Bindable = config.GetBindable(OsuSetting.PlaybackSpeed) - } + LabelText = "Playback speed", + Bindable = config.GetBindable(OsuSetting.PlaybackSpeed), }; } + + public void BindClock(IAdjustableClock clock) + { + var clockRate = clock.Rate; + sliderbar.Bindable.ValueChanged += (rateMultiplier) => clock.Rate = clockRate * rateMultiplier; + + sliderbar.Bindable.Value = 1; + } } } diff --git a/osu.Game/Screens/Play/ReplaySettingsOverlay.cs b/osu.Game/Screens/Play/ReplaySettingsOverlay.cs index 415f70005d..0edf4634ba 100644 --- a/osu.Game/Screens/Play/ReplaySettingsOverlay.cs +++ b/osu.Game/Screens/Play/ReplaySettingsOverlay.cs @@ -10,15 +10,17 @@ namespace osu.Game.Screens.Play { public class ReplaySettingsOverlay : FillFlowContainer { + public readonly PlaybackSettings PlaybackSettings; + public ReplaySettingsOverlay() { Direction = FillDirection.Vertical; AutoSizeAxes = Axes.Both; Spacing = new Vector2(0, 20); - Add(new CollectionSettings()); - Add(new DiscussionSettings()); - Add(new PlaybackSettings()); + //Add(new CollectionSettings()); + //Add(new DiscussionSettings()); + Add(PlaybackSettings = new PlaybackSettings()); } } } From c34cc07fdadcc00bd4328a532a88e4a6dd53efb7 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 2 Oct 2017 18:09:00 +0300 Subject: [PATCH 02/11] Remove default bindable from the config manager --- osu.Game/Configuration/OsuConfigManager.cs | 2 -- .../Play/ReplaySettings/PlaybackSettings.cs | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index b000f08369..b341c4413b 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -69,7 +69,6 @@ namespace osu.Game.Configuration Set(OsuSetting.KeyOverlay, false); Set(OsuSetting.FloatingComments, false); - Set(OsuSetting.PlaybackSpeed, 1.0, 0.5f, 2); // Update Set(OsuSetting.ReleaseStream, ReleaseStream.Lazer); @@ -93,7 +92,6 @@ namespace osu.Game.Configuration ShowStoryboard, KeyOverlay, FloatingComments, - PlaybackSpeed, ShowInterface, MouseDisableButtons, MouseDisableWheel, diff --git a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs index 49b5ce4474..e8f20e3087 100644 --- a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs @@ -1,9 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; -using osu.Game.Configuration; using osu.Framework.Timing; +using osu.Framework.Configuration; namespace osu.Game.Screens.Play.ReplaySettings { @@ -11,15 +10,20 @@ namespace osu.Game.Screens.Play.ReplaySettings { protected override string Title => @"playback"; - private ReplaySliderBar sliderbar; + private readonly ReplaySliderBar sliderbar; - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private readonly BindableNumber current; + + public PlaybackSettings() { + current = new BindableDouble(1) as BindableNumber; + current.MinValue = 0.5; + current.MaxValue = 2; + Child = sliderbar = new ReplaySliderBar { LabelText = "Playback speed", - Bindable = config.GetBindable(OsuSetting.PlaybackSpeed), + Bindable = current, }; } @@ -27,8 +31,6 @@ namespace osu.Game.Screens.Play.ReplaySettings { var clockRate = clock.Rate; sliderbar.Bindable.ValueChanged += (rateMultiplier) => clock.Rate = clockRate * rateMultiplier; - - sliderbar.Bindable.Value = 1; } } } From 4a298098c506fb3e61a680d5872a83ad321239a4 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 2 Oct 2017 18:19:55 +0300 Subject: [PATCH 03/11] CI fixes --- .../Play/ReplaySettings/PlaybackSettings.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs index e8f20e3087..9129dcab94 100644 --- a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs @@ -12,25 +12,23 @@ namespace osu.Game.Screens.Play.ReplaySettings private readonly ReplaySliderBar sliderbar; - private readonly BindableNumber current; - public PlaybackSettings() { - current = new BindableDouble(1) as BindableNumber; - current.MinValue = 0.5; - current.MaxValue = 2; - Child = sliderbar = new ReplaySliderBar { LabelText = "Playback speed", - Bindable = current, + Bindable = new BindableDouble(1) + { + MinValue = 0.5, + MaxValue = 2 + }, }; } public void BindClock(IAdjustableClock clock) { var clockRate = clock.Rate; - sliderbar.Bindable.ValueChanged += (rateMultiplier) => clock.Rate = clockRate * rateMultiplier; + sliderbar.Bindable.ValueChanged += rateMultiplier => clock.Rate = clockRate * rateMultiplier; } } } From b94c78e99306c4728fcd79f6cb7c9c9b1557aacb Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 2 Oct 2017 19:33:58 +0300 Subject: [PATCH 04/11] Hide/Show Replay settings on pressing Ctrl+H --- .../Screens/Play/HUD/ReplaySettingsOverlay.cs | 66 +++++++++++++++++++ osu.Game/Screens/Play/HUDOverlay.cs | 7 +- .../Screens/Play/ReplaySettingsOverlay.cs | 26 -------- .../Visual/TestCaseReplaySettingsOverlay.cs | 2 +- osu.Game/osu.Game.csproj | 2 +- 5 files changed, 69 insertions(+), 34 deletions(-) create mode 100644 osu.Game/Screens/Play/HUD/ReplaySettingsOverlay.cs delete mode 100644 osu.Game/Screens/Play/ReplaySettingsOverlay.cs diff --git a/osu.Game/Screens/Play/HUD/ReplaySettingsOverlay.cs b/osu.Game/Screens/Play/HUD/ReplaySettingsOverlay.cs new file mode 100644 index 0000000000..9f55ce8ce5 --- /dev/null +++ b/osu.Game/Screens/Play/HUD/ReplaySettingsOverlay.cs @@ -0,0 +1,66 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Screens.Play.ReplaySettings; +using OpenTK; +using osu.Framework.Input; +using OpenTK.Input; + +namespace osu.Game.Screens.Play.HUD +{ + public class ReplaySettingsOverlay : VisibilityContainer + { + private const int fade_duration = 200; + + public override bool HandleInput => true; + + public readonly PlaybackSettings PlaybackSettings; + //public readonly CollectionSettings CollectionSettings; + //public readonly DiscussionSettings DiscussionSettings; + + public ReplaySettingsOverlay() + { + AlwaysPresent = true; + RelativeSizeAxes = Axes.Both; + + Child = new FillFlowContainer + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 20), + Margin = new MarginPadding { Top = 100, Right = 10 }, + Children = new [] + { + //CollectionSettings = new CollectionSettings(), + //DiscussionSettings = new DiscussionSettings(), + PlaybackSettings = new PlaybackSettings(), + } + }; + + State = Visibility.Visible; + } + + protected override void PopIn() => this.FadeIn(fade_duration); + protected override void PopOut() => this.FadeOut(fade_duration); + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Repeat) return false; + + if (state.Keyboard.ControlPressed) + { + if (args.Key == Key.H) + { + ToggleVisibility(); + return true; + } + } + + return base.OnKeyDown(state, args); + } + } +} diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index c632b7d893..1d7e0727ba 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -180,12 +180,7 @@ namespace osu.Game.Screens.Play Margin = new MarginPadding { Top = 20, Right = 10 }, }; - protected virtual ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Margin = new MarginPadding { Top = 100, Right = 10 }, - }; + protected virtual ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay(); public virtual void BindProcessor(ScoreProcessor processor) { diff --git a/osu.Game/Screens/Play/ReplaySettingsOverlay.cs b/osu.Game/Screens/Play/ReplaySettingsOverlay.cs deleted file mode 100644 index 0edf4634ba..0000000000 --- a/osu.Game/Screens/Play/ReplaySettingsOverlay.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Screens.Play.ReplaySettings; -using OpenTK; - -namespace osu.Game.Screens.Play -{ - public class ReplaySettingsOverlay : FillFlowContainer - { - public readonly PlaybackSettings PlaybackSettings; - - public ReplaySettingsOverlay() - { - Direction = FillDirection.Vertical; - AutoSizeAxes = Axes.Both; - Spacing = new Vector2(0, 20); - - //Add(new CollectionSettings()); - //Add(new DiscussionSettings()); - Add(PlaybackSettings = new PlaybackSettings()); - } - } -} diff --git a/osu.Game/Tests/Visual/TestCaseReplaySettingsOverlay.cs b/osu.Game/Tests/Visual/TestCaseReplaySettingsOverlay.cs index 256c3d25c9..3105a7d588 100644 --- a/osu.Game/Tests/Visual/TestCaseReplaySettingsOverlay.cs +++ b/osu.Game/Tests/Visual/TestCaseReplaySettingsOverlay.cs @@ -3,7 +3,7 @@ using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; -using osu.Game.Screens.Play; +using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.ReplaySettings; namespace osu.Game.Tests.Visual diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c8e42a3ad3..f04aa4708c 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -656,7 +656,7 @@ - + From feb0b1852fe8e5e8107be177352fd81297058fb5 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 3 Oct 2017 20:05:50 +0300 Subject: [PATCH 05/11] Remove the dangerous function --- osu.Game/Screens/Play/Player.cs | 2 +- .../Play/ReplaySettings/PlaybackSettings.cs | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 9d983fd0a9..7e5ab58adb 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -222,7 +222,7 @@ namespace osu.Game.Screens.Play hudOverlay.ModDisplay.Current.BindTo(working.Mods); - hudOverlay.ReplaySettingsOverlay.PlaybackSettings.BindClock(adjustableSourceClock); + hudOverlay.ReplaySettingsOverlay.PlaybackSettings.AdjustableClock = adjustableSourceClock; // Bind ScoreProcessor to ourselves scoreProcessor.AllJudged += onCompletion; diff --git a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs index 9129dcab94..24f128ef49 100644 --- a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs @@ -10,6 +10,13 @@ namespace osu.Game.Screens.Play.ReplaySettings { protected override string Title => @"playback"; + private IAdjustableClock adjustableClock; + public IAdjustableClock AdjustableClock + { + set { adjustableClock = value; } + get { return adjustableClock; } + } + private readonly ReplaySliderBar sliderbar; public PlaybackSettings() @@ -25,10 +32,15 @@ namespace osu.Game.Screens.Play.ReplaySettings }; } - public void BindClock(IAdjustableClock clock) + protected override void LoadComplete() { - var clockRate = clock.Rate; - sliderbar.Bindable.ValueChanged += rateMultiplier => clock.Rate = clockRate * rateMultiplier; + base.LoadComplete(); + + if (adjustableClock != null) + { + var clockRate = adjustableClock.Rate; + sliderbar.Bindable.ValueChanged += rateMultiplier => adjustableClock.Rate = clockRate * rateMultiplier; + } } } } From 1c132938dfdd57d338eed74751107e11e266b27e Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 3 Oct 2017 20:26:53 +0300 Subject: [PATCH 06/11] Allow visibility can be toggled only if replay is loaded --- osu.Game/Screens/Play/HUD/ReplaySettingsOverlay.cs | 4 +++- osu.Game/Screens/Play/HUDOverlay.cs | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUD/ReplaySettingsOverlay.cs b/osu.Game/Screens/Play/HUD/ReplaySettingsOverlay.cs index 9f55ce8ce5..e44a738d55 100644 --- a/osu.Game/Screens/Play/HUD/ReplaySettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/ReplaySettingsOverlay.cs @@ -14,6 +14,8 @@ namespace osu.Game.Screens.Play.HUD { private const int fade_duration = 200; + public bool ReplayLoaded; + public override bool HandleInput => true; public readonly PlaybackSettings PlaybackSettings; @@ -53,7 +55,7 @@ namespace osu.Game.Screens.Play.HUD if (state.Keyboard.ControlPressed) { - if (args.Key == Key.H) + if (args.Key == Key.H && ReplayLoaded) { ToggleVisibility(); return true; diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 1d7e0727ba..f4b5efe1e5 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -97,6 +97,8 @@ namespace osu.Game.Screens.Play replayLoaded = rulesetContainer.HasReplayLoaded; + ReplaySettingsOverlay.ReplayLoaded = replayLoaded; + // in the case a replay isn't loaded, we want some elements to only appear briefly. if (!replayLoaded) { From 7a72f2e3f558f6ec765582dbdc74cc1965dfcdb4 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 14 Oct 2017 05:15:18 +0300 Subject: [PATCH 07/11] Make sure we restore the clock rate on exiting --- osu.Game/Screens/Play/Player.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 7af260135e..c0a50b1a6f 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -49,6 +49,7 @@ namespace osu.Game.Screens.Play private IAdjustableClock adjustableSourceClock; private FramedOffsetClock offsetClock; private DecoupleableInterpolatingFramedClock decoupledClock; + private double clockRate; private PauseContainer pauseContainer; @@ -149,6 +150,8 @@ namespace osu.Game.Screens.Play foreach (var mod in working.Mods.Value.OfType()) mod.ApplyToClock(adjustableSourceClock); + clockRate = adjustableSourceClock.Rate; + decoupledClock.ChangeSource(adjustableSourceClock); }); @@ -334,6 +337,8 @@ namespace osu.Game.Screens.Play { 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); } From 826d806e814e8720c433dbee2f5f9dd4da6bdd49 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 26 Oct 2017 15:07:58 +0300 Subject: [PATCH 08/11] Submodules update --- osu-framework | 2 +- osu-resources | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu-framework b/osu-framework index 5986f21268..a9eb6eaab7 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 5986f2126832451a5a7ec832a483e1dcec1b38b8 +Subproject commit a9eb6eaab7cd77f881acfdc23664df45e5d31105 diff --git a/osu-resources b/osu-resources index a4418111f8..1e2d394e01 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit a4418111f8ed2350a6fd46fe69258884f0757745 +Subproject commit 1e2d394e017d98f086271ae07fb61859b5d8fadf From a7bcae48694a1ead3949cedcf866c59d3b77d751 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 26 Oct 2017 15:18:06 +0300 Subject: [PATCH 09/11] Add startup value for the slider --- osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs index 4fea69e259..7cabe1f3ab 100644 --- a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Play.ReplaySettings Child = sliderbar = new ReplaySliderBar { LabelText = "Playback speed", - Bindable = new BindableDouble + Bindable = new BindableDouble(1) { Default = 1, MinValue = 0.5, From 3142832693d28ccc9e7c5d355c374554656a4b58 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 11 Nov 2017 13:00:29 +0900 Subject: [PATCH 10/11] Add precision to playback speed --- osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs index 7cabe1f3ab..bf2909b8ab 100644 --- a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs @@ -23,7 +23,8 @@ namespace osu.Game.Screens.Play.ReplaySettings { Default = 1, MinValue = 0.5, - MaxValue = 2 + MaxValue = 2, + Precision = 0.01, }, }; } From 7d4e1b6f22c9ee350b2cebde7a5cc5e9d8238fbb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 11 Nov 2017 13:00:54 +0900 Subject: [PATCH 11/11] Don't require a local storage variable for restoring playback speed --- osu.Game/Screens/Play/Player.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2daf8f0765..59d56a5a44 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -51,7 +51,6 @@ namespace osu.Game.Screens.Play private IAdjustableClock adjustableSourceClock; private FramedOffsetClock offsetClock; private DecoupleableInterpolatingFramedClock decoupledClock; - private double clockRate; private PauseContainer pauseContainer; @@ -157,10 +156,7 @@ namespace osu.Game.Screens.Play Schedule(() => { decoupledClock.ChangeSource(adjustableSourceClock); - foreach (var mod in working.Mods.Value.OfType()) - mod.ApplyToClock(adjustableSourceClock); - - clockRate = adjustableSourceClock.Rate; + applyRateFromMods(); }); }); @@ -249,6 +245,13 @@ namespace osu.Game.Screens.Play scoreProcessor.Failed += onFail; } + private void applyRateFromMods() + { + adjustableSourceClock.Rate = 1; + foreach (var mod in Beatmap.Value.Mods.Value.OfType()) + mod.ApplyToClock(adjustableSourceClock); + } + private void initializeStoryboard(bool asyncLoad) { var beatmap = Beatmap.Value.Beatmap; @@ -346,8 +349,9 @@ namespace osu.Game.Screens.Play { if (HasFailed || !ValidForResume || pauseContainer?.AllowExit != false || RulesetContainer?.HasReplayLoaded != false) { - // We want to make sure we restore the clock rate - adjustableSourceClock.Rate = clockRate; + // In the case of replays, we may have changed the playback rate. + applyRateFromMods(); + fadeOut(); return base.OnExiting(next); }