1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 12:53:11 +08:00

Merge pull request #27779 from smoogipoo/fix-skineditor-external-event-bind

Fix SkinEditor binding event to external bindable
This commit is contained in:
Bartłomiej Dach 2024-04-03 12:05:41 +02:00 committed by GitHub
commit ca525f6a91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,6 +52,7 @@ namespace osu.Game.Overlays.SkinEditor
private OsuTextFlowContainer headerText = null!;
private Bindable<Skin> currentSkin = null!;
private Bindable<string> clipboardContent = null!;
[Resolved]
private OsuGame? game { get; set; }
@ -65,9 +66,6 @@ namespace osu.Game.Overlays.SkinEditor
[Resolved]
private RealmAccess realm { get; set; } = null!;
[Resolved]
private EditorClipboard clipboard { get; set; } = null!;
[Resolved]
private SkinEditorOverlay? skinEditorOverlay { get; set; }
@ -113,7 +111,7 @@ namespace osu.Game.Overlays.SkinEditor
}
[BackgroundDependencyLoader]
private void load()
private void load(EditorClipboard clipboard)
{
RelativeSizeAxes = Axes.Both;
@ -224,6 +222,8 @@ namespace osu.Game.Overlays.SkinEditor
}
}
};
clipboardContent = clipboard.Content.GetBoundCopy();
}
protected override void LoadComplete()
@ -243,7 +243,7 @@ namespace osu.Game.Overlays.SkinEditor
canCopy.Value = canCut.Value = SelectedComponents.Any();
}, true);
clipboard.Content.BindValueChanged(content => canPaste.Value = !string.IsNullOrEmpty(content.NewValue), true);
clipboardContent.BindValueChanged(content => canPaste.Value = !string.IsNullOrEmpty(content.NewValue), true);
Show();
@ -495,7 +495,7 @@ namespace osu.Game.Overlays.SkinEditor
protected void Copy()
{
clipboard.Content.Value = JsonConvert.SerializeObject(SelectedComponents.Cast<Drawable>().Select(s => s.CreateSerialisedInfo()).ToArray());
clipboardContent.Value = JsonConvert.SerializeObject(SelectedComponents.Cast<Drawable>().Select(s => s.CreateSerialisedInfo()).ToArray());
}
protected void Clone()
@ -515,7 +515,7 @@ namespace osu.Game.Overlays.SkinEditor
changeHandler?.BeginChange();
var drawableInfo = JsonConvert.DeserializeObject<SerialisedDrawableInfo[]>(clipboard.Content.Value);
var drawableInfo = JsonConvert.DeserializeObject<SerialisedDrawableInfo[]>(clipboardContent.Value);
if (drawableInfo == null)
return;