mirror of
https://github.com/ppy/osu.git
synced 2025-02-16 07:03:21 +08:00
Merge pull request #10697 from peppy/add-spinner-glow
Add support for spinner "glow" in legacy skins
This commit is contained in:
commit
50c4e4ec38
@ -20,8 +20,8 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
private TestDrawableSpinner drawableSpinner;
|
private TestDrawableSpinner drawableSpinner;
|
||||||
|
|
||||||
[TestCase(false)]
|
|
||||||
[TestCase(true)]
|
[TestCase(true)]
|
||||||
|
[TestCase(false)]
|
||||||
public void TestVariousSpinners(bool autoplay)
|
public void TestVariousSpinners(bool autoplay)
|
||||||
{
|
{
|
||||||
string term = autoplay ? "Hit" : "Miss";
|
string term = autoplay ? "Hit" : "Miss";
|
||||||
|
@ -21,6 +21,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class LegacyNewStyleSpinner : CompositeDrawable
|
public class LegacyNewStyleSpinner : CompositeDrawable
|
||||||
{
|
{
|
||||||
|
private Sprite glow;
|
||||||
private Sprite discBottom;
|
private Sprite discBottom;
|
||||||
private Sprite discTop;
|
private Sprite discTop;
|
||||||
private Sprite spinningMiddle;
|
private Sprite spinningMiddle;
|
||||||
@ -30,6 +31,8 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
|||||||
|
|
||||||
private const float final_scale = 0.625f;
|
private const float final_scale = 0.625f;
|
||||||
|
|
||||||
|
private readonly Color4 glowColour = new Color4(3, 151, 255, 255);
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ISkinSource source, DrawableHitObject drawableObject)
|
private void load(ISkinSource source, DrawableHitObject drawableObject)
|
||||||
{
|
{
|
||||||
@ -39,6 +42,14 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
|||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
|
glow = new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Texture = source.GetTexture("spinner-glow"),
|
||||||
|
Blending = BlendingParameters.Additive,
|
||||||
|
Colour = glowColour,
|
||||||
|
},
|
||||||
discBottom = new Sprite
|
discBottom = new Sprite
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
@ -76,23 +87,38 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
|||||||
|
|
||||||
private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
|
private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
|
||||||
{
|
{
|
||||||
if (!(drawableHitObject is DrawableSpinner d))
|
switch (drawableHitObject)
|
||||||
return;
|
|
||||||
|
|
||||||
Spinner spinner = d.HitObject;
|
|
||||||
|
|
||||||
using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimePreempt, true))
|
|
||||||
this.FadeOut();
|
|
||||||
|
|
||||||
using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimeFadeIn / 2, true))
|
|
||||||
this.FadeInFromZero(spinner.TimeFadeIn / 2);
|
|
||||||
|
|
||||||
using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimePreempt, true))
|
|
||||||
{
|
{
|
||||||
fixedMiddle.FadeColour(Color4.White);
|
case DrawableSpinner d:
|
||||||
|
Spinner spinner = d.HitObject;
|
||||||
|
|
||||||
using (BeginDelayedSequence(spinner.TimePreempt, true))
|
using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimePreempt, true))
|
||||||
fixedMiddle.FadeColour(Color4.Red, spinner.Duration);
|
this.FadeOut();
|
||||||
|
|
||||||
|
using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimeFadeIn / 2, true))
|
||||||
|
this.FadeInFromZero(spinner.TimeFadeIn / 2);
|
||||||
|
|
||||||
|
using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimePreempt, true))
|
||||||
|
{
|
||||||
|
fixedMiddle.FadeColour(Color4.White);
|
||||||
|
|
||||||
|
using (BeginDelayedSequence(spinner.TimePreempt, true))
|
||||||
|
fixedMiddle.FadeColour(Color4.Red, spinner.Duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == ArmedState.Hit)
|
||||||
|
{
|
||||||
|
using (BeginAbsoluteSequence(d.HitStateUpdateTime))
|
||||||
|
glow.FadeOut(300);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DrawableSpinnerBonusTick _:
|
||||||
|
if (state == ArmedState.Hit)
|
||||||
|
glow.FlashColour(Color4.White, 200);
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +128,8 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
|||||||
spinningMiddle.Rotation = discTop.Rotation = drawableSpinner.RotationTracker.Rotation;
|
spinningMiddle.Rotation = discTop.Rotation = drawableSpinner.RotationTracker.Rotation;
|
||||||
discBottom.Rotation = discTop.Rotation / 3;
|
discBottom.Rotation = discTop.Rotation / 3;
|
||||||
|
|
||||||
|
glow.Alpha = drawableSpinner.Progress;
|
||||||
|
|
||||||
Scale = new Vector2(final_scale * (0.8f + (float)Interpolation.ApplyEasing(Easing.Out, drawableSpinner.Progress) * 0.2f));
|
Scale = new Vector2(final_scale * (0.8f + (float)Interpolation.ApplyEasing(Easing.Out, drawableSpinner.Progress) * 0.2f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user