From 5c11270b988f7e8f85eddafe329d048d14228ad6 Mon Sep 17 00:00:00 2001 From: Ron B Date: Sat, 15 Aug 2020 20:12:06 +0300 Subject: [PATCH 1/8] Add SpinnerFrequencyModulate skin config option --- .../Objects/Drawables/DrawableSpinner.cs | 9 ++++++--- osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index d1a6463d72..273a9fda84 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -12,6 +12,7 @@ using osu.Game.Graphics; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Osu.Skinning; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Ranking; using osu.Game.Skinning; @@ -31,6 +32,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private readonly IBindable positionBindable = new Bindable(); + private bool spinnerFrequencyModulate; + public DrawableSpinner(Spinner s) : base(s) { @@ -165,10 +168,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, ISkinSource skin) { positionBindable.BindValueChanged(pos => Position = pos.NewValue); positionBindable.BindTo(HitObject.PositionBindable); + spinnerFrequencyModulate = skin.GetConfig(OsuSkinConfiguration.SpinnerFrequencyModulate)?.Value ?? true; } /// @@ -221,8 +225,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables RotationTracker.Tracking = !Result.HasResult && (OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false); if (spinningSample != null) - // todo: implement SpinnerFrequencyModulate - spinningSample.Frequency.Value = 0.5f + Progress; + spinningSample.Frequency.Value = spinnerFrequencyModulate ? 0.5f + Progress : 0.5f; } protected override void UpdateAfterChildren() diff --git a/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs b/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs index 154160fdb5..54755bd9d5 100644 --- a/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs +++ b/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs @@ -13,6 +13,7 @@ namespace osu.Game.Rulesets.Osu.Skinning CursorExpand, CursorRotate, HitCircleOverlayAboveNumber, - HitCircleOverlayAboveNumer // Some old skins will have this typo + HitCircleOverlayAboveNumer, // Some old skins will have this typo + SpinnerFrequencyModulate } } From 896a87e62921bfef2281a822eb20c784e3612fd2 Mon Sep 17 00:00:00 2001 From: Ron B Date: Sat, 15 Aug 2020 20:14:36 +0300 Subject: [PATCH 2/8] Replace accidental tab with spaces --- osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs b/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs index 54755bd9d5..1d34727c04 100644 --- a/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs +++ b/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Skinning CursorExpand, CursorRotate, HitCircleOverlayAboveNumber, - HitCircleOverlayAboveNumer, // Some old skins will have this typo + HitCircleOverlayAboveNumer, // Some old skins will have this typo SpinnerFrequencyModulate } } From 61de3c75402f55704c07da9128778f35b374a52f Mon Sep 17 00:00:00 2001 From: Ron B Date: Sat, 15 Aug 2020 20:16:28 +0300 Subject: [PATCH 3/8] Replace accidental tab with spaces --- osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs b/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs index 1d34727c04..e034e14eb0 100644 --- a/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs +++ b/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Skinning CursorExpand, CursorRotate, HitCircleOverlayAboveNumber, - HitCircleOverlayAboveNumer, // Some old skins will have this typo - SpinnerFrequencyModulate + HitCircleOverlayAboveNumer, // Some old skins will have this typo + SpinnerFrequencyModulate } } From 07c25d5a78d2df33e3d54d3922da6723c3622f2f Mon Sep 17 00:00:00 2001 From: Ron B Date: Sat, 15 Aug 2020 20:51:33 +0300 Subject: [PATCH 4/8] Move spinnerFrequencyModulate set to ApplySkin --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 273a9fda84..5bf87ba16b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -172,6 +172,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { positionBindable.BindValueChanged(pos => Position = pos.NewValue); positionBindable.BindTo(HitObject.PositionBindable); + } + + protected override void ApplySkin(ISkinSource skin, bool allowFallback) + { spinnerFrequencyModulate = skin.GetConfig(OsuSkinConfiguration.SpinnerFrequencyModulate)?.Value ?? true; } From 40445d0005fe33943baf6350e8e2b35869e08643 Mon Sep 17 00:00:00 2001 From: Ron B Date: Sat, 15 Aug 2020 21:07:44 +0300 Subject: [PATCH 5/8] replicate osu-stable behaviour for spinningSample frequency --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 5bf87ba16b..dfe10eeaab 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -104,6 +104,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { Volume = { Value = 0 }, Looping = true, + Frequency = { Value = 1.0f } }); } } @@ -228,8 +229,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables if (HandleUserInput) RotationTracker.Tracking = !Result.HasResult && (OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false); - if (spinningSample != null) - spinningSample.Frequency.Value = spinnerFrequencyModulate ? 0.5f + Progress : 0.5f; + if (spinningSample != null && spinnerFrequencyModulate) + spinningSample.Frequency.Value = 0.5f + Progress; } protected override void UpdateAfterChildren() From a1079bac3234f53f39e894dbd888321e21561907 Mon Sep 17 00:00:00 2001 From: Ron B Date: Sat, 15 Aug 2020 21:19:47 +0300 Subject: [PATCH 6/8] Move frequency values into consts --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index dfe10eeaab..c44553a1c5 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -85,6 +85,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } private SkinnableSound spinningSample; + private const float SPINNING_SAMPLE_INITAL_FREQUENCY = 1.0f; + private const float SPINNING_SAMPLE_MODULATED_BASE_FREQUENCY = 0.5f; protected override void LoadSamples() { @@ -104,7 +106,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { Volume = { Value = 0 }, Looping = true, - Frequency = { Value = 1.0f } + Frequency = { Value = SPINNING_SAMPLE_INITAL_FREQUENCY } }); } } @@ -230,7 +232,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables RotationTracker.Tracking = !Result.HasResult && (OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false); if (spinningSample != null && spinnerFrequencyModulate) - spinningSample.Frequency.Value = 0.5f + Progress; + spinningSample.Frequency.Value = SPINNING_SAMPLE_MODULATED_BASE_FREQUENCY + Progress; } protected override void UpdateAfterChildren() From 390e87273065aef35335d3d1e617dc62c9ea90eb Mon Sep 17 00:00:00 2001 From: Ron B Date: Sat, 15 Aug 2020 21:34:17 +0300 Subject: [PATCH 7/8] Fix acoording to review --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index c44553a1c5..a4636050bb 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -85,7 +85,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } private SkinnableSound spinningSample; - private const float SPINNING_SAMPLE_INITAL_FREQUENCY = 1.0f; + private const float SPINNING_SAMPLE_INITIAL_FREQUENCY = 1.0f; private const float SPINNING_SAMPLE_MODULATED_BASE_FREQUENCY = 0.5f; protected override void LoadSamples() @@ -106,7 +106,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { Volume = { Value = 0 }, Looping = true, - Frequency = { Value = SPINNING_SAMPLE_INITAL_FREQUENCY } + Frequency = { Value = SPINNING_SAMPLE_INITIAL_FREQUENCY } }); } } @@ -171,7 +171,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } [BackgroundDependencyLoader] - private void load(OsuColour colours, ISkinSource skin) + private void load(OsuColour colours) { positionBindable.BindValueChanged(pos => Position = pos.NewValue); positionBindable.BindTo(HitObject.PositionBindable); @@ -179,6 +179,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void ApplySkin(ISkinSource skin, bool allowFallback) { + base.ApplySkin(skin, allowFallback); spinnerFrequencyModulate = skin.GetConfig(OsuSkinConfiguration.SpinnerFrequencyModulate)?.Value ?? true; } From 5f35b3ebb98821e2f8870964302e9c60dab84d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 15 Aug 2020 20:44:02 +0200 Subject: [PATCH 8/8] Fix constant casing --- .../Objects/Drawables/DrawableSpinner.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index a4636050bb..a57bb466c7 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -85,8 +85,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } private SkinnableSound spinningSample; - private const float SPINNING_SAMPLE_INITIAL_FREQUENCY = 1.0f; - private const float SPINNING_SAMPLE_MODULATED_BASE_FREQUENCY = 0.5f; + private const float spinning_sample_initial_frequency = 1.0f; + private const float spinning_sample_modulated_base_frequency = 0.5f; protected override void LoadSamples() { @@ -106,7 +106,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { Volume = { Value = 0 }, Looping = true, - Frequency = { Value = SPINNING_SAMPLE_INITIAL_FREQUENCY } + Frequency = { Value = spinning_sample_initial_frequency } }); } } @@ -233,7 +233,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables RotationTracker.Tracking = !Result.HasResult && (OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false); if (spinningSample != null && spinnerFrequencyModulate) - spinningSample.Frequency.Value = SPINNING_SAMPLE_MODULATED_BASE_FREQUENCY + Progress; + spinningSample.Frequency.Value = spinning_sample_modulated_base_frequency + Progress; } protected override void UpdateAfterChildren()