wip: Move more functionality into ComposeBlueprintContainer

This commit is contained in:
Dean Herbert 2020-01-02 19:09:37 +09:00
parent ee332e0d42
commit d8d12cbbdd
3 changed files with 11 additions and 10 deletions

View File

@ -14,7 +14,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
/// <summary> /// <summary>
/// Represents a part of the summary timeline.. /// Represents a part of the summary timeline..
/// </summary> /// </summary>
public abstract class TimelinePart : Container public class TimelinePart : Container
{ {
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>(); protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
@ -22,7 +22,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
protected override Container<Drawable> Content => timeline; protected override Container<Drawable> Content => timeline;
protected TimelinePart() public TimelinePart()
{ {
AddInternal(timeline = new Container { RelativeSizeAxes = Axes.Both }); AddInternal(timeline = new Container { RelativeSizeAxes = Axes.Both });

View File

@ -40,9 +40,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
[Resolved] [Resolved]
private IAdjustableClock adjustableClock { get; set; } private IAdjustableClock adjustableClock { get; set; }
[Resolved]
private HitObjectComposer composer { get; set; }
[Resolved] [Resolved]
private EditorBeatmap beatmap { get; set; } private EditorBeatmap beatmap { get; set; }
@ -77,7 +74,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
dragBox.CreateProxy() dragBox.CreateProxy()
}; };
foreach (var obj in composer.HitObjects) foreach (var obj in beatmap.HitObjects)
addBlueprintFor(obj); addBlueprintFor(obj);
} }

View File

@ -14,15 +14,19 @@ using osuTK.Graphics;
namespace osu.Game.Screens.Edit.Compose.Components.Timeline namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{ {
internal class TimelineHitObjectDisplay : TimelinePart internal class TimelineHitObjectDisplay : BlueprintContainer
{ {
private EditorBeatmap beatmap { get; } private EditorBeatmap beatmap { get; }
private readonly TimelinePart content;
public TimelineHitObjectDisplay(EditorBeatmap beatmap) public TimelineHitObjectDisplay(EditorBeatmap beatmap)
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
this.beatmap = beatmap; this.beatmap = beatmap;
AddInternal(content = new TimelinePart());
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -42,15 +46,15 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private void remove(HitObject h) private void remove(HitObject h)
{ {
foreach (var d in Children.OfType<TimelineHitObjectRepresentation>().Where(c => c.HitObject == h)) foreach (var d in content.OfType<TimelineHitObjectRepresentation>().Where(c => c.HitObject == h))
d.Expire(); d.Expire();
} }
private void add(HitObject h) private void add(HitObject h)
{ {
var yOffset = Children.Count(d => d.X == h.StartTime); var yOffset = content.Count(d => d.X == h.StartTime);
Add(new TimelineHitObjectRepresentation(h) { Y = -yOffset * TimelineHitObjectRepresentation.THICKNESS }); content.Add(new TimelineHitObjectRepresentation(h) { Y = -yOffset * TimelineHitObjectRepresentation.THICKNESS });
} }
private class TimelineHitObjectRepresentation : CompositeDrawable private class TimelineHitObjectRepresentation : CompositeDrawable