mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 05:22:54 +08:00
Rename ISkinnableDrawable
to ISerialisableDrawable
This commit is contained in:
parent
8cb5a51aa7
commit
d159d6b970
@ -74,7 +74,7 @@ namespace osu.Game.Tests.Skins
|
||||
}
|
||||
}
|
||||
|
||||
var editableTypes = SerialisedDrawableInfo.GetAllAvailableDrawables().Where(t => (Activator.CreateInstance(t) as ISkinnableDrawable)?.IsEditable == true);
|
||||
var editableTypes = SerialisedDrawableInfo.GetAllAvailableDrawables().Where(t => (Activator.CreateInstance(t) as ISerialisableDrawable)?.IsEditable == true);
|
||||
|
||||
Assert.That(instantiatedTypes, Is.EquivalentTo(editableTypes));
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ namespace osu.Game.Extensions
|
||||
component.Anchor = drawableInfo.Anchor;
|
||||
component.Origin = drawableInfo.Origin;
|
||||
|
||||
if (component is ISkinnableDrawable skinnable)
|
||||
if (component is ISerialisableDrawable skinnable)
|
||||
{
|
||||
skinnable.UsesFixedAnchor = drawableInfo.UsesFixedAnchor;
|
||||
|
||||
|
@ -17,7 +17,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.SkinEditor
|
||||
{
|
||||
public partial class SkinBlueprint : SelectionBlueprint<ISkinnableDrawable>
|
||||
public partial class SkinBlueprint : SelectionBlueprint<ISerialisableDrawable>
|
||||
{
|
||||
private Container box = null!;
|
||||
|
||||
@ -32,7 +32,7 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; } = null!;
|
||||
|
||||
public SkinBlueprint(ISkinnableDrawable component)
|
||||
public SkinBlueprint(ISerialisableDrawable component)
|
||||
: base(component)
|
||||
{
|
||||
}
|
||||
|
@ -24,11 +24,11 @@ using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Overlays.SkinEditor
|
||||
{
|
||||
public partial class SkinBlueprintContainer : BlueprintContainer<ISkinnableDrawable>
|
||||
public partial class SkinBlueprintContainer : BlueprintContainer<ISerialisableDrawable>
|
||||
{
|
||||
private readonly Drawable target;
|
||||
|
||||
private readonly List<BindableList<ISkinnableDrawable>> targetComponents = new List<BindableList<ISkinnableDrawable>>();
|
||||
private readonly List<BindableList<ISerialisableDrawable>> targetComponents = new List<BindableList<ISerialisableDrawable>>();
|
||||
|
||||
[Resolved]
|
||||
private SkinEditor editor { get; set; } = null!;
|
||||
@ -55,7 +55,7 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
|
||||
foreach (var targetContainer in targetContainers)
|
||||
{
|
||||
var bindableList = new BindableList<ISkinnableDrawable> { BindTarget = targetContainer.Components };
|
||||
var bindableList = new BindableList<ISerialisableDrawable> { BindTarget = targetContainer.Components };
|
||||
bindableList.BindCollectionChanged(componentsChanged, true);
|
||||
|
||||
targetComponents.Add(bindableList);
|
||||
@ -69,7 +69,7 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
Debug.Assert(e.NewItems != null);
|
||||
|
||||
foreach (var item in e.NewItems.Cast<ISkinnableDrawable>())
|
||||
foreach (var item in e.NewItems.Cast<ISerialisableDrawable>())
|
||||
AddBlueprintFor(item);
|
||||
break;
|
||||
|
||||
@ -77,7 +77,7 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
case NotifyCollectionChangedAction.Reset:
|
||||
Debug.Assert(e.OldItems != null);
|
||||
|
||||
foreach (var item in e.OldItems.Cast<ISkinnableDrawable>())
|
||||
foreach (var item in e.OldItems.Cast<ISerialisableDrawable>())
|
||||
RemoveBlueprintFor(item);
|
||||
break;
|
||||
|
||||
@ -85,16 +85,16 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
Debug.Assert(e.NewItems != null);
|
||||
Debug.Assert(e.OldItems != null);
|
||||
|
||||
foreach (var item in e.OldItems.Cast<ISkinnableDrawable>())
|
||||
foreach (var item in e.OldItems.Cast<ISerialisableDrawable>())
|
||||
RemoveBlueprintFor(item);
|
||||
|
||||
foreach (var item in e.NewItems.Cast<ISkinnableDrawable>())
|
||||
foreach (var item in e.NewItems.Cast<ISerialisableDrawable>())
|
||||
AddBlueprintFor(item);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
protected override void AddBlueprintFor(ISkinnableDrawable item)
|
||||
protected override void AddBlueprintFor(ISerialisableDrawable item)
|
||||
{
|
||||
if (!item.IsEditable)
|
||||
return;
|
||||
@ -145,12 +145,12 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
// convert to game space coordinates
|
||||
delta = firstBlueprint.ToScreenSpace(delta) - firstBlueprint.ToScreenSpace(Vector2.Zero);
|
||||
|
||||
SelectionHandler.HandleMovement(new MoveSelectionEvent<ISkinnableDrawable>(firstBlueprint, delta));
|
||||
SelectionHandler.HandleMovement(new MoveSelectionEvent<ISerialisableDrawable>(firstBlueprint, delta));
|
||||
}
|
||||
|
||||
protected override SelectionHandler<ISkinnableDrawable> CreateSelectionHandler() => new SkinSelectionHandler();
|
||||
protected override SelectionHandler<ISerialisableDrawable> CreateSelectionHandler() => new SkinSelectionHandler();
|
||||
|
||||
protected override SelectionBlueprint<ISkinnableDrawable> CreateBlueprintFor(ISkinnableDrawable component)
|
||||
protected override SelectionBlueprint<ISerialisableDrawable> CreateBlueprintFor(ISerialisableDrawable component)
|
||||
=> new SkinBlueprint(component);
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
@ -60,7 +60,7 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
{
|
||||
Drawable instance = (Drawable)Activator.CreateInstance(type)!;
|
||||
|
||||
if (!((ISkinnableDrawable)instance).IsEditable) return;
|
||||
if (!((ISerialisableDrawable)instance).IsEditable) return;
|
||||
|
||||
fill.Add(new ToolboxComponentButton(instance, target)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
|
||||
public const float MENU_HEIGHT = 40;
|
||||
|
||||
public readonly BindableList<ISkinnableDrawable> SelectedComponents = new BindableList<ISkinnableDrawable>();
|
||||
public readonly BindableList<ISerialisableDrawable> SelectedComponents = new BindableList<ISerialisableDrawable>();
|
||||
|
||||
protected override bool StartHidden => true;
|
||||
|
||||
@ -302,13 +302,13 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
|
||||
private void placeComponent(Type type)
|
||||
{
|
||||
if (!(Activator.CreateInstance(type) is ISkinnableDrawable component))
|
||||
throw new InvalidOperationException($"Attempted to instantiate a component for placement which was not an {typeof(ISkinnableDrawable)}.");
|
||||
if (!(Activator.CreateInstance(type) is ISerialisableDrawable component))
|
||||
throw new InvalidOperationException($"Attempted to instantiate a component for placement which was not an {typeof(ISerialisableDrawable)}.");
|
||||
|
||||
placeComponent(component);
|
||||
}
|
||||
|
||||
private void placeComponent(ISkinnableDrawable component, bool applyDefaults = true)
|
||||
private void placeComponent(ISerialisableDrawable component, bool applyDefaults = true)
|
||||
{
|
||||
var targetContainer = getFirstTarget();
|
||||
|
||||
@ -400,7 +400,7 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
this.FadeOut(TRANSITION_DURATION, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public void DeleteItems(ISkinnableDrawable[] items)
|
||||
public void DeleteItems(ISerialisableDrawable[] items)
|
||||
{
|
||||
foreach (var item in items)
|
||||
availableTargets.FirstOrDefault(t => t.Components.Contains(item))?.Remove(item);
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
private readonly ISkinnableTarget? firstTarget;
|
||||
|
||||
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
|
||||
private readonly BindableList<ISkinnableDrawable>? components;
|
||||
private readonly BindableList<ISerialisableDrawable>? components;
|
||||
|
||||
public SkinEditorChangeHandler(Drawable targetScreen)
|
||||
{
|
||||
@ -33,7 +33,7 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
if (firstTarget == null)
|
||||
return;
|
||||
|
||||
components = new BindableList<ISkinnableDrawable> { BindTarget = firstTarget.Components };
|
||||
components = new BindableList<ISerialisableDrawable> { BindTarget = firstTarget.Components };
|
||||
components.BindCollectionChanged((_, _) => SaveState());
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.SkinEditor
|
||||
{
|
||||
public partial class SkinSelectionHandler : SelectionHandler<ISkinnableDrawable>
|
||||
public partial class SkinSelectionHandler : SelectionHandler<ISerialisableDrawable>
|
||||
{
|
||||
[Resolved]
|
||||
private SkinEditor skinEditor { get; set; } = null!;
|
||||
@ -147,7 +147,7 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool HandleMovement(MoveSelectionEvent<ISkinnableDrawable> moveEvent)
|
||||
public override bool HandleMovement(MoveSelectionEvent<ISerialisableDrawable> moveEvent)
|
||||
{
|
||||
foreach (var c in SelectedBlueprints)
|
||||
{
|
||||
@ -178,10 +178,10 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
SelectionBox.CanReverse = false;
|
||||
}
|
||||
|
||||
protected override void DeleteItems(IEnumerable<ISkinnableDrawable> items) =>
|
||||
protected override void DeleteItems(IEnumerable<ISerialisableDrawable> items) =>
|
||||
skinEditor.DeleteItems(items.ToArray());
|
||||
|
||||
protected override IEnumerable<MenuItem> GetContextMenuItemsForSelection(IEnumerable<SelectionBlueprint<ISkinnableDrawable>> selection)
|
||||
protected override IEnumerable<MenuItem> GetContextMenuItemsForSelection(IEnumerable<SelectionBlueprint<ISerialisableDrawable>> selection)
|
||||
{
|
||||
var closestItem = new TernaryStateRadioMenuItem("Closest", MenuItemType.Standard, _ => applyClosestAnchors())
|
||||
{
|
||||
@ -209,7 +209,7 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
foreach (var item in base.GetContextMenuItemsForSelection(selection))
|
||||
yield return item;
|
||||
|
||||
IEnumerable<TernaryStateMenuItem> createAnchorItems(Func<ISkinnableDrawable, Anchor, bool> checkFunction, Action<Anchor> applyFunction)
|
||||
IEnumerable<TernaryStateMenuItem> createAnchorItems(Func<ISerialisableDrawable, Anchor, bool> checkFunction, Action<Anchor> applyFunction)
|
||||
{
|
||||
var displayableAnchors = new[]
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public partial class BPMCounter : RollingCounter<double>, ISkinnableDrawable
|
||||
public partial class BPMCounter : RollingCounter<double>, ISerialisableDrawable
|
||||
{
|
||||
protected override double RollingDuration => 750;
|
||||
|
||||
|
@ -14,7 +14,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD.ClicksPerSecond
|
||||
{
|
||||
public partial class ClicksPerSecondCounter : RollingCounter<int>, ISkinnableDrawable
|
||||
public partial class ClicksPerSecondCounter : RollingCounter<int>, ISerialisableDrawable
|
||||
{
|
||||
[Resolved]
|
||||
private ClicksPerSecondCalculator calculator { get; set; } = null!;
|
||||
|
@ -7,7 +7,7 @@ using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public abstract partial class ComboCounter : RollingCounter<int>, ISkinnableDrawable
|
||||
public abstract partial class ComboCounter : RollingCounter<int>, ISerialisableDrawable
|
||||
{
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
|
@ -9,7 +9,7 @@ using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public partial class DefaultAccuracyCounter : GameplayAccuracyCounter, ISkinnableDrawable
|
||||
public partial class DefaultAccuracyCounter : GameplayAccuracyCounter, ISerialisableDrawable
|
||||
{
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
|
@ -19,7 +19,7 @@ using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public partial class DefaultHealthDisplay : HealthDisplay, IHasAccentColour, ISkinnableDrawable
|
||||
public partial class DefaultHealthDisplay : HealthDisplay, IHasAccentColour, ISerialisableDrawable
|
||||
{
|
||||
/// <summary>
|
||||
/// The base opacity of the glow.
|
||||
|
@ -10,7 +10,7 @@ using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public partial class DefaultScoreCounter : GameplayScoreCounter, ISkinnableDrawable
|
||||
public partial class DefaultScoreCounter : GameplayScoreCounter, ISerialisableDrawable
|
||||
{
|
||||
public DefaultScoreCounter()
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
||||
{
|
||||
public abstract partial class HitErrorMeter : CompositeDrawable, ISkinnableDrawable
|
||||
public abstract partial class HitErrorMeter : CompositeDrawable, ISerialisableDrawable
|
||||
{
|
||||
protected HitWindows HitWindows { get; private set; }
|
||||
|
||||
|
@ -15,7 +15,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD.JudgementCounter
|
||||
{
|
||||
public partial class JudgementCounterDisplay : CompositeDrawable, ISkinnableDrawable
|
||||
public partial class JudgementCounterDisplay : CompositeDrawable, ISerialisableDrawable
|
||||
{
|
||||
public const int TRANSFORM_DURATION = 250;
|
||||
|
||||
|
@ -35,7 +35,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public partial class PerformancePointsCounter : RollingCounter<int>, ISkinnableDrawable
|
||||
public partial class PerformancePointsCounter : RollingCounter<int>, ISerialisableDrawable
|
||||
{
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
|
@ -14,7 +14,7 @@ using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public abstract partial class SongProgress : OverlayContainer, ISkinnableDrawable
|
||||
public abstract partial class SongProgress : OverlayContainer, ISerialisableDrawable
|
||||
{
|
||||
// Some implementations of this element allow seeking during gameplay playback.
|
||||
// Set a sane default of never handling input to override the behaviour provided by OverlayContainer.
|
||||
|
@ -20,7 +20,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public partial class UnstableRateCounter : RollingCounter<int>, ISkinnableDrawable
|
||||
public partial class UnstableRateCounter : RollingCounter<int>, ISerialisableDrawable
|
||||
{
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Skinning.Components
|
||||
/// Intended to be a test bed for skinning. May be removed at some point in the future.
|
||||
/// </summary>
|
||||
[UsedImplicitly]
|
||||
public partial class BigBlackBox : CompositeDrawable, ISkinnableDrawable
|
||||
public partial class BigBlackBox : CompositeDrawable, ISerialisableDrawable
|
||||
{
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Skinning
|
||||
/// <summary>
|
||||
/// A skin component that contains text and allows the user to choose its font.
|
||||
/// </summary>
|
||||
public abstract partial class FontAdjustableSkinComponent : Container, ISkinnableDrawable
|
||||
public abstract partial class FontAdjustableSkinComponent : Container, ISerialisableDrawable
|
||||
{
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Skinning
|
||||
///
|
||||
/// Serialisation is done via <see cref="SerialisedDrawableInfo"/> using <see cref="osu.Game.Extensions.DrawableExtensions.CreateSerialisedInfo"/>.
|
||||
/// </remarks>
|
||||
public interface ISkinnableDrawable : IDrawable
|
||||
public interface ISerialisableDrawable : IDrawable
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether this component should be editable by an end user.
|
||||
@ -26,8 +26,8 @@ namespace osu.Game.Skinning
|
||||
bool IsEditable => true;
|
||||
|
||||
/// <summary>
|
||||
/// In the context of the skin layout editor, whether this <see cref="ISkinnableDrawable"/> has a permanent anchor defined.
|
||||
/// If <see langword="false"/>, this <see cref="ISkinnableDrawable"/>'s <see cref="Drawable.Anchor"/> is automatically determined by proximity,
|
||||
/// In the context of the skin layout editor, whether this <see cref="ISerialisableDrawable"/> has a permanent anchor defined.
|
||||
/// If <see langword="false"/>, this <see cref="ISerialisableDrawable"/>'s <see cref="Drawable.Anchor"/> is automatically determined by proximity,
|
||||
/// If <see langword="true"/>, a fixed anchor point has been defined.
|
||||
/// </summary>
|
||||
bool UsesFixedAnchor { get; set; }
|
@ -10,7 +10,7 @@ using osu.Game.Extensions;
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
/// <summary>
|
||||
/// Denotes a container which can house <see cref="ISkinnableDrawable"/>s.
|
||||
/// Denotes a container which can house <see cref="ISerialisableDrawable"/>s.
|
||||
/// </summary>
|
||||
public interface ISkinnableTarget : IDrawable
|
||||
{
|
||||
@ -22,7 +22,7 @@ namespace osu.Game.Skinning
|
||||
/// <summary>
|
||||
/// A bindable list of components which are being tracked by this skinnable target.
|
||||
/// </summary>
|
||||
IBindableList<ISkinnableDrawable> Components { get; }
|
||||
IBindableList<ISerialisableDrawable> Components { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Serialise all children as <see cref="SerialisedDrawableInfo"/>.
|
||||
@ -44,12 +44,12 @@ namespace osu.Game.Skinning
|
||||
/// Add a new skinnable component to this target.
|
||||
/// </summary>
|
||||
/// <param name="drawable">The component to add.</param>
|
||||
void Add(ISkinnableDrawable drawable);
|
||||
void Add(ISerialisableDrawable drawable);
|
||||
|
||||
/// <summary>
|
||||
/// Remove an existing skinnable component from this target.
|
||||
/// </summary>
|
||||
/// <param name="component">The component to remove.</param>
|
||||
void Remove(ISkinnableDrawable component);
|
||||
void Remove(ISerialisableDrawable component);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public partial class LegacyAccuracyCounter : GameplayAccuracyCounter, ISkinnableDrawable
|
||||
public partial class LegacyAccuracyCounter : GameplayAccuracyCounter, ISerialisableDrawable
|
||||
{
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Skinning
|
||||
/// <summary>
|
||||
/// Uses the 'x' symbol and has a pop-out effect while rolling over.
|
||||
/// </summary>
|
||||
public partial class LegacyComboCounter : CompositeDrawable, ISkinnableDrawable
|
||||
public partial class LegacyComboCounter : CompositeDrawable, ISerialisableDrawable
|
||||
{
|
||||
public Bindable<int> Current { get; } = new BindableInt { MinValue = 0 };
|
||||
|
||||
|
@ -19,7 +19,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public partial class LegacyHealthDisplay : HealthDisplay, ISkinnableDrawable
|
||||
public partial class LegacyHealthDisplay : HealthDisplay, ISerialisableDrawable
|
||||
{
|
||||
private const double epic_cutoff = 0.5;
|
||||
|
||||
|
@ -8,7 +8,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public partial class LegacyScoreCounter : GameplayScoreCounter, ISkinnableDrawable
|
||||
public partial class LegacyScoreCounter : GameplayScoreCounter, ISerialisableDrawable
|
||||
{
|
||||
protected override double RollingDuration => 1000;
|
||||
protected override Easing RollingEasing => Easing.Out;
|
||||
|
@ -18,9 +18,13 @@ using osuTK;
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
/// <summary>
|
||||
/// Serialised backing data for <see cref="ISkinnableDrawable"/>s.
|
||||
/// Serialised backing data for <see cref="ISerialisableDrawable"/>s.
|
||||
/// Used for json serialisation in user skins.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Can be created using <see cref="SerialisableDrawableExtensions.CreateSerialisedInfo"/>.
|
||||
/// Can also be applied to an existing drawable using <see cref="SerialisableDrawableExtensions.ApplySerialisedInfo"/>.
|
||||
/// </remarks>
|
||||
[Serializable]
|
||||
public sealed class SerialisedDrawableInfo
|
||||
{
|
||||
@ -36,7 +40,7 @@ namespace osu.Game.Skinning
|
||||
|
||||
public Anchor Origin { get; set; }
|
||||
|
||||
/// <inheritdoc cref="ISkinnableDrawable.UsesFixedAnchor"/>
|
||||
/// <inheritdoc cref="ISerialisableDrawable.UsesFixedAnchor"/>
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
public Dictionary<string, object> Settings { get; set; } = new Dictionary<string, object>();
|
||||
@ -62,7 +66,7 @@ namespace osu.Game.Skinning
|
||||
Anchor = component.Anchor;
|
||||
Origin = component.Origin;
|
||||
|
||||
if (component is ISkinnableDrawable skinnable)
|
||||
if (component is ISerialisableDrawable skinnable)
|
||||
UsesFixedAnchor = skinnable.UsesFixedAnchor;
|
||||
|
||||
foreach (var (_, property) in component.GetSettingsSourceProperties())
|
||||
@ -74,7 +78,7 @@ namespace osu.Game.Skinning
|
||||
|
||||
if (component is Container<Drawable> container)
|
||||
{
|
||||
foreach (var child in container.OfType<ISkinnableDrawable>().OfType<Drawable>())
|
||||
foreach (var child in container.OfType<ISerialisableDrawable>().OfType<Drawable>())
|
||||
Children.Add(child.CreateSerialisedInfo());
|
||||
}
|
||||
}
|
||||
@ -102,7 +106,7 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
return typeof(OsuGame).Assembly.GetTypes()
|
||||
.Where(t => !t.IsInterface && !t.IsAbstract)
|
||||
.Where(t => typeof(ISkinnableDrawable).IsAssignableFrom(t))
|
||||
.Where(t => typeof(ISerialisableDrawable).IsAssignableFrom(t))
|
||||
.OrderBy(t => t.Name)
|
||||
.ToArray();
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Skinning
|
||||
/// <summary>
|
||||
/// A skinnable element which uses a single texture backing.
|
||||
/// </summary>
|
||||
public partial class SkinnableSprite : SkinnableDrawable, ISkinnableDrawable
|
||||
public partial class SkinnableSprite : SkinnableDrawable, ISerialisableDrawable
|
||||
{
|
||||
protected override bool ApplySizeRestrictionsToDefault => true;
|
||||
|
||||
|
@ -18,9 +18,9 @@ namespace osu.Game.Skinning
|
||||
|
||||
public GlobalSkinComponentLookup.LookupType Target { get; }
|
||||
|
||||
public IBindableList<ISkinnableDrawable> Components => components;
|
||||
public IBindableList<ISerialisableDrawable> Components => components;
|
||||
|
||||
private readonly BindableList<ISkinnableDrawable> components = new BindableList<ISkinnableDrawable>();
|
||||
private readonly BindableList<ISerialisableDrawable> components = new BindableList<ISerialisableDrawable>();
|
||||
|
||||
public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks; // ensure that components are loaded even if the target container is hidden (ie. due to user toggle).
|
||||
|
||||
@ -68,7 +68,7 @@ namespace osu.Game.Skinning
|
||||
LoadComponentAsync(content, wrapper =>
|
||||
{
|
||||
AddInternal(wrapper);
|
||||
components.AddRange(wrapper.Children.OfType<ISkinnableDrawable>());
|
||||
components.AddRange(wrapper.Children.OfType<ISerialisableDrawable>());
|
||||
ComponentsLoaded = true;
|
||||
}, (cancellationSource = new CancellationTokenSource()).Token);
|
||||
}
|
||||
@ -79,7 +79,7 @@ namespace osu.Game.Skinning
|
||||
/// <inheritdoc cref="ISkinnableTarget"/>
|
||||
/// <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(ISkinnableDrawable component)
|
||||
public void Add(ISerialisableDrawable component)
|
||||
{
|
||||
if (content == null)
|
||||
throw new NotSupportedException("Attempting to add a new component to a target container which is not supported by the current skin.");
|
||||
@ -94,7 +94,7 @@ namespace osu.Game.Skinning
|
||||
/// <inheritdoc cref="ISkinnableTarget"/>
|
||||
/// <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(ISkinnableDrawable component)
|
||||
public void Remove(ISerialisableDrawable component)
|
||||
{
|
||||
if (content == null)
|
||||
throw new NotSupportedException("Attempting to remove a new component from a target container which is not supported by the current skin.");
|
||||
|
Loading…
Reference in New Issue
Block a user