mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 03:25:11 +08:00
Add skin providing container responding to beatmap skin edits
This commit is contained in:
parent
df43e758ee
commit
0d64da8c63
@ -15,7 +15,6 @@ using osu.Game.Extensions;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Compose
|
||||
{
|
||||
@ -73,7 +72,7 @@ namespace osu.Game.Screens.Edit.Compose
|
||||
{
|
||||
Debug.Assert(ruleset != null);
|
||||
|
||||
return new RulesetSkinProvidingContainer(ruleset, EditorBeatmap.PlayableBeatmap, beatmap.Value.Skin).WithChild(content);
|
||||
return new EditorSkinProvidingContainer(EditorBeatmap).WithChild(content);
|
||||
}
|
||||
|
||||
#region Input Handling
|
||||
|
40
osu.Game/Screens/Edit/EditorSkinProvidingContainer.cs
Normal file
40
osu.Game/Screens/Edit/EditorSkinProvidingContainer.cs
Normal file
@ -0,0 +1,40 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Game.Skinning;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace osu.Game.Screens.Edit
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="SkinProvidingContainer"/> that fires <see cref="ISkinSource.SourceChanged"/> when users have made a change to the beatmap skin
|
||||
/// of the map being edited.
|
||||
/// </summary>
|
||||
public class EditorSkinProvidingContainer : RulesetSkinProvidingContainer
|
||||
{
|
||||
private readonly EditorBeatmapSkin? beatmapSkin;
|
||||
|
||||
public EditorSkinProvidingContainer(EditorBeatmap editorBeatmap)
|
||||
: base(editorBeatmap.PlayableBeatmap.BeatmapInfo.Ruleset.CreateInstance(), editorBeatmap, editorBeatmap.BeatmapSkin)
|
||||
{
|
||||
beatmapSkin = editorBeatmap.BeatmapSkin;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
if (beatmapSkin != null)
|
||||
beatmapSkin.BeatmapSkinChanged += TriggerSourceChanged;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (beatmapSkin != null)
|
||||
beatmapSkin.BeatmapSkinChanged -= TriggerSourceChanged;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user