mirror of
https://github.com/osukey/osukey.git
synced 2025-05-04 05:07:23 +09: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)
|
private void switchBackground(BeatmapBackground b)
|
||||||
{
|
{
|
||||||
float newDepth = 0;
|
float newDepth = 0;
|
||||||
|
@ -33,6 +33,9 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private EditorBeatmap editorBeatmap { get; set; }
|
private EditorBeatmap editorBeatmap { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Editor editor { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private SetupScreenHeader header { get; set; }
|
private SetupScreenHeader header { get; set; }
|
||||||
|
|
||||||
@ -93,6 +96,8 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
working.Value.Metadata.BackgroundFile = destination.Name;
|
working.Value.Metadata.BackgroundFile = destination.Name;
|
||||||
header.Background.UpdateBackground();
|
header.Background.UpdateBackground();
|
||||||
|
|
||||||
|
editor.ApplyToBackground(bg => bg.RefreshBackground());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user