mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Accept ISerialisableDrawableContainer
directly in SkinBlueprintContainer
An end result of #22674 is that `SkinBlueprintContainer`s are only ever created by supplying a `SkinComponentsContainer` to them. However, `SkinBlueprintContainer` still contained remnants of code that suggested it was designed to handle cases where more than the drawable supplied to it contained more than one `ISerialisableDrawableContainer`, or even zero. The zero path is totally dead right now (because every `SkinComponentsContainer` is *by necessity* an `ISerialisableDrawableContainer`), and the more-than-one path is dead *for now* (and potentially forever?). Therefore, just hard-couple `SkinBlueprintContainer` to receive a single target container.
This commit is contained in:
@ -7,9 +7,7 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
using osu.Game.Skinning;
|
||||
@ -20,16 +18,16 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
{
|
||||
public partial class SkinBlueprintContainer : BlueprintContainer<ISerialisableDrawable>
|
||||
{
|
||||
private readonly Drawable target;
|
||||
private readonly ISerialisableDrawableContainer targetContainer;
|
||||
|
||||
private readonly List<BindableList<ISerialisableDrawable>> targetComponents = new List<BindableList<ISerialisableDrawable>>();
|
||||
|
||||
[Resolved]
|
||||
private SkinEditor editor { get; set; } = null!;
|
||||
|
||||
public SkinBlueprintContainer(Drawable target)
|
||||
public SkinBlueprintContainer(ISerialisableDrawableContainer targetContainer)
|
||||
{
|
||||
this.target = target;
|
||||
this.targetContainer = targetContainer;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -38,22 +36,10 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
|
||||
SelectedItems.BindTo(editor.SelectedComponents);
|
||||
|
||||
// track each target container on the current screen.
|
||||
var targetContainers = target.ChildrenOfType<ISerialisableDrawableContainer>().ToArray();
|
||||
var bindableList = new BindableList<ISerialisableDrawable> { BindTarget = targetContainer.Components };
|
||||
bindableList.BindCollectionChanged(componentsChanged, true);
|
||||
|
||||
if (targetContainers.Length == 0)
|
||||
{
|
||||
AddInternal(new NonSkinnableScreenPlaceholder());
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var targetContainer in targetContainers)
|
||||
{
|
||||
var bindableList = new BindableList<ISerialisableDrawable> { BindTarget = targetContainer.Components };
|
||||
bindableList.BindCollectionChanged(componentsChanged, true);
|
||||
|
||||
targetComponents.Add(bindableList);
|
||||
}
|
||||
targetComponents.Add(bindableList);
|
||||
}
|
||||
|
||||
private void componentsChanged(object? sender, NotifyCollectionChangedEventArgs e) => Schedule(() =>
|
||||
|
Reference in New Issue
Block a user