// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations; using osuTK.Graphics; namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts { public class GroupVisualisation : PointVisualisation { public readonly ControlPointGroup Group; private readonly IBindableList controlPoints = new BindableList(); [Resolved] private OsuColour colours { get; set; } public GroupVisualisation(ControlPointGroup group) : base(group.Time) { Group = group; } protected override void LoadComplete() { base.LoadComplete(); controlPoints.BindTo(Group.ControlPoints); controlPoints.BindCollectionChanged((_, __) => { if (controlPoints.Count == 0) { Colour = Color4.Transparent; return; } Colour = Group.ControlPoints.First().GetRepresentingColour(colours); }, true); } } }