Add start time tracking to EditorBeatmap

This commit is contained in:
smoogipoo
2019-10-03 14:23:48 +09:00
parent cbdf42cd7b
commit 897b3233af
2 changed files with 49 additions and 2 deletions

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using Newtonsoft.Json;
using osu.Framework.Bindables;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
@ -27,10 +28,16 @@ namespace osu.Game.Rulesets.Objects
/// </summary>
private const double control_point_leniency = 1;
public readonly Bindable<double> StartTimeBindable = new Bindable<double>();
/// <summary>
/// The time at which the HitObject starts.
/// </summary>
public virtual double StartTime { get; set; }
public virtual double StartTime
{
get => StartTimeBindable.Value;
set => StartTimeBindable.Value = value;
}
private List<HitSampleInfo> samples;
@ -67,6 +74,17 @@ namespace osu.Game.Rulesets.Objects
[JsonIgnore]
public IReadOnlyList<HitObject> NestedHitObjects => nestedHitObjects;
public HitObject()
{
StartTimeBindable.ValueChanged += time =>
{
double offset = time.NewValue - time.OldValue;
foreach (var nested in NestedHitObjects)
nested.StartTime += offset;
};
}
/// <summary>
/// Applies default values to this HitObject.
/// </summary>