1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 13:32:54 +08:00

Move ApproachCircle implementation into per-style

This commit is contained in:
Salman Ahmed 2021-06-21 08:40:38 +03:00
parent 68e28f4903
commit 42edbe4fb9
3 changed files with 40 additions and 17 deletions

View File

@ -31,12 +31,13 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
private Container scaleContainer;
public override Drawable ApproachCircle { get; protected set; }
[BackgroundDependencyLoader]
private void load(ISkinSource source)
{
AddInternal(scaleContainer = new Container
{
Scale = new Vector2(SPRITE_SCALE),
Anchor = Anchor.TopCentre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
@ -48,6 +49,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = source.GetTexture("spinner-glow"),
Scale = new Vector2(SPRITE_SCALE),
Blending = BlendingParameters.Additive,
Colour = glowColour,
},
@ -55,28 +57,43 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = source.GetTexture("spinner-bottom")
Texture = source.GetTexture("spinner-bottom"),
Scale = new Vector2(SPRITE_SCALE),
},
discTop = new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = source.GetTexture("spinner-top")
Texture = source.GetTexture("spinner-top"),
Scale = new Vector2(SPRITE_SCALE),
},
fixedMiddle = new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = source.GetTexture("spinner-middle")
Texture = source.GetTexture("spinner-middle"),
Scale = new Vector2(SPRITE_SCALE),
},
spinningMiddle = new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = source.GetTexture("spinner-middle2")
}
Texture = source.GetTexture("spinner-middle2"),
Scale = new Vector2(SPRITE_SCALE),
},
}
});
if (!(source.FindProvider(s => s.GetTexture("spinner-top") != null) is DefaultLegacySkin))
{
scaleContainer.Add(ApproachCircle = new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = source.GetTexture("spinner-approachcircle"),
Scale = new Vector2(SPRITE_SCALE * 1.86f),
});
}
}
protected override void UpdateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
@ -126,7 +143,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
glow.Alpha = DrawableSpinner.Progress;
scaleContainer.Scale = new Vector2(SPRITE_SCALE * (0.8f + (float)Interpolation.ApplyEasing(Easing.Out, DrawableSpinner.Progress) * 0.2f));
scaleContainer.Scale = new Vector2(0.8f + (float)Interpolation.ApplyEasing(Easing.Out, DrawableSpinner.Progress) * 0.2f);
}
}
}

View File

@ -29,12 +29,14 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
private const float final_metre_height = 692 * SPRITE_SCALE;
public override Drawable ApproachCircle { get; protected set; }
[BackgroundDependencyLoader]
private void load(ISkinSource source)
{
spinnerBlink = source.GetConfig<OsuSkinConfiguration, bool>(OsuSkinConfiguration.SpinnerNoBlink)?.Value != true;
AddRangeInternal(new Drawable[]
AddRangeInternal(new[]
{
new Sprite
{
@ -68,6 +70,14 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
Origin = Anchor.TopLeft,
Scale = new Vector2(SPRITE_SCALE)
}
},
ApproachCircle = new Sprite
{
Anchor = Anchor.TopCentre,
Origin = Anchor.Centre,
Texture = source.GetTexture("spinner-approachcircle"),
Scale = new Vector2(SPRITE_SCALE * 1.86f),
Y = SPINNER_Y_CENTRE,
}
});
}

View File

@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
protected DrawableSpinner DrawableSpinner { get; private set; }
public Drawable ApproachCircle { get; private set; }
public abstract Drawable ApproachCircle { get; protected set; }
private Sprite spin;
private Sprite clear;
@ -59,15 +59,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{
Depth = float.MinValue,
RelativeSizeAxes = Axes.Both,
Children = new[]
Children = new Drawable[]
{
ApproachCircle = new LegacySpinnerApproachCircle
{
Anchor = Anchor.TopCentre,
Origin = Anchor.Centre,
Scale = new Vector2(SPRITE_SCALE),
Y = SPINNER_Y_CENTRE,
},
spin = new Sprite
{
Anchor = Anchor.TopCentre,
@ -184,6 +177,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
spmCounter.MoveToOffset(new Vector2(0, -spm_hide_offset), d.HitObject.TimeFadeIn, Easing.Out);
}
using (BeginAbsoluteSequence(d.HitObject.StartTime))
ApproachCircle?.ScaleTo(SPRITE_SCALE * 0.1f, d.HitObject.Duration);
double spinFadeOutLength = Math.Min(400, d.HitObject.Duration);
using (BeginAbsoluteSequence(drawableHitObject.HitStateUpdateTime - spinFadeOutLength, true))