Add colouration to the sliders to better match the vibrancy of the mod

This commit is contained in:
mk56-spn 2023-01-28 17:38:24 +01:00
parent c3090dea5f
commit 66da4c0288

View File

@ -16,6 +16,7 @@ using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Pooling; using osu.Game.Rulesets.Objects.Pooling;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.Skinning.Default;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using osu.Game.Scoring; using osu.Game.Scoring;
@ -77,6 +78,12 @@ namespace osu.Game.Rulesets.Osu.Mods
private void applyBubbleState(DrawableHitObject drawableObject) private void applyBubbleState(DrawableHitObject drawableObject)
{ {
if (drawableObject is DrawableSlider slider)
{
slider.Body.OnSkinChanged += () => applySliderState(slider);
applySliderState(slider);
}
if (drawableObject is not DrawableOsuHitObject drawableOsuObject || !drawableObject.Judged) return; if (drawableObject is not DrawableOsuHitObject drawableOsuObject || !drawableObject.Judged) return;
OsuHitObject hitObject = drawableOsuObject.HitObject; OsuHitObject hitObject = drawableOsuObject.HitObject;
@ -93,9 +100,9 @@ namespace osu.Game.Rulesets.Osu.Mods
addBubbleContainer(hitCircle.Position, drawableOsuObject); addBubbleContainer(hitCircle.Position, drawableOsuObject);
break; break;
case DrawableSpinnerTick:
case DrawableSlider: case DrawableSlider:
return; case DrawableSpinnerTick:
break;
default: default:
addBubbleContainer(hitObject.Position, drawableOsuObject); addBubbleContainer(hitObject.Position, drawableOsuObject);
@ -103,6 +110,9 @@ namespace osu.Game.Rulesets.Osu.Mods
} }
} }
private void applySliderState(DrawableSlider slider) =>
((PlaySliderBody)slider.Body.Drawable).BorderColour = slider.AccentColour.Value;
private void addBubbleContainer(Vector2 position, DrawableHitObject hitObject) private void addBubbleContainer(Vector2 position, DrawableHitObject hitObject)
{ {
bubbleContainer.Add bubbleContainer.Add
@ -217,12 +227,12 @@ namespace osu.Game.Rulesets.Osu.Mods
//We want to fade to a darker colour to avoid colours such as white hiding the "ripple" effect. //We want to fade to a darker colour to avoid colours such as white hiding the "ripple" effect.
var colourDarker = entry.Colour.Darken(0.1f); var colourDarker = entry.Colour.Darken(0.1f);
this.ScaleTo(entry.MaxSize, getAnimationDuration() * 0.8f, Easing.OutSine) this.ScaleTo(entry.MaxSize, getAnimationDuration() * 0.8f)
.Then() .Then()
.ScaleTo(entry.MaxSize * 1.5f, getAnimationDuration() * 0.2f, Easing.OutSine) .ScaleTo(entry.MaxSize * 1.5f, getAnimationDuration() * 0.2f, Easing.OutQuint)
.FadeTo(0, getAnimationDuration() * 0.2f, Easing.OutExpo); .FadeTo(0, getAnimationDuration() * 0.2f, Easing.OutQuint);
innerCircle.ScaleTo(2f, getAnimationDuration() * 0.8f, Easing.OutCubic); innerCircle.ScaleTo(2f, getAnimationDuration() * 0.8f, Easing.OutQuint);
if (!entry.IsHit) if (!entry.IsHit)
{ {
@ -232,11 +242,12 @@ namespace osu.Game.Rulesets.Osu.Mods
return; return;
} }
colourBox.FadeColour(colourDarker, getAnimationDuration() * 0.2f, Easing.OutQuint); colourBox.FadeColour(colourDarker, getAnimationDuration() * 0.2f, Easing.OutQuint
);
innerCircle.FadeColour(colourDarker); innerCircle.FadeColour(colourDarker);
// The absolute length of the bubble's animation, can be used in fractions for animations of partial length // The absolute length of the bubble's animation, can be used in fractions for animations of partial length
double getAnimationDuration() => 1700 + Math.Pow(entry.FadeTime, 1.15f); double getAnimationDuration() => 1700 + Math.Pow(entry.FadeTime, 1.07f);
} }
} }