2020-10-01 16:54:54 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|
|
|
{
|
|
|
|
public class TimelineControlPointGroup : CompositeDrawable
|
|
|
|
{
|
|
|
|
public readonly ControlPointGroup Group;
|
|
|
|
|
2020-11-04 14:29:14 +08:00
|
|
|
private readonly IBindableList<ControlPoint> controlPoints = new BindableList<ControlPoint>();
|
2020-10-01 16:54:54 +08:00
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
private OsuColour colours { get; set; }
|
|
|
|
|
|
|
|
public TimelineControlPointGroup(ControlPointGroup group)
|
|
|
|
{
|
|
|
|
Group = group;
|
|
|
|
|
|
|
|
RelativePositionAxes = Axes.X;
|
|
|
|
RelativeSizeAxes = Axes.Y;
|
2020-10-01 17:07:39 +08:00
|
|
|
AutoSizeAxes = Axes.X;
|
2020-10-01 16:54:54 +08:00
|
|
|
|
|
|
|
X = (float)group.Time;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
2020-11-04 14:29:14 +08:00
|
|
|
controlPoints.BindTo(Group.ControlPoints);
|
2020-10-01 16:54:54 +08:00
|
|
|
controlPoints.BindCollectionChanged((_, __) =>
|
|
|
|
{
|
2020-10-01 17:07:39 +08:00
|
|
|
ClearInternal();
|
|
|
|
|
2020-10-01 16:54:54 +08:00
|
|
|
foreach (var point in controlPoints)
|
|
|
|
{
|
|
|
|
switch (point)
|
|
|
|
{
|
|
|
|
case DifficultyControlPoint difficultyPoint:
|
2020-10-01 17:59:35 +08:00
|
|
|
AddInternal(new DifficultyPointPiece(difficultyPoint) { Depth = -2 });
|
2020-10-01 16:54:54 +08:00
|
|
|
break;
|
2020-10-01 17:07:39 +08:00
|
|
|
|
|
|
|
case TimingControlPoint timingPoint:
|
|
|
|
AddInternal(new TimingPointPiece(timingPoint));
|
|
|
|
break;
|
2020-10-01 17:49:48 +08:00
|
|
|
|
|
|
|
case SampleControlPoint samplePoint:
|
2020-10-01 17:59:35 +08:00
|
|
|
AddInternal(new SamplePointPiece(samplePoint) { Depth = -1 });
|
2020-10-01 17:49:48 +08:00
|
|
|
break;
|
2020-10-01 16:54:54 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|