mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Rework DrawableHitObject to provide default life times and proper DrawableTimingSection autosizing.
This exposes LifetimeOffset from DrawableHitObject which is used by the XSRG rulesets to adjust the life time range by the VisibleTimeRange.
This commit is contained in:
@ -7,6 +7,8 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using OpenTK;
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Rulesets.Timing
|
||||
{
|
||||
@ -42,6 +44,8 @@ namespace osu.Game.Rulesets.Timing
|
||||
|
||||
public readonly MultiplierControlPoint ControlPoint;
|
||||
|
||||
private DrawableTimingSection timingSection;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="SpeedAdjustmentContainer"/>.
|
||||
/// </summary>
|
||||
@ -56,9 +60,10 @@ namespace osu.Game.Rulesets.Timing
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
DrawableTimingSection timingSection = CreateTimingSection();
|
||||
timingSection = CreateTimingSection();
|
||||
|
||||
timingSection.ScrollingAxes = ScrollingAxes;
|
||||
timingSection.ControlPoint = ControlPoint;
|
||||
timingSection.VisibleTimeRange.BindTo(VisibleTimeRange);
|
||||
timingSection.RelativeChildOffset = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)ControlPoint.StartTime : 0, (ScrollingAxes & Axes.Y) > 0 ? (float)ControlPoint.StartTime : 0);
|
||||
|
||||
@ -74,6 +79,15 @@ namespace osu.Game.Rulesets.Timing
|
||||
RelativeChildSize = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)VisibleTimeRange : 1, (ScrollingAxes & Axes.Y) > 0 ? (float)VisibleTimeRange : 1);
|
||||
}
|
||||
|
||||
public override double LifetimeStart => ControlPoint.StartTime - VisibleTimeRange;
|
||||
public override double LifetimeEnd => ControlPoint.StartTime + timingSection.Duration + VisibleTimeRange;
|
||||
|
||||
public override void Add(DrawableHitObject drawable)
|
||||
{
|
||||
drawable.LifetimeOffset.BindTo(VisibleTimeRange);
|
||||
base.Add(drawable);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether this speed adjustment can contain a hit object. This is true if the hit object occurs after this speed adjustment with respect to time.
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user