diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index eacd2b3e7555..211c076cbf0a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -367,10 +367,6 @@ protected override void UpdateHitStateTransforms(ArmedState state) public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => SliderBody?.ReceivePositionalInputAt(screenSpacePos) ?? base.ReceivePositionalInputAt(screenSpacePos); - private partial class DefaultSliderBody : PlaySliderBody - { - } - #region FOR EDITOR USE ONLY, DO NOT USE FOR ANY OTHER PURPOSE internal void SuppressHitAnimations() diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBody.cs new file mode 100644 index 000000000000..29627b66a199 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Skinning/Default/DefaultSliderBody.cs @@ -0,0 +1,35 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Rulesets.Osu.Objects; +using osuTK.Graphics; + +namespace osu.Game.Rulesets.Osu.Skinning.Default +{ + public partial class DefaultSliderBody : SliderBody + { + protected override DrawableSliderPath CreateSliderPath() => new DefaultDrawableSliderPath(); + + private partial class DefaultDrawableSliderPath : DrawableSliderPath + { + private const float opacity_at_centre = 0.3f; + private const float opacity_at_edge = 0.8f; + + protected override Color4 ColourAt(float position) + { + const float actual_to_visual_radius = OsuHitObject.OBJECT_RADIUS / OsuHitObject.VISUAL_OBJECT_RADIUS; + + position = 1 - (1 - position) * actual_to_visual_radius; + + if (position < 0.0) + return Color4.Transparent; + + if (CalculatedBorderPortion != 0f && position <= CalculatedBorderPortion) + return BorderColour; + + position -= CalculatedBorderPortion; + return new Color4(AccentColour.R, AccentColour.G, AccentColour.B, (opacity_at_edge - (opacity_at_edge - opacity_at_centre) * position / GRADIENT_PORTION) * AccentColour.A); + } + } + } +} diff --git a/osu.Game.Rulesets.Osu/Skinning/Default/ManualSliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/Default/ManualSliderBody.cs index 127d13730ab0..a2233645051c 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Default/ManualSliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Default/ManualSliderBody.cs @@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default /// /// A with the ability to set the drawn vertices manually. /// - public partial class ManualSliderBody : SliderBody + public partial class ManualSliderBody : DefaultSliderBody { public ManualSliderBody() { diff --git a/osu.Game.Rulesets.Osu/Skinning/SliderBody.cs b/osu.Game.Rulesets.Osu/Skinning/SliderBody.cs index 86ac931fd1ab..8c1ee8c71725 100644 --- a/osu.Game.Rulesets.Osu/Skinning/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Skinning/SliderBody.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Lines; -using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Skinning.Default; using osuTK; using osuTK.Graphics; @@ -111,28 +110,6 @@ public virtual void RecyclePath() /// The vertices protected void SetVertices(IReadOnlyList vertices) => path.Vertices = vertices; - protected virtual DrawableSliderPath CreateSliderPath() => new DefaultDrawableSliderPath(); - - private partial class DefaultDrawableSliderPath : DrawableSliderPath - { - private const float opacity_at_centre = 0.3f; - private const float opacity_at_edge = 0.8f; - - protected override Color4 ColourAt(float position) - { - const float actual_to_visual_radius = OsuHitObject.OBJECT_RADIUS / OsuHitObject.VISUAL_OBJECT_RADIUS; - - position = 1 - (1 - position) * actual_to_visual_radius; - - if (position < 0.0) - return Color4.Transparent; - - if (CalculatedBorderPortion != 0f && position <= CalculatedBorderPortion) - return BorderColour; - - position -= CalculatedBorderPortion; - return new Color4(AccentColour.R, AccentColour.G, AccentColour.B, (opacity_at_edge - (opacity_at_edge - opacity_at_centre) * position / GRADIENT_PORTION) * AccentColour.A); - } - } + protected abstract DrawableSliderPath CreateSliderPath(); } }