Fix scaling of strong hits

This commit is contained in:
Dean Herbert 2020-04-11 14:43:57 +09:00
parent dc56be0a1d
commit 96bf86099c
2 changed files with 30 additions and 2 deletions

View File

@ -34,17 +34,31 @@ private void load()
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}));
AddStep("Centre hit (strong)", () => SetContents(() => new DrawableCentreHit(createHitAtCurrentTime(true))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}));
AddStep("Rim hit", () => SetContents(() => new DrawableRimHit(createHitAtCurrentTime())
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}));
AddStep("Rim hit (strong)", () => SetContents(() => new DrawableRimHit(createHitAtCurrentTime(true))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}));
}
private Hit createHitAtCurrentTime()
private Hit createHitAtCurrentTime(bool strong = false)
{
var hit = new Hit
{
IsStrong = strong,
StartTime = Time.Current + 3000,
};

View File

@ -7,6 +7,7 @@
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Taiko.Skinning
@ -20,12 +21,14 @@ public class LegacyHit : CompositeDrawable, IHasAccentColour
public LegacyHit(TaikoSkinComponents component)
{
this.component = component;
RelativeSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{
InternalChildren = new Drawable[]
InternalChildren = new[]
{
backgroundLayer = skin.GetAnimation("taikohitcircle", true, false),
skin.GetAnimation("taikohitcircleoverlay", true, false),
@ -36,6 +39,7 @@ private void load(ISkinSource skin)
foreach (var c in InternalChildren)
{
(c as IFramedAnimation)?.Stop();
c.Anchor = Anchor.Centre;
c.Origin = Anchor.Centre;
}
@ -45,6 +49,16 @@ private void load(ISkinSource skin)
: new Color4(67, 142, 172, 255);
}
protected override void Update()
{
base.Update();
// not all skins (including the default osu-stable) have similar sizes for hitcircle and hitcircleoverlay.
// this ensures they are scaled relative to each other but also match the expected DrawableHit size.
foreach (var c in InternalChildren)
c.Scale = new Vector2(DrawWidth / 128);
}
private Color4 accentColour;
public Color4 AccentColour