revert: remove attachment logic from `SkinComponentContainer`

This is no longer in the scope of the PR.
This commit is contained in:
tsrk 2023-06-14 21:19:08 +02:00
parent e26aeea589
commit 081190802e
No known key found for this signature in database
GPG Key ID: EBD46BB3049B56D6
1 changed files with 0 additions and 26 deletions

View File

@ -6,10 +6,8 @@
using System.Linq;
using System.Threading;
using osu.Framework.Bindables;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.UI;
namespace osu.Game.Skinning
{
@ -41,8 +39,6 @@ public partial class SkinComponentsContainer : SkinReloadableDrawable, ISerialis
private CancellationTokenSource? cancellationSource;
private ICanAttachHUDPieces? attachTarget;
public SkinComponentsContainer(SkinComponentsContainerLookup lookup)
{
Lookup = lookup;
@ -66,10 +62,6 @@ public void Reload(SerialisedDrawableInfo[] skinnableInfo)
public void Reload(Container? componentsContainer)
{
components
.OfType<IAttachableSkinComponent>()
.ForEach(c => attachTarget?.Detach(c));
ClearInternal();
components.Clear();
ComponentsLoaded = false;
@ -85,7 +77,6 @@ public void Reload(Container? componentsContainer)
LoadComponentAsync(content, wrapper =>
{
AddInternal(wrapper);
wrapper.Children.OfType<IAttachableSkinComponent>().ForEach(c => attachTarget?.Attach(c));
components.AddRange(wrapper.Children.OfType<ISerialisableDrawable>());
ComponentsLoaded = true;
}, (cancellationSource = new CancellationTokenSource()).Token);
@ -102,9 +93,6 @@ public void Add(ISerialisableDrawable component)
if (!(component is Drawable drawable))
throw new ArgumentException($"Provided argument must be of type {nameof(Drawable)}.", nameof(component));
if (component is IAttachableSkinComponent attachableSkinComponent)
attachTarget?.Attach(attachableSkinComponent);
content.Add(drawable);
components.Add(component);
}
@ -120,24 +108,10 @@ public void Remove(ISerialisableDrawable component, bool disposeImmediately)
if (!(component is Drawable drawable))
throw new ArgumentException($"Provided argument must be of type {nameof(Drawable)}.", nameof(component));
if (component is IAttachableSkinComponent attachableSkinComponent)
attachTarget?.Detach(attachableSkinComponent);
content.Remove(drawable, disposeImmediately);
components.Remove(component);
}
public void SetAttachTarget(ICanAttachHUDPieces target)
{
attachTarget = target;
foreach (var child in InternalChildren)
{
if (child is IAttachableSkinComponent attachable)
attachTarget.Attach(attachable);
}
}
protected override void SkinChanged(ISkinSource skin)
{
base.SkinChanged(skin);