mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 11:42:56 +08:00
Refresh background on file change in editor
This commit is contained in:
parent
98483d2a1b
commit
9364c7775d
@ -99,6 +99,18 @@ namespace osu.Game.Screens.Backgrounds
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reloads beatmap's background.
|
||||
/// </summary>
|
||||
public void RefreshBackground()
|
||||
{
|
||||
Schedule(() =>
|
||||
{
|
||||
cancellationSource?.Cancel();
|
||||
LoadComponentAsync(new BeatmapBackground(beatmap), switchBackground, (cancellationSource = new CancellationTokenSource()).Token);
|
||||
});
|
||||
}
|
||||
|
||||
private void switchBackground(BeatmapBackground b)
|
||||
{
|
||||
float newDepth = 0;
|
||||
|
@ -33,6 +33,9 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
[Resolved]
|
||||
private EditorBeatmap editorBeatmap { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private Editor editor { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private SetupScreenHeader header { get; set; }
|
||||
|
||||
@ -93,6 +96,8 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
working.Value.Metadata.BackgroundFile = destination.Name;
|
||||
header.Background.UpdateBackground();
|
||||
|
||||
editor.ApplyToBackground(bg => bg.RefreshBackground());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user