mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 09:27:18 +09:00
Add support for spinner glow
This commit is contained in:
parent
7d33dc3dea
commit
82d8c1bbea
@ -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…
x
Reference in New Issue
Block a user