mirror of
https://github.com/ppy/osu
synced 2025-01-01 11:52:20 +00:00
Rename ISkinnableTarget
to ISerialisableDrawableContainer
This commit is contained in:
parent
d159d6b970
commit
a7b47f6503
@ -45,7 +45,7 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
SelectedItems.BindTo(editor.SelectedComponents);
|
||||
|
||||
// track each target container on the current screen.
|
||||
var targetContainers = target.ChildrenOfType<ISkinnableTarget>().ToArray();
|
||||
var targetContainers = target.ChildrenOfType<ISerialisableDrawableContainer>().ToArray();
|
||||
|
||||
if (targetContainers.Length == 0)
|
||||
{
|
||||
|
@ -339,18 +339,18 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
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);
|
||||
}
|
||||
|
||||
private void revert()
|
||||
{
|
||||
ISkinnableTarget[] targetContainers = availableTargets.ToArray();
|
||||
ISerialisableDrawableContainer[] targetContainers = availableTargets.ToArray();
|
||||
|
||||
foreach (var t in targetContainers)
|
||||
{
|
||||
@ -370,7 +370,7 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
if (!hasBegunMutating)
|
||||
return;
|
||||
|
||||
ISkinnableTarget[] targetContainers = availableTargets.ToArray();
|
||||
ISerialisableDrawableContainer[] targetContainers = availableTargets.ToArray();
|
||||
|
||||
foreach (var t in targetContainers)
|
||||
currentSkin.Value.UpdateDrawableTarget(t);
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
{
|
||||
public partial class SkinEditorChangeHandler : EditorChangeHandler
|
||||
{
|
||||
private readonly ISkinnableTarget? firstTarget;
|
||||
private readonly ISerialisableDrawableContainer? firstTarget;
|
||||
|
||||
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
|
||||
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`.
|
||||
// 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)
|
||||
return;
|
||||
|
@ -10,9 +10,10 @@ using osu.Game.Extensions;
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
/// <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>
|
||||
public interface ISkinnableTarget : IDrawable
|
||||
public interface ISerialisableDrawableContainer : IDrawable
|
||||
{
|
||||
/// <summary>
|
||||
/// The definition of this target.
|
@ -143,7 +143,7 @@ namespace osu.Game.Skinning
|
||||
/// Remove all stored customisations for the provided target.
|
||||
/// </summary>
|
||||
/// <param name="targetContainer">The target container to reset.</param>
|
||||
public void ResetDrawableTarget(ISkinnableTarget targetContainer)
|
||||
public void ResetDrawableTarget(ISerialisableDrawableContainer targetContainer)
|
||||
{
|
||||
DrawableComponentInfo.Remove(targetContainer.Target);
|
||||
}
|
||||
@ -152,7 +152,7 @@ namespace osu.Game.Skinning
|
||||
/// Update serialised information for the provided target.
|
||||
/// </summary>
|
||||
/// <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();
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ using osu.Game.Skinning.Serialisation;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public partial class SkinnableTargetContainer : SkinReloadableDrawable, ISkinnableTarget
|
||||
public partial class SkinnableTargetContainer : SkinReloadableDrawable, ISerialisableDrawableContainer
|
||||
{
|
||||
private Container? content;
|
||||
|
||||
@ -76,7 +76,7 @@ namespace osu.Game.Skinning
|
||||
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="ArgumentException">Thrown if the provided instance is not a <see cref="Drawable"/>.</exception>
|
||||
public void Add(ISerialisableDrawable component)
|
||||
@ -91,7 +91,7 @@ namespace osu.Game.Skinning
|
||||
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="ArgumentException">Thrown if the provided instance is not a <see cref="Drawable"/>.</exception>
|
||||
public void Remove(ISerialisableDrawable component)
|
||||
|
Loading…
Reference in New Issue
Block a user