mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 13:22:55 +08:00
Merge pull request #10312 from peppy/more-timeline-toggles
Move control points display to base timeline class (and add toggles)
This commit is contained in:
commit
b8ee9c3793
@ -8,10 +8,12 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Audio;
|
using osu.Framework.Graphics.Audio;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||||
@ -21,6 +23,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
public class Timeline : ZoomableScrollContainer, IPositionSnapProvider
|
public class Timeline : ZoomableScrollContainer, IPositionSnapProvider
|
||||||
{
|
{
|
||||||
public readonly Bindable<bool> WaveformVisible = new Bindable<bool>();
|
public readonly Bindable<bool> WaveformVisible = new Bindable<bool>();
|
||||||
|
|
||||||
|
public readonly Bindable<bool> ControlPointsVisible = new Bindable<bool>();
|
||||||
|
|
||||||
|
public readonly Bindable<bool> TicksVisible = new Bindable<bool>();
|
||||||
|
|
||||||
public readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
public readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
@ -56,24 +63,43 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
}
|
}
|
||||||
|
|
||||||
private WaveformGraph waveform;
|
private WaveformGraph waveform;
|
||||||
|
private ControlPointPart controlPoints;
|
||||||
|
private TimelineTickDisplay ticks;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours)
|
private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours)
|
||||||
{
|
{
|
||||||
Add(waveform = new WaveformGraph
|
AddRange(new Drawable[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Depth = float.MaxValue,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
waveform = new WaveformGraph
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = colours.Blue.Opacity(0.2f),
|
Colour = colours.Blue.Opacity(0.2f),
|
||||||
LowColour = colours.BlueLighter,
|
LowColour = colours.BlueLighter,
|
||||||
MidColour = colours.BlueDark,
|
MidColour = colours.BlueDark,
|
||||||
HighColour = colours.BlueDarker,
|
HighColour = colours.BlueDarker,
|
||||||
Depth = float.MaxValue
|
},
|
||||||
|
controlPoints = new ControlPointPart
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
},
|
||||||
|
ticks = new TimelineTickDisplay(),
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// We don't want the centre marker to scroll
|
// We don't want the centre marker to scroll
|
||||||
AddInternal(new CentreMarker { Depth = float.MaxValue });
|
AddInternal(new CentreMarker { Depth = float.MaxValue });
|
||||||
|
|
||||||
WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
||||||
|
ControlPointsVisible.ValueChanged += visible => controlPoints.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
||||||
|
TicksVisible.ValueChanged += visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
||||||
|
|
||||||
Beatmap.BindTo(beatmap);
|
Beatmap.BindTo(beatmap);
|
||||||
Beatmap.BindValueChanged(b =>
|
Beatmap.BindValueChanged(b =>
|
||||||
|
@ -25,6 +25,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
CornerRadius = 5;
|
CornerRadius = 5;
|
||||||
|
|
||||||
OsuCheckbox waveformCheckbox;
|
OsuCheckbox waveformCheckbox;
|
||||||
|
OsuCheckbox controlPointsCheckbox;
|
||||||
|
OsuCheckbox ticksCheckbox;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -57,12 +59,26 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Width = 160,
|
Width = 160,
|
||||||
Padding = new MarginPadding { Horizontal = 15 },
|
Padding = new MarginPadding { Horizontal = 10 },
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Spacing = new Vector2(0, 4),
|
Spacing = new Vector2(0, 4),
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
waveformCheckbox = new OsuCheckbox { LabelText = "Waveform" }
|
waveformCheckbox = new OsuCheckbox
|
||||||
|
{
|
||||||
|
LabelText = "Waveform",
|
||||||
|
Current = { Value = true },
|
||||||
|
},
|
||||||
|
controlPointsCheckbox = new OsuCheckbox
|
||||||
|
{
|
||||||
|
LabelText = "Control Points",
|
||||||
|
Current = { Value = true },
|
||||||
|
},
|
||||||
|
ticksCheckbox = new OsuCheckbox
|
||||||
|
{
|
||||||
|
LabelText = "Ticks",
|
||||||
|
Current = { Value = true },
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,9 +135,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
waveformCheckbox.Current.Value = true;
|
|
||||||
|
|
||||||
Timeline.WaveformVisible.BindTo(waveformCheckbox.Current);
|
Timeline.WaveformVisible.BindTo(waveformCheckbox.Current);
|
||||||
|
Timeline.ControlPointsVisible.BindTo(controlPointsCheckbox.Current);
|
||||||
|
Timeline.TicksVisible.BindTo(ticksCheckbox.Current);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeZoom(float change) => Timeline.Zoom += change;
|
private void changeZoom(float change) => Timeline.Zoom += change;
|
||||||
|
@ -112,7 +112,6 @@ namespace osu.Game.Screens.Edit
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new TimelineTickDisplay(),
|
|
||||||
CreateTimelineContent(),
|
CreateTimelineContent(),
|
||||||
}
|
}
|
||||||
}, t =>
|
}, t =>
|
||||||
|
@ -12,7 +12,6 @@ using osu.Game.Beatmaps.ControlPoints;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts;
|
|
||||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -31,11 +30,6 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable CreateTimelineContent() => new ControlPointPart
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
};
|
|
||||||
|
|
||||||
protected override Drawable CreateMainContent() => new GridContainer
|
protected override Drawable CreateMainContent() => new GridContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Loading…
Reference in New Issue
Block a user