1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 04:02:59 +08:00

Listen for track reload in timing screen

This commit is contained in:
ansel 2022-12-22 01:24:23 +03:00
parent 7089bb6c23
commit a18ece8610

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -29,9 +30,13 @@ namespace osu.Game.Screens.Edit.Timing
[Resolved] [Resolved]
private Bindable<ControlPointGroup> selectedGroup { get; set; } = null!; private Bindable<ControlPointGroup> selectedGroup { get; set; } = null!;
[Resolved]
private MusicController musicController { get; set; } = null!;
private readonly BindableBool isHandlingTapping = new BindableBool(); private readonly BindableBool isHandlingTapping = new BindableBool();
private MetronomeDisplay metronome = null!; private MetronomeDisplay metronome = null!;
private Container<WaveformComparisonDisplay> waveformContainer = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider, OsuColour colours) private void load(OverlayColourProvider colourProvider, OsuColour colours)
@ -88,7 +93,11 @@ namespace osu.Game.Screens.Edit.Timing
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
}, },
new WaveformComparisonDisplay(), waveformContainer = new Container<WaveformComparisonDisplay>
{
RelativeSizeAxes = Axes.Both,
Child = new WaveformComparisonDisplay(),
}
} }
}, },
} }
@ -179,6 +188,13 @@ namespace osu.Game.Screens.Edit.Timing
if (handling.NewValue) if (handling.NewValue)
start(); start();
}, true); }, true);
musicController.TrackChanged += onTrackReload;
}
private void onTrackReload(WorkingBeatmap beatmap, TrackChangeDirection tcd)
{
waveformContainer.Child = new WaveformComparisonDisplay();
} }
private void start() private void start()
@ -233,6 +249,12 @@ namespace osu.Game.Screens.Edit.Timing
timing.BeatLength = 60000 / (timing.BPM + adjust); timing.BeatLength = 60000 / (timing.BPM + adjust);
} }
protected override void Dispose(bool isDisposing)
{
musicController.TrackChanged -= onTrackReload;
base.Dispose(isDisposing);
}
private partial class InlineButton : OsuButton private partial class InlineButton : OsuButton
{ {
private readonly IconUsage icon; private readonly IconUsage icon;