Begin refactoring SelectionBlueprint to handle non-drawable HitObjects

This commit is contained in:
Dean Herbert
2020-01-21 00:53:59 +09:00
parent 1becbb072e
commit bd96cf94a6
15 changed files with 102 additions and 107 deletions

View File

@ -11,20 +11,24 @@ using osu.Game.Beatmaps;
namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
{
public class TimelinePart : TimelinePart<Drawable>
{
}
/// <summary>
/// Represents a part of the summary timeline..
/// </summary>
public class TimelinePart : Container
public class TimelinePart<T> : Container<T> where T : Drawable
{
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
private readonly Container timeline;
private readonly Container<T> content;
protected override Container<Drawable> Content => timeline;
protected override Container<T> Content => content;
public TimelinePart()
public TimelinePart(Container<T> content = null)
{
AddInternal(timeline = new Container { RelativeSizeAxes = Axes.Both });
AddInternal(this.content = content ?? new Container<T> { RelativeSizeAxes = Axes.Both });
Beatmap.ValueChanged += b =>
{
@ -44,17 +48,17 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
// the track may not be loaded completely (only has a length once it is).
if (!Beatmap.Value.Track.IsLoaded)
{
timeline.RelativeChildSize = Vector2.One;
content.RelativeChildSize = Vector2.One;
Schedule(updateRelativeChildSize);
return;
}
timeline.RelativeChildSize = new Vector2((float)Math.Max(1, Beatmap.Value.Track.Length), 1);
content.RelativeChildSize = new Vector2((float)Math.Max(1, Beatmap.Value.Track.Length), 1);
}
protected virtual void LoadBeatmap(WorkingBeatmap beatmap)
{
timeline.Clear();
content.Clear();
}
}
}