2020-09-30 17:34:13 +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;
|
2021-04-15 17:42:30 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2020-09-30 17:34:13 +08:00
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|
|
|
{
|
2021-04-15 17:42:30 +08:00
|
|
|
public class GroupVisualisation : CompositeDrawable
|
2020-09-30 17:34:13 +08:00
|
|
|
{
|
|
|
|
public readonly ControlPointGroup Group;
|
|
|
|
|
2020-11-04 14:29:14 +08:00
|
|
|
private readonly IBindableList<ControlPoint> controlPoints = new BindableList<ControlPoint>();
|
2020-09-30 17:34:13 +08:00
|
|
|
|
|
|
|
public GroupVisualisation(ControlPointGroup group)
|
|
|
|
{
|
2021-04-15 17:42:30 +08:00
|
|
|
RelativePositionAxes = Axes.X;
|
|
|
|
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
Origin = Anchor.TopLeft;
|
|
|
|
|
2020-09-30 17:34:13 +08:00
|
|
|
Group = group;
|
2021-04-15 17:42:30 +08:00
|
|
|
X = (float)group.Time;
|
2020-09-30 17:34:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
2020-11-04 14:29:14 +08:00
|
|
|
controlPoints.BindTo(Group.ControlPoints);
|
2020-09-30 17:34:13 +08:00
|
|
|
controlPoints.BindCollectionChanged((_, __) =>
|
|
|
|
{
|
2021-04-15 17:42:30 +08:00
|
|
|
ClearInternal();
|
|
|
|
|
2020-09-30 17:34:13 +08:00
|
|
|
if (controlPoints.Count == 0)
|
|
|
|
return;
|
|
|
|
|
2021-04-15 17:42:30 +08:00
|
|
|
foreach (var point in Group.ControlPoints)
|
|
|
|
{
|
|
|
|
switch (point)
|
|
|
|
{
|
|
|
|
case TimingControlPoint _:
|
|
|
|
AddInternal(new ControlPointVisualisation(point) { Y = 0, });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DifficultyControlPoint _:
|
|
|
|
AddInternal(new ControlPointVisualisation(point) { Y = 0.25f, });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SampleControlPoint _:
|
|
|
|
AddInternal(new ControlPointVisualisation(point) { Y = 0.5f, });
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EffectControlPoint effect:
|
|
|
|
AddInternal(new EffectPointVisualisation(effect) { Y = 0.75f });
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-09-30 17:34:13 +08:00
|
|
|
}, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|