Move control point display to the base timeline class

We want them to display on all screens with a timeline as they are quite
useful in all cases.
This commit is contained in:
Dean Herbert
2020-10-01 17:19:35 +09:00
parent 8c5176a97b
commit 0d03084cdc
3 changed files with 34 additions and 17 deletions

View File

@ -12,6 +12,7 @@ using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts;
using osuTK;
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
@ -21,6 +22,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
public class Timeline : ZoomableScrollContainer, IPositionSnapProvider
{
public readonly Bindable<bool> WaveformVisible = new Bindable<bool>();
public readonly Bindable<bool> ControlPointsVisible = new Bindable<bool>();
public readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
[Resolved]
@ -56,24 +60,34 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}
private WaveformGraph waveform;
private ControlPointPart controlPoints;
[BackgroundDependencyLoader]
private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours)
{
Add(waveform = new WaveformGraph
AddRange(new Drawable[]
{
RelativeSizeAxes = Axes.Both,
Colour = colours.Blue.Opacity(0.2f),
LowColour = colours.BlueLighter,
MidColour = colours.BlueDark,
HighColour = colours.BlueDarker,
Depth = float.MaxValue
waveform = new WaveformGraph
{
RelativeSizeAxes = Axes.Both,
Colour = colours.Blue.Opacity(0.2f),
LowColour = colours.BlueLighter,
MidColour = colours.BlueDark,
HighColour = colours.BlueDarker,
Depth = float.MaxValue
},
controlPoints = new ControlPointPart
{
RelativeSizeAxes = Axes.Both
},
new TimelineTickDisplay(),
});
// We don't want the centre marker to scroll
AddInternal(new CentreMarker { Depth = float.MaxValue });
WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
ControlPointsVisible.ValueChanged += visible => controlPoints.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
Beatmap.BindTo(beatmap);
Beatmap.BindValueChanged(b =>