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

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 @@ namespace osu.Game.Rulesets.Taiko.Tests
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.Animations;
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 @@ namespace osu.Game.Rulesets.Taiko.Skinning
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 @@ namespace osu.Game.Rulesets.Taiko.Skinning
foreach (var c in InternalChildren)
{
(c as IFramedAnimation)?.Stop();
c.Anchor = Anchor.Centre;
c.Origin = Anchor.Centre;
}
@ -45,6 +49,16 @@ namespace osu.Game.Rulesets.Taiko.Skinning
: 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