1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 17:27:24 +08:00

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;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Skinning; using osu.Game.Skinning;
using osuTK; using osuTK;
@ -12,32 +13,47 @@ namespace osu.Game.Rulesets.Taiko.Skinning
{ {
public class TaikoLegacyHitTarget : CompositeDrawable public class TaikoLegacyHitTarget : CompositeDrawable
{ {
private Container content;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ISkinSource skin) private void load(ISkinSource skin)
{ {
RelativeSizeAxes = Axes.Both; 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"), new Sprite
RelativeSizeAxes = Axes.Both, {
Size = new Vector2(0.73f) * 0.625f, Texture = skin.GetTexture("approachcircle"),
Alpha = 0.7f, Scale = new Vector2(0.73f),
Anchor = Anchor.Centre, Alpha = 0.7f,
Origin = Anchor.Centre, Anchor = Anchor.Centre,
}, Origin = Anchor.Centre,
new Sprite },
{ new Sprite
Texture = skin.GetTexture("taikobigcircle"), {
RelativeSizeAxes = Axes.Both, Texture = skin.GetTexture("taikobigcircle"),
Size = new Vector2(0.7f) * 0.625f, Scale = new Vector2(0.7f),
Alpha = 0.5f, Alpha = 0.5f,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = 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);
}
} }
} }