From c43b47da2ae79136aa7eb53f741630930c6acc94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 3 Dec 2016 13:56:19 +0100 Subject: [PATCH] Add option toggles and configuration for snaking in and out sliders. --- .../Objects/Drawables/DrawableSlider.cs | 34 ++++++++++++++----- osu.Game/Configuration/OsuConfigManager.cs | 11 +++--- .../Options/Graphics/DetailOptions.cs | 9 +++-- 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/osu.Game.Mode.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Mode.Osu/Objects/Drawables/DrawableSlider.cs index b5b4ea0541..2c817e7074 100644 --- a/osu.Game.Mode.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Mode.Osu/Objects/Drawables/DrawableSlider.cs @@ -11,6 +11,8 @@ using osu.Framework.Input; using OpenTK.Graphics.ES30; using osu.Framework.Allocation; using osu.Framework.Graphics.Textures; +using osu.Game.Configuration; +using osu.Framework.Configuration; namespace osu.Game.Modes.Osu.Objects.Drawables { @@ -49,12 +51,24 @@ namespace osu.Game.Modes.Osu.Objects.Drawables }; } + private Bindable snakingIn; + private Bindable snakingOut; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + snakingIn = config.GetBindable(OsuConfig.SnakingInSliders); + snakingOut = config.GetBindable(OsuConfig.SnakingOutSliders); + } + protected override void LoadComplete() { base.LoadComplete(); //force application of the state that was set before we loaded. UpdateState(State); + + body.PathWidth = 32; } protected override void Update() @@ -77,7 +91,9 @@ namespace osu.Game.Modes.Osu.Objects.Drawables ball.Position = slider.Curve.PositionAt(currentProgress); double drawEndProgress = MathHelper.Clamp((Time.Current - slider.StartTime + TIME_PREEMPT) / TIME_FADEIN, 0, 1); - body.SetRange(drawStartProgress, drawEndProgress); + body.SetRange( + snakingOut ? drawStartProgress : 0, + snakingIn ? drawEndProgress : 1); } protected override void CheckJudgement(bool userTriggered) @@ -192,8 +208,14 @@ namespace osu.Game.Modes.Osu.Objects.Drawables private Path path; private BufferedContainer container; - private double drawnProgressStart; - private double drawnProgressEnd; + public float PathWidth + { + get { return path.PathWidth; } + set { path.PathWidth = value; } + } + + private double? drawnProgressStart; + private double? drawnProgressEnd; private Slider slider; public Body(Slider s) @@ -227,12 +249,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables path.Texture = textures.Get(@"Menu/logo"); } - protected override void LoadComplete() - { - base.LoadComplete(); - path.PathWidth = 32; - } - public void SetRange(double p0, double p1) { if (p0 > p1) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 8657f74d87..6f2175cb97 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -9,7 +9,7 @@ using osu.Game.Screens.Play; namespace osu.Game.Configuration { - class OsuConfigManager : ConfigManager + public class OsuConfigManager : ConfigManager { protected override void InitialiseDefaults() { @@ -129,7 +129,8 @@ namespace osu.Game.Configuration //Set(OsuConfig.Skin, SkinManager.DEFAULT_SKIN); Set(OsuConfig.SkinSamples, true); Set(OsuConfig.SkipTablet, false); - Set(OsuConfig.SnakingSliders, true); + Set(OsuConfig.SnakingInSliders, true); + Set(OsuConfig.SnakingOutSliders, false); Set(OsuConfig.Tablet, false); Set(OsuConfig.UpdatePending, false); Set(OsuConfig.UseSkinCursor, false); @@ -189,7 +190,7 @@ namespace osu.Game.Configuration } } - enum OsuConfig + public enum OsuConfig { // New osu: PlayMode, @@ -303,7 +304,8 @@ namespace osu.Game.Configuration Skin, SkinSamples, SkipTablet, - SnakingSliders, + SnakingInSliders, + SnakingOutSliders, Tablet, UpdatePending, UserFilter, @@ -345,5 +347,6 @@ namespace osu.Game.Configuration Ticker, CompatibilityContext, CanForceOptimusCompatibility, + } } diff --git a/osu.Game/Overlays/Options/Graphics/DetailOptions.cs b/osu.Game/Overlays/Options/Graphics/DetailOptions.cs index 12df61f52b..1a947e4c13 100644 --- a/osu.Game/Overlays/Options/Graphics/DetailOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/DetailOptions.cs @@ -18,8 +18,13 @@ namespace osu.Game.Overlays.Options.Graphics { new CheckBoxOption { - LabelText = "Snaking sliders", - Bindable = config.GetBindable(OsuConfig.SnakingSliders) + LabelText = "Snaking in sliders", + Bindable = config.GetBindable(OsuConfig.SnakingInSliders) + }, + new CheckBoxOption + { + LabelText = "Snaking out sliders", + Bindable = config.GetBindable(OsuConfig.SnakingOutSliders) }, new CheckBoxOption {