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.Bindables;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|
|
|
|
{
|
|
|
|
|
public partial 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
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-04-14 18:39:27 +08:00
|
|
|
|
Origin = Anchor.TopCentre;
|
|
|
|
|
|
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);
|
2022-06-24 20:25:23 +08:00
|
|
|
|
controlPoints.BindCollectionChanged((_, _) =>
|
2020-10-01 16:54:54 +08:00
|
|
|
|
{
|
2020-10-01 17:07:39 +08:00
|
|
|
|
ClearInternal();
|
|
|
|
|
|
2020-10-01 16:54:54 +08:00
|
|
|
|
foreach (var point in controlPoints)
|
|
|
|
|
{
|
|
|
|
|
switch (point)
|
|
|
|
|
{
|
2020-10-01 17:07:39 +08:00
|
|
|
|
case TimingControlPoint timingPoint:
|
|
|
|
|
AddInternal(new TimingPointPiece(timingPoint));
|
|
|
|
|
break;
|
2020-10-01 16:54:54 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|