1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 21:13:20 +08:00

Rename ISkinnableTarget to ISerialisableDrawableContainer

This commit is contained in:
Dean Herbert 2023-02-15 16:28:42 +09:00
parent d159d6b970
commit a7b47f6503
6 changed files with 16 additions and 15 deletions

View File

@ -45,7 +45,7 @@ namespace osu.Game.Overlays.SkinEditor
SelectedItems.BindTo(editor.SelectedComponents); SelectedItems.BindTo(editor.SelectedComponents);
// track each target container on the current screen. // track each target container on the current screen.
var targetContainers = target.ChildrenOfType<ISkinnableTarget>().ToArray(); var targetContainers = target.ChildrenOfType<ISerialisableDrawableContainer>().ToArray();
if (targetContainers.Length == 0) if (targetContainers.Length == 0)
{ {

View File

@ -339,18 +339,18 @@ namespace osu.Game.Overlays.SkinEditor
settingsSidebar.Add(new SkinSettingsToolbox(component)); settingsSidebar.Add(new SkinSettingsToolbox(component));
} }
private IEnumerable<ISkinnableTarget> availableTargets => targetScreen.ChildrenOfType<ISkinnableTarget>(); private IEnumerable<ISerialisableDrawableContainer> availableTargets => targetScreen.ChildrenOfType<ISerialisableDrawableContainer>();
private ISkinnableTarget? getFirstTarget() => availableTargets.FirstOrDefault(); private ISerialisableDrawableContainer? getFirstTarget() => availableTargets.FirstOrDefault();
private ISkinnableTarget? getTarget(GlobalSkinComponentLookup.LookupType target) private ISerialisableDrawableContainer? getTarget(GlobalSkinComponentLookup.LookupType target)
{ {
return availableTargets.FirstOrDefault(c => c.Target == target); return availableTargets.FirstOrDefault(c => c.Target == target);
} }
private void revert() private void revert()
{ {
ISkinnableTarget[] targetContainers = availableTargets.ToArray(); ISerialisableDrawableContainer[] targetContainers = availableTargets.ToArray();
foreach (var t in targetContainers) foreach (var t in targetContainers)
{ {
@ -370,7 +370,7 @@ namespace osu.Game.Overlays.SkinEditor
if (!hasBegunMutating) if (!hasBegunMutating)
return; return;
ISkinnableTarget[] targetContainers = availableTargets.ToArray(); ISerialisableDrawableContainer[] targetContainers = availableTargets.ToArray();
foreach (var t in targetContainers) foreach (var t in targetContainers)
currentSkin.Value.UpdateDrawableTarget(t); currentSkin.Value.UpdateDrawableTarget(t);

View File

@ -17,7 +17,7 @@ namespace osu.Game.Overlays.SkinEditor
{ {
public partial class SkinEditorChangeHandler : EditorChangeHandler public partial class SkinEditorChangeHandler : EditorChangeHandler
{ {
private readonly ISkinnableTarget? firstTarget; private readonly ISerialisableDrawableContainer? firstTarget;
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable // ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
private readonly BindableList<ISerialisableDrawable>? components; private readonly BindableList<ISerialisableDrawable>? components;
@ -28,7 +28,7 @@ namespace osu.Game.Overlays.SkinEditor
// In the future we'll want this to cover all changes, even to skin's `InstantiationInfo`. // In the future we'll want this to cover all changes, even to skin's `InstantiationInfo`.
// We'll also need to consider cases where multiple targets are on screen at the same time. // We'll also need to consider cases where multiple targets are on screen at the same time.
firstTarget = targetScreen.ChildrenOfType<ISkinnableTarget>().FirstOrDefault(); firstTarget = targetScreen.ChildrenOfType<ISerialisableDrawableContainer>().FirstOrDefault();
if (firstTarget == null) if (firstTarget == null)
return; return;

View File

@ -10,9 +10,10 @@ using osu.Game.Extensions;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
/// <summary> /// <summary>
/// Denotes a container which can house <see cref="ISerialisableDrawable"/>s. /// A container which can house <see cref="ISerialisableDrawable"/>s.
/// Contains functionality for new drawables to be added, removed, and reloaded from provided <see cref="SerialisedDrawableInfo"/>.
/// </summary> /// </summary>
public interface ISkinnableTarget : IDrawable public interface ISerialisableDrawableContainer : IDrawable
{ {
/// <summary> /// <summary>
/// The definition of this target. /// The definition of this target.

View File

@ -143,7 +143,7 @@ namespace osu.Game.Skinning
/// Remove all stored customisations for the provided target. /// Remove all stored customisations for the provided target.
/// </summary> /// </summary>
/// <param name="targetContainer">The target container to reset.</param> /// <param name="targetContainer">The target container to reset.</param>
public void ResetDrawableTarget(ISkinnableTarget targetContainer) public void ResetDrawableTarget(ISerialisableDrawableContainer targetContainer)
{ {
DrawableComponentInfo.Remove(targetContainer.Target); DrawableComponentInfo.Remove(targetContainer.Target);
} }
@ -152,7 +152,7 @@ namespace osu.Game.Skinning
/// Update serialised information for the provided target. /// Update serialised information for the provided target.
/// </summary> /// </summary>
/// <param name="targetContainer">The target container to serialise to this skin.</param> /// <param name="targetContainer">The target container to serialise to this skin.</param>
public void UpdateDrawableTarget(ISkinnableTarget targetContainer) public void UpdateDrawableTarget(ISerialisableDrawableContainer targetContainer)
{ {
DrawableComponentInfo[targetContainer.Target] = targetContainer.CreateSerialisedInfo().ToArray(); DrawableComponentInfo[targetContainer.Target] = targetContainer.CreateSerialisedInfo().ToArray();
} }

View File

@ -12,7 +12,7 @@ using osu.Game.Skinning.Serialisation;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
public partial class SkinnableTargetContainer : SkinReloadableDrawable, ISkinnableTarget public partial class SkinnableTargetContainer : SkinReloadableDrawable, ISerialisableDrawableContainer
{ {
private Container? content; private Container? content;
@ -76,7 +76,7 @@ namespace osu.Game.Skinning
ComponentsLoaded = true; ComponentsLoaded = true;
} }
/// <inheritdoc cref="ISkinnableTarget"/> /// <inheritdoc cref="ISerialisableDrawableContainer"/>
/// <exception cref="NotSupportedException">Thrown when attempting to add an element to a target which is not supported by the current skin.</exception> /// <exception cref="NotSupportedException">Thrown when attempting to add an element to a target which is not supported by the current skin.</exception>
/// <exception cref="ArgumentException">Thrown if the provided instance is not a <see cref="Drawable"/>.</exception> /// <exception cref="ArgumentException">Thrown if the provided instance is not a <see cref="Drawable"/>.</exception>
public void Add(ISerialisableDrawable component) public void Add(ISerialisableDrawable component)
@ -91,7 +91,7 @@ namespace osu.Game.Skinning
components.Add(component); components.Add(component);
} }
/// <inheritdoc cref="ISkinnableTarget"/> /// <inheritdoc cref="ISerialisableDrawableContainer"/>
/// <exception cref="NotSupportedException">Thrown when attempting to add an element to a target which is not supported by the current skin.</exception> /// <exception cref="NotSupportedException">Thrown when attempting to add an element to a target which is not supported by the current skin.</exception>
/// <exception cref="ArgumentException">Thrown if the provided instance is not a <see cref="Drawable"/>.</exception> /// <exception cref="ArgumentException">Thrown if the provided instance is not a <see cref="Drawable"/>.</exception>
public void Remove(ISerialisableDrawable component) public void Remove(ISerialisableDrawable component)