mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:43:05 +08:00
Make timing sections scroll again.
This commit is contained in:
parent
a25f11e809
commit
da932276e8
@ -41,10 +41,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
Origin = Anchor.TopCentre
|
Origin = Anchor.TopCentre
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// The "length" of the hold note stops at the "base" of the tail piece
|
|
||||||
// but we want to contain the tail piece within our bounds
|
|
||||||
Height += (float)HitObject.Duration / headPiece.Height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Color4 AccentColour
|
public override Color4 AccentColour
|
||||||
|
@ -15,8 +15,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
public DrawableNote(Note hitObject)
|
public DrawableNote(Note hitObject)
|
||||||
: base(hitObject)
|
: base(hitObject)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.Both;
|
||||||
AutoSizeAxes = Axes.Y;
|
Height = 100;
|
||||||
|
|
||||||
Add(headPiece = new NotePiece
|
Add(headPiece = new NotePiece
|
||||||
{
|
{
|
||||||
|
@ -71,6 +71,9 @@ namespace osu.Game.Rulesets.Mania.Timing
|
|||||||
{
|
{
|
||||||
private readonly ControlPoint timingChange;
|
private readonly ControlPoint timingChange;
|
||||||
|
|
||||||
|
protected override Container<Drawable> Content => content;
|
||||||
|
private readonly Container content;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a drawable timing section. The height of this container will be proportional
|
/// Creates a drawable timing section. The height of this container will be proportional
|
||||||
/// to the beat length of the timing section and the timespan of its parent at all times.
|
/// to the beat length of the timing section and the timespan of its parent at all times.
|
||||||
@ -89,7 +92,14 @@ namespace osu.Game.Rulesets.Mania.Timing
|
|||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
Y = -(float)timingChange.Time;
|
AddInternal(content = new AutoTimeRelativeContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.BottomCentre,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
RelativePositionAxes = Axes.Both,
|
||||||
|
Y = -(float)timingChange.Time
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
@ -101,7 +111,7 @@ namespace osu.Game.Rulesets.Mania.Timing
|
|||||||
RelativeCoordinateSpace = new Vector2(1, (float)parent.TimeSpan);
|
RelativeCoordinateSpace = new Vector2(1, (float)parent.TimeSpan);
|
||||||
|
|
||||||
// Scroll the content
|
// Scroll the content
|
||||||
Y = (float)(Time.Current - timingChange.Time);
|
content.Y = (float)(Time.Current - timingChange.Time);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Add(Drawable drawable)
|
public override void Add(Drawable drawable)
|
||||||
@ -120,7 +130,28 @@ namespace osu.Game.Rulesets.Mania.Timing
|
|||||||
/// can be placed within the timing section's bounds (in this case, from the start of the timing section up to infinity).
|
/// can be placed within the timing section's bounds (in this case, from the start of the timing section up to infinity).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="drawable">The drawable to check.</param>
|
/// <param name="drawable">The drawable to check.</param>
|
||||||
public bool CanContain(Drawable drawable) => Y >= drawable.Y;
|
public bool CanContain(Drawable drawable) => content.Y >= drawable.Y;
|
||||||
|
|
||||||
|
private class AutoTimeRelativeContainer : Container
|
||||||
|
{
|
||||||
|
public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
|
||||||
|
{
|
||||||
|
float height = 0;
|
||||||
|
|
||||||
|
foreach (Drawable child in Children)
|
||||||
|
{
|
||||||
|
// Todo: This is wrong, it won't work for absolute-y-sized children
|
||||||
|
float childEndPos = -child.Y + child.Height;
|
||||||
|
if (childEndPos > height)
|
||||||
|
height = childEndPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
Height = height;
|
||||||
|
RelativeCoordinateSpace = new Vector2(1, height);
|
||||||
|
|
||||||
|
return base.Invalidate(invalidation, source, shallPropagate);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user