diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs
index 6ad6f0b299..4baa4af8dd 100644
--- a/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs
+++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs
@@ -136,6 +136,20 @@ namespace osu.Game.Tests.Visual.Editing
AddAssert("track is not virtual", () => Beatmap.Value.Track is not TrackVirtual);
AddAssert("track length changed", () => Beatmap.Value.Track.Length > 60000);
+
+ AddStep("test play", () => Editor.TestGameplay());
+
+ AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog != null);
+ AddStep("confirm save", () => InputManager.Key(Key.Number1));
+
+ AddUntilStep("wait for return to editor", () => Editor.IsCurrentScreen());
+
+ AddAssert("track is still not virtual", () => Beatmap.Value.Track is not TrackVirtual);
+ AddAssert("track length correct", () => Beatmap.Value.Track.Length > 60000);
+
+ AddUntilStep("track not playing", () => !EditorClock.IsRunning);
+ AddStep("play track", () => InputManager.Key(Key.Space));
+ AddUntilStep("wait for track playing", () => EditorClock.IsRunning);
}
[Test]
diff --git a/osu.Game/Overlays/BeatmapSet/Info.cs b/osu.Game/Overlays/BeatmapSet/Info.cs
index 666ceff6cb..08423f2aa7 100644
--- a/osu.Game/Overlays/BeatmapSet/Info.cs
+++ b/osu.Game/Overlays/BeatmapSet/Info.cs
@@ -70,6 +70,7 @@ namespace osu.Game.Overlays.BeatmapSet
Width = metadata_width,
Padding = new MarginPadding { Horizontal = 10 },
Margin = new MarginPadding { Right = BeatmapSetOverlay.RIGHT_WIDTH + spacing },
+ Masking = true,
Child = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs
index 8af295dfe8..da87336039 100644
--- a/osu.Game/Overlays/MusicController.cs
+++ b/osu.Game/Overlays/MusicController.cs
@@ -70,7 +70,11 @@ namespace osu.Game.Overlays
///
/// Forcefully reload the current 's track from disk.
///
- public void ReloadCurrentTrack() => changeTrack();
+ public void ReloadCurrentTrack()
+ {
+ changeTrack();
+ TrackChanged?.Invoke(current, TrackChangeDirection.None);
+ }
///
/// Returns whether the beatmap track is playing.
diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs
index 3e3940c5ba..9e9cd8e3b7 100644
--- a/osu.Game/Screens/Edit/Editor.cs
+++ b/osu.Game/Screens/Edit/Editor.cs
@@ -329,6 +329,9 @@ namespace osu.Game.Screens.Edit
changeHandler?.CanRedo.BindValueChanged(v => redoMenuItem.Action.Disabled = !v.NewValue, true);
}
+ [Resolved]
+ private MusicController musicController { get; set; }
+
protected override void LoadComplete()
{
base.LoadComplete();
@@ -336,12 +339,18 @@ namespace osu.Game.Screens.Edit
Mode.Value = isNewBeatmap ? EditorScreenMode.SongSetup : EditorScreenMode.Compose;
Mode.BindValueChanged(onModeChanged, true);
+
+ musicController.TrackChanged += onTrackChanged;
}
- ///
- /// If the beatmap's track has changed, this method must be called to keep the editor in a valid state.
- ///
- public void UpdateClockSource() => clock.ChangeSource(Beatmap.Value.Track);
+ protected override void Dispose(bool isDisposing)
+ {
+ base.Dispose(isDisposing);
+
+ musicController.TrackChanged -= onTrackChanged;
+ }
+
+ private void onTrackChanged(WorkingBeatmap working, TrackChangeDirection direction) => clock.ChangeSource(working.Track);
///
/// Creates an instance representing the current state of the editor.
diff --git a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs
index 1f8381e1ed..8c14feebbc 100644
--- a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs
+++ b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs
@@ -30,8 +30,8 @@ namespace osu.Game.Screens.Edit.Setup
[Resolved]
private IBindable working { get; set; }
- [Resolved(canBeNull: true)]
- private Editor editor { get; set; }
+ [Resolved]
+ private EditorBeatmap editorBeatmap { get; set; }
[Resolved]
private SetupScreenHeader header { get; set; }
@@ -88,6 +88,8 @@ namespace osu.Game.Screens.Edit.Setup
beatmaps.AddFile(set, stream, destination.Name);
}
+ editorBeatmap.SaveState();
+
working.Value.Metadata.BackgroundFile = destination.Name;
header.Background.UpdateBackground();
@@ -117,9 +119,9 @@ namespace osu.Game.Screens.Edit.Setup
working.Value.Metadata.AudioFile = destination.Name;
+ editorBeatmap.SaveState();
music.ReloadCurrentTrack();
- editor?.UpdateClockSource();
return true;
}