From b39a9d816e1881bd40e471aa738fe8d455828871 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 29 Apr 2023 16:05:45 +0900 Subject: [PATCH 1/9] Add basic structural requirements for cursor ripples --- .../Configuration/OsuRulesetConfigManager.cs | 2 ++ .../Legacy/OsuLegacySkinTransformer.cs | 5 +++++ .../UI/Cursor/CursorRippleVisualiser.cs | 21 +++++++++++++++++++ .../UI/Cursor/OsuCursorContainer.cs | 1 + .../UI/OsuSettingsSubsection.cs | 5 +++++ .../Localisation/RulesetSettingsStrings.cs | 5 +++++ 6 files changed, 39 insertions(+) create mode 100644 osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs diff --git a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs index b8ad61e6dd..2056a50eda 100644 --- a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs +++ b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs @@ -22,6 +22,7 @@ namespace osu.Game.Rulesets.Osu.Configuration SetDefault(OsuRulesetSetting.SnakingInSliders, true); SetDefault(OsuRulesetSetting.SnakingOutSliders, true); SetDefault(OsuRulesetSetting.ShowCursorTrail, true); + SetDefault(OsuRulesetSetting.ShowCursorRipples, false); SetDefault(OsuRulesetSetting.PlayfieldBorderStyle, PlayfieldBorderStyle.None); } } @@ -31,6 +32,7 @@ namespace osu.Game.Rulesets.Osu.Configuration SnakingInSliders, SnakingOutSliders, ShowCursorTrail, + ShowCursorRipples, PlayfieldBorderStyle, } } diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs index 620540b8ef..279835747f 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs @@ -100,6 +100,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy return null; + case OsuSkinComponents.CursorRipple: + // TODO: resize texture to 0.5?? but that might break skins.. + if (GetTexture("cursor-ripple") != null) + return this.GetAnimation("cursor-ripple", false, false); + case OsuSkinComponents.CursorParticles: if (GetTexture("star2") != null) return new LegacyCursorParticles(); diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs new file mode 100644 index 0000000000..ef0cae7de8 --- /dev/null +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs @@ -0,0 +1,21 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Osu.Configuration; + +namespace osu.Game.Rulesets.Osu.UI.Cursor +{ + public partial class CursorRippleVisualiser : CompositeDrawable + { + private readonly Bindable showRipples = new Bindable(true); + + [BackgroundDependencyLoader(true)] + private void load(OsuRulesetConfigManager rulesetConfig) + { + rulesetConfig?.BindWith(OsuRulesetSetting.ShowCursorTrail, showRipples); + } + } +} diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs index 5d7648b073..2b541bd345 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs @@ -48,6 +48,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor Children = new[] { cursorTrail = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.CursorTrail), _ => new DefaultCursorTrail(), confineMode: ConfineMode.NoScaling), + new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.CursorRipples), confineMode: ConfineMode.NoScaling), new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.CursorParticles), confineMode: ConfineMode.NoScaling), } }; diff --git a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs index 64c4e7eef6..0e410dbf57 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs @@ -43,6 +43,11 @@ namespace osu.Game.Rulesets.Osu.UI LabelText = RulesetSettingsStrings.CursorTrail, Current = config.GetBindable(OsuRulesetSetting.ShowCursorTrail) }, + new SettingsCheckbox + { + LabelText = RulesetSettingsStrings.CursorRipples, + Current = config.GetBindable(OsuRulesetSetting.ShowCursorRipples) + }, new SettingsEnumDropdown { LabelText = RulesetSettingsStrings.PlayfieldBorderStyle, diff --git a/osu.Game/Localisation/RulesetSettingsStrings.cs b/osu.Game/Localisation/RulesetSettingsStrings.cs index 1b0df6ecf6..52e6a5eaac 100644 --- a/osu.Game/Localisation/RulesetSettingsStrings.cs +++ b/osu.Game/Localisation/RulesetSettingsStrings.cs @@ -29,6 +29,11 @@ namespace osu.Game.Localisation /// public static LocalisableString CursorTrail => new TranslatableString(getKey(@"cursor_trail"), @"Cursor trail"); + /// + /// "Cursor ripples" + /// + public static LocalisableString CursorRipples => new TranslatableString(getKey(@"cursor_ripples"), @"Cursor ripples"); + /// /// "Playfield border style" /// From a4ae9e409bf1cb5e9c2f614e2967dc3bf82210b7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 29 Apr 2023 16:06:08 +0900 Subject: [PATCH 2/9] Implement ripples (legacy and default) --- .../TestSceneGameplayCursor.cs | 13 +++++ osu.Game.Rulesets.Osu/OsuSkinComponents.cs | 1 + .../Legacy/OsuLegacySkinTransformer.cs | 2 + .../UI/Cursor/CursorRippleVisualiser.cs | 53 +++++++++++++++++-- .../UI/Cursor/OsuCursorContainer.cs | 2 +- 5 files changed, 67 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs index 907422858e..c84a6ab70f 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs @@ -8,6 +8,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; +using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -18,6 +19,7 @@ using osu.Framework.Testing.Input; using osu.Framework.Utils; using osu.Game.Audio; using osu.Game.Configuration; +using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Rulesets.Osu.Skinning; using osu.Game.Rulesets.Osu.UI.Cursor; using osu.Game.Screens.Play; @@ -40,6 +42,8 @@ namespace osu.Game.Rulesets.Osu.Tests private Drawable background; + private readonly Bindable ripples = new Bindable(); + public TestSceneGameplayCursor() { var ruleset = new OsuRuleset(); @@ -57,6 +61,8 @@ namespace osu.Game.Rulesets.Osu.Tests }); }); + AddToggleStep("ripples", v => ripples.Value = v); + AddSliderStep("circle size", 0f, 10f, 0f, val => { config.SetValue(OsuSetting.AutoCursorSize, true); @@ -67,6 +73,13 @@ namespace osu.Game.Rulesets.Osu.Tests AddStep("test cursor container", () => loadContent(false)); } + [BackgroundDependencyLoader] + private void load() + { + var rulesetConfig = (OsuRulesetConfigManager)RulesetConfigs.GetConfigFor(Ruleset.Value.CreateInstance()).AsNonNull(); + rulesetConfig.BindWith(OsuRulesetSetting.ShowCursorRipples, ripples); + } + [TestCase(1, 1)] [TestCase(5, 1)] [TestCase(10, 1)] diff --git a/osu.Game.Rulesets.Osu/OsuSkinComponents.cs b/osu.Game.Rulesets.Osu/OsuSkinComponents.cs index 8fdf3821fa..52fdfea95f 100644 --- a/osu.Game.Rulesets.Osu/OsuSkinComponents.cs +++ b/osu.Game.Rulesets.Osu/OsuSkinComponents.cs @@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Osu Cursor, CursorTrail, CursorParticles, + CursorRipple, SliderScorePoint, ReverseArrow, HitCircleText, diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs index 279835747f..bf817eda29 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs @@ -105,6 +105,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy if (GetTexture("cursor-ripple") != null) return this.GetAnimation("cursor-ripple", false, false); + return null; + case OsuSkinComponents.CursorParticles: if (GetTexture("star2") != null) return new LegacyCursorParticles(); diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs index ef0cae7de8..401525efcd 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs @@ -3,19 +3,66 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Input.Bindings; +using osu.Framework.Input.Events; using osu.Game.Rulesets.Osu.Configuration; +using osu.Game.Rulesets.Osu.Skinning.Default; +using osu.Game.Skinning; +using osuTK; namespace osu.Game.Rulesets.Osu.UI.Cursor { - public partial class CursorRippleVisualiser : CompositeDrawable + public partial class CursorRippleVisualiser : CompositeDrawable, IKeyBindingHandler { private readonly Bindable showRipples = new Bindable(true); [BackgroundDependencyLoader(true)] - private void load(OsuRulesetConfigManager rulesetConfig) + private void load(OsuRulesetConfigManager? rulesetConfig) { - rulesetConfig?.BindWith(OsuRulesetSetting.ShowCursorTrail, showRipples); + rulesetConfig?.BindWith(OsuRulesetSetting.ShowCursorRipples, showRipples); + } + + public bool OnPressed(KeyBindingPressEvent e) + { + if (showRipples.Value) + { + var ripple = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.CursorRipple), _ => new DefaultCursorRipple()) + { + Blending = BlendingParameters.Additive, + Position = e.MousePosition + }; + + AddInternal(ripple); + + ripple.ScaleTo(0.05f) + .ScaleTo(0.5f, 700, Easing.Out) + .FadeTo(0.2f) + .FadeOut(700) + .Expire(); + } + + return false; + } + + public void OnReleased(KeyBindingReleaseEvent e) + { + } + + public partial class DefaultCursorRipple : CompositeDrawable + { + [BackgroundDependencyLoader] + private void load() + { + InternalChildren = new Drawable[] + { + new RingPiece(3) + { + Size = new Vector2(512), + } + }; + } } } } diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs index 2b541bd345..35fb8e67d8 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor Children = new[] { cursorTrail = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.CursorTrail), _ => new DefaultCursorTrail(), confineMode: ConfineMode.NoScaling), - new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.CursorRipples), confineMode: ConfineMode.NoScaling), + new CursorRippleVisualiser(), new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.CursorParticles), confineMode: ConfineMode.NoScaling), } }; From c994adfc22a3c7a25985988bd2b9f48ac47c3b58 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 29 Apr 2023 22:00:17 +0900 Subject: [PATCH 3/9] Add pooling support for ripples --- .../UI/Cursor/CursorRippleVisualiser.cs | 50 +++++++++++++------ 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs index 401525efcd..e13e0d5dfb 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Pooling; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Rulesets.Osu.Configuration; @@ -18,6 +19,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor { private readonly Bindable showRipples = new Bindable(true); + private readonly DrawablePool ripplePool = new DrawablePool(20); + [BackgroundDependencyLoader(true)] private void load(OsuRulesetConfigManager? rulesetConfig) { @@ -27,21 +30,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor public bool OnPressed(KeyBindingPressEvent e) { if (showRipples.Value) - { - var ripple = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.CursorRipple), _ => new DefaultCursorRipple()) - { - Blending = BlendingParameters.Additive, - Position = e.MousePosition - }; - - AddInternal(ripple); - - ripple.ScaleTo(0.05f) - .ScaleTo(0.5f, 700, Easing.Out) - .FadeTo(0.2f) - .FadeOut(700) - .Expire(); - } + AddInternal(ripplePool.Get()); return false; } @@ -50,6 +39,37 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor { } + private partial class CursorRipple : PoolableDrawable + { + [BackgroundDependencyLoader] + private void load() + { + AutoSizeAxes = Axes.Both; + Origin = Anchor.Centre; + + InternalChildren = new Drawable[] + { + new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.CursorRipple), _ => new DefaultCursorRipple()) + { + Blending = BlendingParameters.Additive, + } + }; + } + + protected override void PrepareForUse() + { + base.PrepareForUse(); + + ClearTransforms(true); + + this.ScaleTo(0.05f) + .ScaleTo(0.5f, 700, Easing.Out) + .FadeTo(0.2f) + .FadeOut(700) + .Expire(); + } + } + public partial class DefaultCursorRipple : CompositeDrawable { [BackgroundDependencyLoader] From 6a62949fcd36e4ee62fdfb8de528901784733cf6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 30 Apr 2023 10:38:21 +0900 Subject: [PATCH 4/9] Fix positioning and rewinding support for ripples --- .../UI/Cursor/CursorRippleVisualiser.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs index e13e0d5dfb..27e9d1d347 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs @@ -21,6 +21,11 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor private readonly DrawablePool ripplePool = new DrawablePool(20); + public CursorRippleVisualiser() + { + RelativeSizeAxes = Axes.Both; + } + [BackgroundDependencyLoader(true)] private void load(OsuRulesetConfigManager? rulesetConfig) { @@ -30,7 +35,12 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor public bool OnPressed(KeyBindingPressEvent e) { if (showRipples.Value) - AddInternal(ripplePool.Get()); + { + AddInternal(ripplePool.Get(r => + { + r.Position = e.MousePosition; + })); + } return false; } @@ -66,7 +76,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor .ScaleTo(0.5f, 700, Easing.Out) .FadeTo(0.2f) .FadeOut(700) - .Expire(); + .Expire(true); } } @@ -75,6 +85,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor [BackgroundDependencyLoader] private void load() { + AutoSizeAxes = Axes.Both; + InternalChildren = new Drawable[] { new RingPiece(3) From 72b472a75604a97d1f15ee211550bf28e2b4204c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 30 Apr 2023 11:19:03 +0900 Subject: [PATCH 5/9] Change default scaling and add note about legacy `cursor-ripple` scale --- .../Legacy/OsuLegacySkinTransformer.cs | 19 +++++++++++++++++-- .../UI/Cursor/CursorRippleVisualiser.cs | 8 ++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs index bf817eda29..f049aa088f 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs @@ -101,9 +101,24 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy return null; case OsuSkinComponents.CursorRipple: - // TODO: resize texture to 0.5?? but that might break skins.. if (GetTexture("cursor-ripple") != null) - return this.GetAnimation("cursor-ripple", false, false); + { + var ripple = this.GetAnimation("cursor-ripple", false, false); + + // In stable this element was scaled down to 50% and opacity 20%, but this makes the elements WAY too big and inflexible. + // If anyone complains about these not being applied, this can be uncommented. + // + // But if no one complains I'd rather fix this in lazer. Wiki documentation doesn't mention size, + // so we might be okay. + // + // if (ripple != null) + // { + // ripple.Scale = new Vector2(0.5f); + // ripple.Alpha = 0.2f; + // } + + return ripple; + } return null; diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs index 27e9d1d347..465b708b5a 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs @@ -73,9 +73,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor ClearTransforms(true); this.ScaleTo(0.05f) - .ScaleTo(0.5f, 700, Easing.Out) - .FadeTo(0.2f) - .FadeOut(700) + .ScaleTo(1, 700, Easing.Out) + .FadeOutFromOne(700) .Expire(true); } } @@ -91,7 +90,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor { new RingPiece(3) { - Size = new Vector2(512), + Size = new Vector2(256), + Alpha = 0.2f, } }; } From b8ae508639421a89dbfe0fadb1b433bdaa46d05f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 1 May 2023 13:09:00 +0900 Subject: [PATCH 6/9] Fix incorrect starting scale for ripples --- osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs index 465b708b5a..663c1f54fc 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs @@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor ClearTransforms(true); - this.ScaleTo(0.05f) + this.ScaleTo(0.1f) .ScaleTo(1, 700, Easing.Out) .FadeOutFromOne(700) .Expire(true); From 5cbfefbcb4d6177a4012527d28d53d56c13ffab0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 1 May 2023 13:18:04 +0900 Subject: [PATCH 7/9] Adjust metrics of default ripple to match stable default better --- osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs index 663c1f54fc..cee5574f06 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics.Pooling; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Rulesets.Osu.Configuration; +using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Skinning.Default; using osu.Game.Skinning; using osuTK; @@ -90,8 +91,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor { new RingPiece(3) { - Size = new Vector2(256), - Alpha = 0.2f, + Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2), + Alpha = 0.1f, } }; } From 0a70734331f2ba319c74c9b909ddcca3f338a6a6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 1 May 2023 14:40:48 +0900 Subject: [PATCH 8/9] Adjust ripple size with cursor scale (including CS) --- .../UI/Cursor/CursorRippleVisualiser.cs | 18 +++++++++++------- .../UI/Cursor/OsuCursorContainer.cs | 5 ++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs index cee5574f06..076d97d06a 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorRippleVisualiser.cs @@ -27,6 +27,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor RelativeSizeAxes = Axes.Both; } + public Vector2 CursorScale { get; set; } = Vector2.One; + [BackgroundDependencyLoader(true)] private void load(OsuRulesetConfigManager? rulesetConfig) { @@ -40,6 +42,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor AddInternal(ripplePool.Get(r => { r.Position = e.MousePosition; + r.Scale = CursorScale; })); } @@ -52,18 +55,17 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor private partial class CursorRipple : PoolableDrawable { + private Drawable ripple = null!; + [BackgroundDependencyLoader] private void load() { AutoSizeAxes = Axes.Both; Origin = Anchor.Centre; - InternalChildren = new Drawable[] + InternalChild = ripple = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.CursorRipple), _ => new DefaultCursorRipple()) { - new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.CursorRipple), _ => new DefaultCursorRipple()) - { - Blending = BlendingParameters.Additive, - } + Blending = BlendingParameters.Additive, }; } @@ -73,8 +75,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor ClearTransforms(true); - this.ScaleTo(0.1f) - .ScaleTo(1, 700, Easing.Out) + ripple.ScaleTo(0.1f) + .ScaleTo(1, 700, Easing.Out); + + this .FadeOutFromOne(700) .Expire(true); } diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs index 35fb8e67d8..bf1ff872dd 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs @@ -40,6 +40,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor private Bindable userCursorScale; private Bindable autoCursorScale; + private readonly CursorRippleVisualiser rippleVisualiser; + public OsuCursorContainer() { InternalChild = fadeContainer = new Container @@ -48,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor Children = new[] { cursorTrail = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.CursorTrail), _ => new DefaultCursorTrail(), confineMode: ConfineMode.NoScaling), - new CursorRippleVisualiser(), + rippleVisualiser = new CursorRippleVisualiser(), new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.CursorParticles), confineMode: ConfineMode.NoScaling), } }; @@ -83,6 +85,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor var newScale = new Vector2(e.NewValue); ActiveCursor.Scale = newScale; + rippleVisualiser.CursorScale = newScale; cursorTrail.Scale = newScale; }, true); From ff29189e8951945c6ef701159cc7636a75032d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 1 May 2023 09:33:37 +0200 Subject: [PATCH 9/9] Add custom `cursor-ripple` to cover skinnability in test --- .../Resources/special-skin/cursor-ripple@2x.png | Bin 0 -> 2149 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 osu.Game.Rulesets.Osu.Tests/Resources/special-skin/cursor-ripple@2x.png diff --git a/osu.Game.Rulesets.Osu.Tests/Resources/special-skin/cursor-ripple@2x.png b/osu.Game.Rulesets.Osu.Tests/Resources/special-skin/cursor-ripple@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..258162c4864ddc469ba21697770b2fc8e1297eb5 GIT binary patch literal 2149 zcmcgsX;4#V6us|}kS8dFF-#Ic5|_5rT2^f>iv$Bgv@GHZ1A?;2AVv@s6p|2B6e7xW zlxhVxtS~NA5Em3f6%wnCsC65ug_3cob&Xbu8uEHSrtPn`e>!7ka^Ac5o_o&u^4?@q zY;?p3hfxjyFhUU-76(A#Ed`7{UJ~=_Gq6~fC6~u4$>GtPQ{e0-z%ys3EC>aJhf-of7Z^qsf-otCubWW*_atCL+XG%{l}KK3qE zJJPQx;zpf&wKAq{&gx;c4|)bNUo~(mD5|PpyZGCvv!Ow4S#G-qHl-e(c&MYlBlW|i zt(K}s227|wKV7@3M&Kw8hQ>S7shd&{f=X2*z(Bu6#$MS$(MqiyF}RJ(ZDDev_IHcKYigqyWfn0mafQXJTG&9a-P zZ+ju;oVC05gOMGuHLv2Fd!j!x5Dnm|}@n!fi!HEkh|KDMDWe-yn9#<6jxP$&`zJdSWLeZrcAtD)9n?HxowT38fCiXBKhX zNTaMwKn(T~D?S%ZOFaLT+P>07WU6jubmo~!9E0V67oBR26PEa@8YfHiobTSJam)=<3+kH)j3YO6AWl_5pq4je%{>Id;MBdWWTQYP3+T7>3@7Dgwi+~={G(>p5BOWJ`rCSF zl>EZLb|b5G(9F7Ed)Zp6ny|Y^vuE%x`{8Fsb{QGBnf0HLakllD6B&zHd_iz*U>6Y& znOo~tC6A+%fRn=z4j)1%f_#m}YzH*oM+GvV4bH&G+AS1N zj3@-8K$&>Jai21TK?KvR_@KzzR0V#bM(d$o4wcb}jV@rKJ(;Bb} O@S_Ni4m&z6Mf(Thel05i literal 0 HcmV?d00001