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:
parent
cdcd31b546
commit
7921dc7ece
@ -7,7 +7,7 @@ using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class DefaultAccuracyCounter : GameplayAccuracyCounter, ISkinnableComponent
|
||||
public class DefaultAccuracyCounter : GameplayAccuracyCounter, ISkinnableDrawable
|
||||
{
|
||||
[Resolved(canBeNull: true)]
|
||||
private HUDOverlay hud { get; set; }
|
||||
|
@ -12,7 +12,7 @@ using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class DefaultComboCounter : RollingCounter<int>, ISkinnableComponent
|
||||
public class DefaultComboCounter : RollingCounter<int>, ISkinnableDrawable
|
||||
{
|
||||
[Resolved(canBeNull: true)]
|
||||
private HUDOverlay hud { get; set; }
|
||||
|
@ -17,7 +17,7 @@ using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class DefaultHealthDisplay : HealthDisplay, IHasAccentColour, ISkinnableComponent
|
||||
public class DefaultHealthDisplay : HealthDisplay, IHasAccentColour, ISkinnableDrawable
|
||||
{
|
||||
/// <summary>
|
||||
/// The base opacity of the glow.
|
||||
|
@ -8,7 +8,7 @@ using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class DefaultScoreCounter : GameplayScoreCounter, ISkinnableComponent
|
||||
public class DefaultScoreCounter : GameplayScoreCounter, ISkinnableDrawable
|
||||
{
|
||||
public DefaultScoreCounter()
|
||||
: base(6)
|
||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
/// <summary>
|
||||
/// Uses the 'x' symbol and has a pop-out effect while rolling over.
|
||||
/// </summary>
|
||||
public class LegacyComboCounter : CompositeDrawable, ISkinnableComponent
|
||||
public class LegacyComboCounter : CompositeDrawable, ISkinnableDrawable
|
||||
{
|
||||
public Bindable<int> Current { get; } = new BindableInt { MinValue = 0, };
|
||||
|
||||
|
@ -15,7 +15,7 @@ using osuTK;
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
/// <summary>
|
||||
/// Serialised information governing custom changes to an <see cref="ISkinnableComponent"/>.
|
||||
/// Serialised information governing custom changes to an <see cref="ISkinnableDrawable"/>.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class SkinnableInfo : IJsonSerializable
|
||||
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Skinning.Editor
|
||||
{
|
||||
public class SkinBlueprint : SelectionBlueprint<ISkinnableComponent>
|
||||
public class SkinBlueprint : SelectionBlueprint<ISkinnableDrawable>
|
||||
{
|
||||
private Container box;
|
||||
|
||||
@ -26,7 +26,7 @@ namespace osu.Game.Skinning.Editor
|
||||
|
||||
protected override bool ShouldBeAlive => (drawable.IsAlive && Item.IsPresent) || (AlwaysShowWhenSelected && State == SelectionState.Selected);
|
||||
|
||||
public SkinBlueprint(ISkinnableComponent component)
|
||||
public SkinBlueprint(ISkinnableDrawable component)
|
||||
: base(component)
|
||||
{
|
||||
}
|
||||
|
@ -15,11 +15,11 @@ using osu.Game.Screens.Edit.Compose.Components;
|
||||
|
||||
namespace osu.Game.Skinning.Editor
|
||||
{
|
||||
public class SkinBlueprintContainer : BlueprintContainer<ISkinnableComponent>
|
||||
public class SkinBlueprintContainer : BlueprintContainer<ISkinnableDrawable>
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -49,7 +49,7 @@ namespace osu.Game.Skinning.Editor
|
||||
|
||||
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);
|
||||
|
||||
targetComponents.Add(bindableList);
|
||||
@ -61,27 +61,27 @@ namespace osu.Game.Skinning.Editor
|
||||
switch (e.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
foreach (var item in e.NewItems.Cast<ISkinnableComponent>())
|
||||
foreach (var item in e.NewItems.Cast<ISkinnableDrawable>())
|
||||
AddBlueprintFor(item);
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
case NotifyCollectionChangedAction.Reset:
|
||||
foreach (var item in e.OldItems.Cast<ISkinnableComponent>())
|
||||
foreach (var item in e.OldItems.Cast<ISkinnableDrawable>())
|
||||
RemoveBlueprintFor(item);
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Replace:
|
||||
foreach (var item in e.OldItems.Cast<ISkinnableComponent>())
|
||||
foreach (var item in e.OldItems.Cast<ISkinnableDrawable>())
|
||||
RemoveBlueprintFor(item);
|
||||
|
||||
foreach (var item in e.NewItems.Cast<ISkinnableComponent>())
|
||||
foreach (var item in e.NewItems.Cast<ISkinnableDrawable>())
|
||||
AddBlueprintFor(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void AddBlueprintFor(ISkinnableComponent item)
|
||||
protected override void AddBlueprintFor(ISkinnableDrawable item)
|
||||
{
|
||||
if (!item.IsEditable)
|
||||
return;
|
||||
@ -89,9 +89,9 @@ namespace osu.Game.Skinning.Editor
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Skinning.Editor
|
||||
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)
|
||||
{
|
||||
@ -78,7 +78,7 @@ namespace osu.Game.Skinning.Editor
|
||||
|
||||
Debug.Assert(instance != null);
|
||||
|
||||
if (!((ISkinnableComponent)instance).IsEditable)
|
||||
if (!((ISkinnableDrawable)instance).IsEditable)
|
||||
return null;
|
||||
|
||||
return new ToolboxComponentButton(instance);
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Skinning.Editor
|
||||
{
|
||||
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;
|
||||
|
||||
@ -165,7 +165,7 @@ namespace osu.Game.Skinning.Editor
|
||||
|
||||
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)}.");
|
||||
|
||||
getTarget(SkinnableTarget.MainHUDComponents)?.Add(component);
|
||||
|
@ -14,7 +14,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Skinning.Editor
|
||||
{
|
||||
public class SkinSelectionHandler : SelectionHandler<ISkinnableComponent>
|
||||
public class SkinSelectionHandler : SelectionHandler<ISkinnableDrawable>
|
||||
{
|
||||
public override bool HandleRotation(float angle)
|
||||
{
|
||||
@ -36,7 +36,7 @@ namespace osu.Game.Skinning.Editor
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool HandleMovement(MoveSelectionEvent<ISkinnableComponent> moveEvent)
|
||||
public override bool HandleMovement(MoveSelectionEvent<ISkinnableDrawable> moveEvent)
|
||||
{
|
||||
foreach (var c in SelectedBlueprints)
|
||||
{
|
||||
@ -57,7 +57,7 @@ namespace osu.Game.Skinning.Editor
|
||||
SelectionBox.CanReverse = false;
|
||||
}
|
||||
|
||||
protected override void DeleteItems(IEnumerable<ISkinnableComponent> items)
|
||||
protected override void DeleteItems(IEnumerable<ISkinnableDrawable> 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")
|
||||
{
|
||||
@ -131,7 +131,7 @@ namespace osu.Game.Skinning.Editor
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace osu.Game.Skinning
|
||||
/// <summary>
|
||||
/// Denotes a drawable which, as a drawable, can be adjusted via skinning specifications.
|
||||
/// </summary>
|
||||
public interface ISkinnableComponent : IDrawable
|
||||
public interface ISkinnableDrawable : IDrawable
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether this component should be editable by an end user.
|
@ -6,7 +6,7 @@ using osu.Framework.Bindables;
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
/// <summary>
|
||||
/// Denotes a container which can house <see cref="ISkinnableComponent"/>s.
|
||||
/// Denotes a container which can house <see cref="ISkinnableDrawable"/>s.
|
||||
/// </summary>
|
||||
public interface ISkinnableTarget
|
||||
{
|
||||
@ -18,7 +18,7 @@ namespace osu.Game.Skinning
|
||||
/// <summary>
|
||||
/// A bindable list of components which are being tracked by this skinnable target.
|
||||
/// </summary>
|
||||
IBindableList<ISkinnableComponent> Components { get; }
|
||||
IBindableList<ISkinnableDrawable> Components { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Reload this target from the current skin.
|
||||
@ -28,6 +28,6 @@ namespace osu.Game.Skinning
|
||||
/// <summary>
|
||||
/// Add the provided item to this target.
|
||||
/// </summary>
|
||||
void Add(ISkinnableComponent drawable);
|
||||
void Add(ISkinnableDrawable drawable);
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public class LegacyAccuracyCounter : GameplayAccuracyCounter, ISkinnableComponent
|
||||
public class LegacyAccuracyCounter : GameplayAccuracyCounter, ISkinnableDrawable
|
||||
{
|
||||
public LegacyAccuracyCounter()
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public class LegacyHealthDisplay : HealthDisplay, ISkinnableComponent
|
||||
public class LegacyHealthDisplay : HealthDisplay, ISkinnableDrawable
|
||||
{
|
||||
private const double epic_cutoff = 0.5;
|
||||
|
||||
|
@ -8,7 +8,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public class LegacyScoreCounter : GameplayScoreCounter, ISkinnableComponent
|
||||
public class LegacyScoreCounter : GameplayScoreCounter, ISkinnableDrawable
|
||||
{
|
||||
protected override double RollingDuration => 1000;
|
||||
protected override Easing RollingEasing => Easing.Out;
|
||||
|
@ -17,9 +17,9 @@ namespace osu.Game.Skinning
|
||||
|
||||
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)
|
||||
{
|
||||
@ -41,7 +41,7 @@ namespace osu.Game.Skinning
|
||||
LoadComponentAsync(content, 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>
|
||||
/// <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(ISkinnableComponent component)
|
||||
public void Add(ISkinnableDrawable 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.");
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Skinning
|
||||
/// Will also optionally apply default cross-element layout dependencies when initialised from a non-deserialised source.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class SkinnableTargetWrapper : Container, ISkinnableComponent
|
||||
public class SkinnableTargetWrapper : Container, ISkinnableDrawable
|
||||
{
|
||||
public bool IsEditable => false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user