From a6d8b28221910993005d6adbbcc5b0447b5a1511 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 11 Jan 2018 13:40:46 +0900 Subject: [PATCH] Add OSD + config value for scroll speed --- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 5 ++++- osu.Game/Configuration/OsuConfigManager.cs | 4 +++- osu.Game/Overlays/OnScreenDisplay.cs | 6 +++++- osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs | 7 +++++-- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 919518dbe8..532be2759f 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -15,6 +15,7 @@ using osu.Framework.Configuration; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Framework.Graphics.Shapes; +using osu.Game.Configuration; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.UI.Scrolling; @@ -161,8 +162,10 @@ namespace osu.Game.Rulesets.Mania.UI } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, OsuConfigManager config) { + config.BindWith(OsuSetting.UserScrollSpeed, VisibleTimeRange); + normalColumnColours = new List { colours.RedDark, diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 13213a54a1..26879782fc 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -73,6 +73,7 @@ namespace osu.Game.Configuration Set(OsuSetting.FloatingComments, false); Set(OsuSetting.ScrollingAlgorithm, ScrollingAlgorithmType.Global); + Set(OsuSetting.UserScrollSpeed, 1500.0, 50.0, 10000.0); // Update Set(OsuSetting.ReleaseStream, ReleaseStream.Lazer); @@ -119,6 +120,7 @@ namespace osu.Game.Configuration ChatDisplayHeight, Version, ShowConvertedBeatmaps, - ScrollingAlgorithm + ScrollingAlgorithm, + UserScrollSpeed } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 6a1bd8e182..4f3f03c749 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -14,6 +14,7 @@ using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; +using osu.Game.Configuration; using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays @@ -115,7 +116,7 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(FrameworkConfigManager frameworkConfig) + private void load(FrameworkConfigManager frameworkConfig, OsuConfigManager osuConfig) { trackSetting(frameworkConfig.GetBindable(FrameworkSetting.FrameSync), v => display(v, "Frame Limiter", v.GetDescription(), "Ctrl+F7")); trackSetting(frameworkConfig.GetBindable(FrameworkSetting.AudioDevice), v => display(v, "Audio Device", string.IsNullOrEmpty(v) ? "Default" : v, v)); @@ -135,6 +136,9 @@ namespace osu.Game.Overlays }); trackSetting(frameworkConfig.GetBindable(FrameworkSetting.WindowMode), v => display(v, "Screen Mode", v.ToString(), "Alt+Enter")); + + // Todo: This should be part of the ruleset-specific OSD + trackSetting(osuConfig.GetBindable(OsuSetting.UserScrollSpeed), v => display(v, "Scroll Speed", $"{v:N0}ms", "Ctrl+(+/-) to change")); } private readonly List references = new List(); diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index 11185015b8..fa04b7f137 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -102,13 +103,15 @@ namespace osu.Game.Rulesets.UI.Scrolling if (state.Keyboard.ControlPressed) { + var lastValue = Transforms.OfType().LastOrDefault()?.EndValue ?? VisibleTimeRange.Value; + switch (args.Key) { case Key.Minus: - transformVisibleTimeRangeTo(VisibleTimeRange + time_span_step, 200, Easing.OutQuint); + transformVisibleTimeRangeTo(lastValue + time_span_step, 200, Easing.OutQuint); break; case Key.Plus: - transformVisibleTimeRangeTo(VisibleTimeRange - time_span_step, 200, Easing.OutQuint); + transformVisibleTimeRangeTo(lastValue - time_span_step, 200, Easing.OutQuint); break; } }