Apply width modification to hit object container instead of hit objects, to preserve original size.

This commit is contained in:
smoogipooo 2017-04-10 10:33:52 +09:00
parent e95c7dfa37
commit 05ac73edcb
3 changed files with 20 additions and 9 deletions

@ -1 +1 @@
Subproject commit 3d74f40e524adac263ead7437894a7b11fbf5a20
Subproject commit 49775b9d5e7a383d78ef1018532040823fe18e76

View File

@ -22,7 +22,7 @@ public abstract class DrawableTaikoHitObject<TaikoHitType> : DrawableHitObject<T
/// </summary>
private readonly List<Key> validKeys = new List<Key>(new[] { Key.D, Key.F, Key.J, Key.K });
public override Vector2 OriginPosition => new Vector2(bodyContainer.DrawHeight / 2f, DrawHeight / 2f);
public override Vector2 OriginPosition => new Vector2(DrawHeight / 2f);
protected override Container<Drawable> Content => bodyContainer;
@ -46,8 +46,6 @@ protected DrawableTaikoHitObject(TaikoHitType hitObject)
AddInternal(bodyContainer = new Container
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Children = new[]
{

View File

@ -107,9 +107,10 @@ public TaikoPlayfield()
Origin = Anchor.Centre,
FillMode = FillMode.Fit
},
hitObjectContainer = new Container
hitObjectContainer = new HitObjectContainer
{
RelativeSizeAxes = Axes.Both,
Height = DEFAULT_PLAYFIELD_HEIGHT,
FillMode = FillMode.Fit
},
judgementContainer = new Container<DrawableTaikoJudgement>
{
@ -169,9 +170,6 @@ private void load(OsuColour colours)
public override void Add(DrawableHitObject<TaikoHitObject, TaikoJudgement> h)
{
h.AutoSizeAxes = h.AutoSizeAxes & ~Axes.Y;
h.Height = DEFAULT_PLAYFIELD_HEIGHT;
h.FillMode = FillMode.Fit;
h.Depth = (float)h.HitObject.StartTime;
base.Add(h);
@ -216,5 +214,20 @@ public override void OnJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgemen
else
hitExplosionContainer.Children.FirstOrDefault(e => e.Judgement == judgedObject.Judgement)?.VisualiseSecondHit();
}
private class HitObjectContainer : Container
{
public HitObjectContainer()
{
RelativeSizeAxes = Axes.X;
}
protected override void Update()
{
base.Update();
Width = 1 / DrawScale.X;
}
}
}
}