Apply same legacy scale adjust logic to TaikoLegacyHitTarget

This commit is contained in:
Dean Herbert 2020-04-23 13:17:46 +09:00
parent 61d2580e1c
commit 4032d66959

View File

@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Skinning;
using osuTK;
@ -12,32 +13,47 @@ namespace osu.Game.Rulesets.Taiko.Skinning
{
public class TaikoLegacyHitTarget : CompositeDrawable
{
private Container content;
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{
RelativeSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
InternalChild = content = new Container
{
new Sprite
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
Texture = skin.GetTexture("approachcircle"),
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.73f) * 0.625f,
Alpha = 0.7f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
new Sprite
{
Texture = skin.GetTexture("taikobigcircle"),
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.7f) * 0.625f,
Alpha = 0.5f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
new Sprite
{
Texture = skin.GetTexture("approachcircle"),
Scale = new Vector2(0.73f),
Alpha = 0.7f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
new Sprite
{
Texture = skin.GetTexture("taikobigcircle"),
Scale = new Vector2(0.7f),
Alpha = 0.5f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
}
};
}
protected override void Update()
{
base.Update();
// Relying on RelativeSizeAxes.Both + FillMode.Fit doesn't work due to the precise pixel layout requirements.
// This is a bit ugly but makes the non-legacy implementations a lot cleaner to implement.
content.Scale = new Vector2(DrawHeight / TaikoPlayfield.DEFAULT_HEIGHT);
}
}
}