Merge branch 'master' into fix-editor-play-after-drag

This commit is contained in:
Dan Balasescu
2020-11-04 14:45:20 +09:00
committed by GitHub
26 changed files with 695 additions and 138 deletions

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.Audio;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Rulesets.Edit;
using osuTK;
@ -67,8 +68,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private TimelineControlPointDisplay controlPoints;
private Bindable<float> waveformOpacity;
[BackgroundDependencyLoader]
private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours)
private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours, OsuConfigManager config)
{
AddRange(new Drawable[]
{
@ -95,7 +98,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
// 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);
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
waveformOpacity.BindValueChanged(_ => updateWaveformOpacity(), true);
WaveformVisible.ValueChanged += _ => updateWaveformOpacity();
ControlPointsVisible.ValueChanged += visible => controlPoints.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
TicksVisible.ValueChanged += visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
@ -115,6 +121,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}, true);
}
private void updateWaveformOpacity() =>
waveform.FadeTo(WaveformVisible.Value ? waveformOpacity.Value : 0, 200, Easing.OutQuint);
private float getZoomLevelForVisibleMilliseconds(double milliseconds) => Math.Max(1, (float)(track.Length / milliseconds));
protected override void Update()