mirror of
https://github.com/ppy/osu.git
synced 2026-05-22 13:54:00 +08:00
978fc91b09
See CI failures like https://github.com/ppy/osu/actions/runs/21238110652/job/61110112412?pr=36404#step:5:21. Hopefully works this time.
41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
// 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;
|
|
|
|
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 partial class EditorSkinProvidingContainer : RulesetSkinProvidingContainer
|
|
{
|
|
private readonly EditorBeatmapSkin? beatmapSkin;
|
|
|
|
public EditorSkinProvidingContainer(EditorBeatmap editorBeatmap)
|
|
: base(editorBeatmap.PlayableBeatmap.BeatmapInfo.Ruleset.CreateInstance(), editorBeatmap.PlayableBeatmap, editorBeatmap.BeatmapSkin?.Skin)
|
|
{
|
|
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;
|
|
}
|
|
|
|
private void triggerSourceChanged() => Schedule(TriggerSourceChanged);
|
|
}
|
|
}
|