1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 05:53:10 +08:00

Rename ISkinnableComponent to ISkinnableDrawable

This commit is contained in:
Dean Herbert 2021-05-13 17:06:00 +09:00
parent cdcd31b546
commit 7921dc7ece
18 changed files with 40 additions and 40 deletions

View File

@ -7,7 +7,7 @@ using osu.Game.Skinning;
namespace osu.Game.Screens.Play.HUD namespace osu.Game.Screens.Play.HUD
{ {
public class DefaultAccuracyCounter : GameplayAccuracyCounter, ISkinnableComponent public class DefaultAccuracyCounter : GameplayAccuracyCounter, ISkinnableDrawable
{ {
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
private HUDOverlay hud { get; set; } private HUDOverlay hud { get; set; }

View File

@ -12,7 +12,7 @@ using osu.Game.Skinning;
namespace osu.Game.Screens.Play.HUD namespace osu.Game.Screens.Play.HUD
{ {
public class DefaultComboCounter : RollingCounter<int>, ISkinnableComponent public class DefaultComboCounter : RollingCounter<int>, ISkinnableDrawable
{ {
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
private HUDOverlay hud { get; set; } private HUDOverlay hud { get; set; }

View File

@ -17,7 +17,7 @@ using osu.Game.Skinning;
namespace osu.Game.Screens.Play.HUD namespace osu.Game.Screens.Play.HUD
{ {
public class DefaultHealthDisplay : HealthDisplay, IHasAccentColour, ISkinnableComponent public class DefaultHealthDisplay : HealthDisplay, IHasAccentColour, ISkinnableDrawable
{ {
/// <summary> /// <summary>
/// The base opacity of the glow. /// The base opacity of the glow.

View File

@ -8,7 +8,7 @@ using osu.Game.Skinning;
namespace osu.Game.Screens.Play.HUD namespace osu.Game.Screens.Play.HUD
{ {
public class DefaultScoreCounter : GameplayScoreCounter, ISkinnableComponent public class DefaultScoreCounter : GameplayScoreCounter, ISkinnableDrawable
{ {
public DefaultScoreCounter() public DefaultScoreCounter()
: base(6) : base(6)

View File

@ -15,7 +15,7 @@ namespace osu.Game.Screens.Play.HUD
/// <summary> /// <summary>
/// Uses the 'x' symbol and has a pop-out effect while rolling over. /// Uses the 'x' symbol and has a pop-out effect while rolling over.
/// </summary> /// </summary>
public class LegacyComboCounter : CompositeDrawable, ISkinnableComponent public class LegacyComboCounter : CompositeDrawable, ISkinnableDrawable
{ {
public Bindable<int> Current { get; } = new BindableInt { MinValue = 0, }; public Bindable<int> Current { get; } = new BindableInt { MinValue = 0, };

View File

@ -15,7 +15,7 @@ using osuTK;
namespace osu.Game.Screens.Play.HUD namespace osu.Game.Screens.Play.HUD
{ {
/// <summary> /// <summary>
/// Serialised information governing custom changes to an <see cref="ISkinnableComponent"/>. /// Serialised information governing custom changes to an <see cref="ISkinnableDrawable"/>.
/// </summary> /// </summary>
[Serializable] [Serializable]
public class SkinnableInfo : IJsonSerializable public class SkinnableInfo : IJsonSerializable
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Play.HUD
if (component is Container<Drawable> container) if (component is Container<Drawable> container)
{ {
foreach (var child in container.OfType<ISkinnableComponent>().OfType<Drawable>()) foreach (var child in container.OfType<ISkinnableDrawable>().OfType<Drawable>())
Children.Add(child.CreateSkinnableInfo()); Children.Add(child.CreateSkinnableInfo());
} }
} }

View File

@ -13,7 +13,7 @@ using osuTK;
namespace osu.Game.Skinning.Editor namespace osu.Game.Skinning.Editor
{ {
public class SkinBlueprint : SelectionBlueprint<ISkinnableComponent> public class SkinBlueprint : SelectionBlueprint<ISkinnableDrawable>
{ {
private Container box; private Container box;
@ -26,7 +26,7 @@ namespace osu.Game.Skinning.Editor
protected override bool ShouldBeAlive => (drawable.IsAlive && Item.IsPresent) || (AlwaysShowWhenSelected && State == SelectionState.Selected); protected override bool ShouldBeAlive => (drawable.IsAlive && Item.IsPresent) || (AlwaysShowWhenSelected && State == SelectionState.Selected);
public SkinBlueprint(ISkinnableComponent component) public SkinBlueprint(ISkinnableDrawable component)
: base(component) : base(component)
{ {
} }

View File

@ -15,11 +15,11 @@ using osu.Game.Screens.Edit.Compose.Components;
namespace osu.Game.Skinning.Editor namespace osu.Game.Skinning.Editor
{ {
public class SkinBlueprintContainer : BlueprintContainer<ISkinnableComponent> public class SkinBlueprintContainer : BlueprintContainer<ISkinnableDrawable>
{ {
private readonly Drawable target; private readonly Drawable target;
private readonly List<BindableList<ISkinnableComponent>> targetComponents = new List<BindableList<ISkinnableComponent>>(); private readonly List<BindableList<ISkinnableDrawable>> targetComponents = new List<BindableList<ISkinnableDrawable>>();
public SkinBlueprintContainer(Drawable target) public SkinBlueprintContainer(Drawable target)
{ {
@ -49,7 +49,7 @@ namespace osu.Game.Skinning.Editor
foreach (var targetContainer in targetContainers) foreach (var targetContainer in targetContainers)
{ {
var bindableList = new BindableList<ISkinnableComponent> { BindTarget = targetContainer.Components }; var bindableList = new BindableList<ISkinnableDrawable> { BindTarget = targetContainer.Components };
bindableList.BindCollectionChanged(componentsChanged, true); bindableList.BindCollectionChanged(componentsChanged, true);
targetComponents.Add(bindableList); targetComponents.Add(bindableList);
@ -61,27 +61,27 @@ namespace osu.Game.Skinning.Editor
switch (e.Action) switch (e.Action)
{ {
case NotifyCollectionChangedAction.Add: case NotifyCollectionChangedAction.Add:
foreach (var item in e.NewItems.Cast<ISkinnableComponent>()) foreach (var item in e.NewItems.Cast<ISkinnableDrawable>())
AddBlueprintFor(item); AddBlueprintFor(item);
break; break;
case NotifyCollectionChangedAction.Remove: case NotifyCollectionChangedAction.Remove:
case NotifyCollectionChangedAction.Reset: case NotifyCollectionChangedAction.Reset:
foreach (var item in e.OldItems.Cast<ISkinnableComponent>()) foreach (var item in e.OldItems.Cast<ISkinnableDrawable>())
RemoveBlueprintFor(item); RemoveBlueprintFor(item);
break; break;
case NotifyCollectionChangedAction.Replace: case NotifyCollectionChangedAction.Replace:
foreach (var item in e.OldItems.Cast<ISkinnableComponent>()) foreach (var item in e.OldItems.Cast<ISkinnableDrawable>())
RemoveBlueprintFor(item); RemoveBlueprintFor(item);
foreach (var item in e.NewItems.Cast<ISkinnableComponent>()) foreach (var item in e.NewItems.Cast<ISkinnableDrawable>())
AddBlueprintFor(item); AddBlueprintFor(item);
break; break;
} }
} }
protected override void AddBlueprintFor(ISkinnableComponent item) protected override void AddBlueprintFor(ISkinnableDrawable item)
{ {
if (!item.IsEditable) if (!item.IsEditable)
return; return;
@ -89,9 +89,9 @@ namespace osu.Game.Skinning.Editor
base.AddBlueprintFor(item); base.AddBlueprintFor(item);
} }
protected override SelectionHandler<ISkinnableComponent> CreateSelectionHandler() => new SkinSelectionHandler(); protected override SelectionHandler<ISkinnableDrawable> CreateSelectionHandler() => new SkinSelectionHandler();
protected override SelectionBlueprint<ISkinnableComponent> CreateBlueprintFor(ISkinnableComponent component) protected override SelectionBlueprint<ISkinnableDrawable> CreateBlueprintFor(ISkinnableDrawable component)
=> new SkinBlueprint(component); => new SkinBlueprint(component);
} }
} }

View File

@ -56,7 +56,7 @@ namespace osu.Game.Skinning.Editor
Spacing = new Vector2(20) Spacing = new Vector2(20)
}; };
var skinnableTypes = typeof(OsuGame).Assembly.GetTypes().Where(t => typeof(ISkinnableComponent).IsAssignableFrom(t)).ToArray(); var skinnableTypes = typeof(OsuGame).Assembly.GetTypes().Where(t => typeof(ISkinnableDrawable).IsAssignableFrom(t)).ToArray();
foreach (var type in skinnableTypes) foreach (var type in skinnableTypes)
{ {
@ -78,7 +78,7 @@ namespace osu.Game.Skinning.Editor
Debug.Assert(instance != null); Debug.Assert(instance != null);
if (!((ISkinnableComponent)instance).IsEditable) if (!((ISkinnableDrawable)instance).IsEditable)
return null; return null;
return new ToolboxComponentButton(instance); return new ToolboxComponentButton(instance);

View File

@ -22,7 +22,7 @@ namespace osu.Game.Skinning.Editor
{ {
public const double TRANSITION_DURATION = 500; public const double TRANSITION_DURATION = 500;
public readonly BindableList<ISkinnableComponent> SelectedComponents = new BindableList<ISkinnableComponent>(); public readonly BindableList<ISkinnableDrawable> SelectedComponents = new BindableList<ISkinnableDrawable>();
protected override bool StartHidden => true; protected override bool StartHidden => true;
@ -165,7 +165,7 @@ namespace osu.Game.Skinning.Editor
private void placeComponent(Type type) private void placeComponent(Type type)
{ {
if (!(Activator.CreateInstance(type) is ISkinnableComponent component)) if (!(Activator.CreateInstance(type) is ISkinnableDrawable component))
throw new InvalidOperationException("Attempted to instantiate a component for placement which was not an {typeof(ISkinnableComponent)}."); throw new InvalidOperationException("Attempted to instantiate a component for placement which was not an {typeof(ISkinnableComponent)}.");
getTarget(SkinnableTarget.MainHUDComponents)?.Add(component); getTarget(SkinnableTarget.MainHUDComponents)?.Add(component);

View File

@ -14,7 +14,7 @@ using osuTK;
namespace osu.Game.Skinning.Editor namespace osu.Game.Skinning.Editor
{ {
public class SkinSelectionHandler : SelectionHandler<ISkinnableComponent> public class SkinSelectionHandler : SelectionHandler<ISkinnableDrawable>
{ {
public override bool HandleRotation(float angle) public override bool HandleRotation(float angle)
{ {
@ -36,7 +36,7 @@ namespace osu.Game.Skinning.Editor
return true; return true;
} }
public override bool HandleMovement(MoveSelectionEvent<ISkinnableComponent> moveEvent) public override bool HandleMovement(MoveSelectionEvent<ISkinnableDrawable> moveEvent)
{ {
foreach (var c in SelectedBlueprints) foreach (var c in SelectedBlueprints)
{ {
@ -57,7 +57,7 @@ namespace osu.Game.Skinning.Editor
SelectionBox.CanReverse = false; SelectionBox.CanReverse = false;
} }
protected override void DeleteItems(IEnumerable<ISkinnableComponent> items) protected override void DeleteItems(IEnumerable<ISkinnableDrawable> items)
{ {
foreach (var i in items) foreach (var i in items)
{ {
@ -66,7 +66,7 @@ namespace osu.Game.Skinning.Editor
} }
} }
protected override IEnumerable<MenuItem> GetContextMenuItemsForSelection(IEnumerable<SelectionBlueprint<ISkinnableComponent>> selection) protected override IEnumerable<MenuItem> GetContextMenuItemsForSelection(IEnumerable<SelectionBlueprint<ISkinnableDrawable>> selection)
{ {
yield return new OsuMenuItem("Anchor") yield return new OsuMenuItem("Anchor")
{ {
@ -131,7 +131,7 @@ namespace osu.Game.Skinning.Editor
public class AnchorMenuItem : TernaryStateMenuItem public class AnchorMenuItem : TernaryStateMenuItem
{ {
public AnchorMenuItem(Anchor anchor, IEnumerable<SelectionBlueprint<ISkinnableComponent>> selection, Action<TernaryState> action) public AnchorMenuItem(Anchor anchor, IEnumerable<SelectionBlueprint<ISkinnableDrawable>> selection, Action<TernaryState> action)
: base(anchor.ToString(), getNextState, MenuItemType.Standard, action) : base(anchor.ToString(), getNextState, MenuItemType.Standard, action)
{ {
} }

View File

@ -8,7 +8,7 @@ namespace osu.Game.Skinning
/// <summary> /// <summary>
/// Denotes a drawable which, as a drawable, can be adjusted via skinning specifications. /// Denotes a drawable which, as a drawable, can be adjusted via skinning specifications.
/// </summary> /// </summary>
public interface ISkinnableComponent : IDrawable public interface ISkinnableDrawable : IDrawable
{ {
/// <summary> /// <summary>
/// Whether this component should be editable by an end user. /// Whether this component should be editable by an end user.

View File

@ -6,7 +6,7 @@ using osu.Framework.Bindables;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
/// <summary> /// <summary>
/// Denotes a container which can house <see cref="ISkinnableComponent"/>s. /// Denotes a container which can house <see cref="ISkinnableDrawable"/>s.
/// </summary> /// </summary>
public interface ISkinnableTarget public interface ISkinnableTarget
{ {
@ -18,7 +18,7 @@ namespace osu.Game.Skinning
/// <summary> /// <summary>
/// A bindable list of components which are being tracked by this skinnable target. /// A bindable list of components which are being tracked by this skinnable target.
/// </summary> /// </summary>
IBindableList<ISkinnableComponent> Components { get; } IBindableList<ISkinnableDrawable> Components { get; }
/// <summary> /// <summary>
/// Reload this target from the current skin. /// Reload this target from the current skin.
@ -28,6 +28,6 @@ namespace osu.Game.Skinning
/// <summary> /// <summary>
/// Add the provided item to this target. /// Add the provided item to this target.
/// </summary> /// </summary>
void Add(ISkinnableComponent drawable); void Add(ISkinnableDrawable drawable);
} }
} }

View File

@ -10,7 +10,7 @@ using osuTK;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
public class LegacyAccuracyCounter : GameplayAccuracyCounter, ISkinnableComponent public class LegacyAccuracyCounter : GameplayAccuracyCounter, ISkinnableDrawable
{ {
public LegacyAccuracyCounter() public LegacyAccuracyCounter()
{ {

View File

@ -16,7 +16,7 @@ using osuTK.Graphics;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
public class LegacyHealthDisplay : HealthDisplay, ISkinnableComponent public class LegacyHealthDisplay : HealthDisplay, ISkinnableDrawable
{ {
private const double epic_cutoff = 0.5; private const double epic_cutoff = 0.5;

View File

@ -8,7 +8,7 @@ using osuTK;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
public class LegacyScoreCounter : GameplayScoreCounter, ISkinnableComponent public class LegacyScoreCounter : GameplayScoreCounter, ISkinnableDrawable
{ {
protected override double RollingDuration => 1000; protected override double RollingDuration => 1000;
protected override Easing RollingEasing => Easing.Out; protected override Easing RollingEasing => Easing.Out;

View File

@ -17,9 +17,9 @@ namespace osu.Game.Skinning
public SkinnableTarget Target { get; } public SkinnableTarget Target { get; }
public IBindableList<ISkinnableComponent> Components => components; public IBindableList<ISkinnableDrawable> Components => components;
private readonly BindableList<ISkinnableComponent> components = new BindableList<ISkinnableComponent>(); private readonly BindableList<ISkinnableDrawable> components = new BindableList<ISkinnableDrawable>();
public SkinnableElementTargetContainer(SkinnableTarget target) public SkinnableElementTargetContainer(SkinnableTarget target)
{ {
@ -41,7 +41,7 @@ namespace osu.Game.Skinning
LoadComponentAsync(content, wrapper => LoadComponentAsync(content, wrapper =>
{ {
AddInternal(wrapper); AddInternal(wrapper);
components.AddRange(wrapper.Children.OfType<ISkinnableComponent>()); components.AddRange(wrapper.Children.OfType<ISkinnableDrawable>());
}); });
} }
} }
@ -52,7 +52,7 @@ namespace osu.Game.Skinning
/// <param name="component">The component to add.</param> /// <param name="component">The component to add.</param>
/// <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(ISkinnableComponent component) public void Add(ISkinnableDrawable component)
{ {
if (content == null) if (content == null)
throw new NotSupportedException("Attempting to add a new component to a target container which is not supported by the current skin."); throw new NotSupportedException("Attempting to add a new component to a target container which is not supported by the current skin.");

View File

@ -13,7 +13,7 @@ namespace osu.Game.Skinning
/// Will also optionally apply default cross-element layout dependencies when initialised from a non-deserialised source. /// Will also optionally apply default cross-element layout dependencies when initialised from a non-deserialised source.
/// </summary> /// </summary>
[Serializable] [Serializable]
public class SkinnableTargetWrapper : Container, ISkinnableComponent public class SkinnableTargetWrapper : Container, ISkinnableDrawable
{ {
public bool IsEditable => false; public bool IsEditable => false;