Apply new style spinner scale to only local sprites

This commit is contained in:
Dean Herbert 2020-11-05 18:12:02 +09:00
parent 11c18952e3
commit 5ec6011340

View File

@ -3,6 +3,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
@ -30,12 +31,18 @@ namespace osu.Game.Rulesets.Osu.Skinning
private readonly Color4 glowColour = new Color4(3, 151, 255, 255); private readonly Color4 glowColour = new Color4(3, 151, 255, 255);
private Container scaleContainer;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ISkinSource source) private void load(ISkinSource source)
{ {
Scale = new Vector2(final_scale); AddInternal(scaleContainer = new Container
{
AddRangeInternal(new Drawable[] Scale = new Vector2(final_scale),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{ {
glow = new Sprite glow = new Sprite
{ {
@ -69,6 +76,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
Origin = Anchor.Centre, Origin = Anchor.Centre,
Texture = source.GetTexture("spinner-middle2") Texture = source.GetTexture("spinner-middle2")
} }
}
}); });
} }
@ -119,7 +127,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
glow.Alpha = DrawableSpinner.Progress; glow.Alpha = DrawableSpinner.Progress;
Scale = new Vector2(final_scale * (0.8f + (float)Interpolation.ApplyEasing(Easing.Out, DrawableSpinner.Progress) * 0.2f)); scaleContainer.Scale = new Vector2(final_scale * (0.8f + (float)Interpolation.ApplyEasing(Easing.Out, DrawableSpinner.Progress) * 0.2f));
} }
} }
} }