1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 16:32:54 +08:00

Merge branch 'master' into stable-slider-tick-anims

This commit is contained in:
Salman Ahmed 2022-08-01 15:01:09 +03:00 committed by GitHub
commit 03eccc2f7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 8 deletions

View File

@ -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]

View File

@ -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,

View File

@ -70,7 +70,11 @@ namespace osu.Game.Overlays
/// <summary>
/// Forcefully reload the current <see cref="WorkingBeatmap"/>'s track from disk.
/// </summary>
public void ReloadCurrentTrack() => changeTrack();
public void ReloadCurrentTrack()
{
changeTrack();
TrackChanged?.Invoke(current, TrackChangeDirection.None);
}
/// <summary>
/// Returns whether the beatmap track is playing.

View File

@ -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;
}
/// <summary>
/// If the beatmap's track has changed, this method must be called to keep the editor in a valid state.
/// </summary>
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);
/// <summary>
/// Creates an <see cref="EditorState"/> instance representing the current state of the editor.

View File

@ -30,8 +30,8 @@ namespace osu.Game.Screens.Edit.Setup
[Resolved]
private IBindable<WorkingBeatmap> 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;
}