1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 21:02:55 +08:00
osu-lazer/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineControlPointGroup.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

52 lines
1.5 KiB
C#
Raw Normal View History

// 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;
private readonly IBindableList<ControlPoint> controlPoints = new BindableList<ControlPoint>();
public TimelineControlPointGroup(ControlPointGroup group)
{
Group = group;
RelativePositionAxes = Axes.X;
RelativeSizeAxes = Axes.Y;
AutoSizeAxes = Axes.X;
Origin = Anchor.TopLeft;
2021-04-14 18:39:27 +08:00
X = (float)group.Time;
}
protected override void LoadComplete()
{
base.LoadComplete();
controlPoints.BindTo(Group.ControlPoints);
2022-06-24 20:25:23 +08:00
controlPoints.BindCollectionChanged((_, _) =>
{
ClearInternal();
foreach (var point in controlPoints)
{
switch (point)
{
case TimingControlPoint timingPoint:
AddInternal(new TimingPointPiece(timingPoint));
break;
}
}
}, true);
}
}
}