Make work in editor

This commit is contained in:
Dean Herbert
2019-12-05 20:12:25 +09:00
parent e225b0032a
commit d8620a70fb
8 changed files with 53 additions and 23 deletions

View File

@ -16,8 +16,12 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
internal class TimelineHitObjectDisplay : TimelinePart
{
[Resolved]
private IEditorBeatmap beatmap { get; set; }
private IEditorBeatmap beatmap { get; }
public TimelineHitObjectDisplay(IEditorBeatmap beatmap)
{
this.beatmap = beatmap;
}
[BackgroundDependencyLoader]
private void load()
@ -27,18 +31,20 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
beatmap.HitObjectAdded += add;
beatmap.HitObjectRemoved += remove;
beatmap.StartTimeChanged += h =>
{
remove(h);
add(h);
};
}
private void remove(HitObject h)
{
foreach (var d in InternalChildren.OfType<TimelineHitObjectRepresentation>().Where(c => c.HitObject == h))
foreach (var d in Children.OfType<TimelineHitObjectRepresentation>().Where(c => c.HitObject == h))
d.Expire();
}
private void add(HitObject h)
{
Add(new TimelineHitObjectRepresentation(h));
}
private void add(HitObject h) => Add(new TimelineHitObjectRepresentation(h));
private class TimelineHitObjectRepresentation : CompositeDrawable
{