Add UsingClosestAnchor to ISkinnableDrawable

Also implement it as an auto property in its inheritors.
The auto properties default to true.
This commit is contained in:
Robin Avery 2021-06-06 23:47:47 -04:00
parent 6a456e53f4
commit ce635af83e
No known key found for this signature in database
GPG Key ID: 0496DF10CEF7E226
13 changed files with 29 additions and 5 deletions

View File

@ -12,6 +12,8 @@ namespace osu.Game.Screens.Play.HUD
[Resolved(canBeNull: true)]
private HUDOverlay hud { get; set; }
public bool UsingClosestAnchor { get; set; } = true;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{

View File

@ -17,6 +17,8 @@ namespace osu.Game.Screens.Play.HUD
[Resolved(canBeNull: true)]
private HUDOverlay hud { get; set; }
public bool UsingClosestAnchor { get; set; } = true;
public DefaultComboCounter()
{
Current.Value = DisplayedCount = 0;

View File

@ -72,6 +72,8 @@ namespace osu.Game.Screens.Play.HUD
}
}
public bool UsingClosestAnchor { get; set; } = true;
public DefaultHealthDisplay()
{
Size = new Vector2(1, 5);

View File

@ -20,6 +20,8 @@ namespace osu.Game.Screens.Play.HUD
[Resolved(canBeNull: true)]
private HUDOverlay hud { get; set; }
public bool UsingClosestAnchor { get; set; } = true;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{

View File

@ -22,6 +22,8 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
[Resolved]
private OsuColour colours { get; set; }
public bool UsingClosestAnchor { get; set; } = true;
[BackgroundDependencyLoader(true)]
private void load(DrawableRuleset drawableRuleset)
{

View File

@ -59,6 +59,8 @@ namespace osu.Game.Screens.Play.HUD
set => counterContainer.Alpha = value ? 1 : 0;
}
public bool UsingClosestAnchor { get; set; } = true;
public LegacyComboCounter()
{
AutoSizeAxes = Axes.Both;

View File

@ -32,11 +32,7 @@ namespace osu.Game.Screens.Play.HUD
public Anchor Origin { get; set; }
/// <summary>
/// <p><see langword="true"/> if this <see cref="ISkinnableDrawable"/>'s <see cref="Drawable.Anchor"/> is
/// automatically determined by proximity, <see langword="false"/> if the user has overridden it.</p>
/// <p>Corresponds to <see cref="osu.Game.Extensions.DrawableExtensions.UsingClosestAnchor"/> at runtime.</p>
/// </summary>
/// <inheritdoc cref="ISkinnableDrawable.UsingClosestAnchor"/>
public bool UsingClosestAnchor { get; set; } = true;
public List<SkinnableInfo> Children { get; } = new List<SkinnableInfo>();

View File

@ -78,6 +78,8 @@ namespace osu.Game.Screens.Play
private IClock referenceClock;
public bool UsingClosestAnchor { get; set; } = true;
public SongProgress()
{
RelativeSizeAxes = Axes.X;

View File

@ -14,5 +14,11 @@ namespace osu.Game.Skinning
/// Whether this component should be editable by an end user.
/// </summary>
bool IsEditable => true;
/// <summary>
/// <see langword="true"/> if this <see cref="ISkinnableDrawable"/>'s <see cref="Drawable.Anchor"/> is automatically determined by proximity,
/// <see langword="false"/> if the user has overridden it.
/// </summary>
bool UsingClosestAnchor { get; set; }
}
}

View File

@ -12,6 +12,8 @@ namespace osu.Game.Skinning
{
public class LegacyAccuracyCounter : GameplayAccuracyCounter, ISkinnableDrawable
{
public bool UsingClosestAnchor { get; set; } = true;
public LegacyAccuracyCounter()
{
Anchor = Anchor.TopRight;

View File

@ -30,6 +30,8 @@ namespace osu.Game.Skinning
private bool isNewStyle;
public bool UsingClosestAnchor { get; set; } = true;
[BackgroundDependencyLoader]
private void load()
{

View File

@ -13,6 +13,8 @@ namespace osu.Game.Skinning
protected override double RollingDuration => 1000;
protected override Easing RollingEasing => Easing.Out;
public bool UsingClosestAnchor { get; set; } = true;
public LegacyScoreCounter()
: base(6)
{

View File

@ -17,6 +17,8 @@ namespace osu.Game.Skinning
{
public bool IsEditable => false;
public bool UsingClosestAnchor { get; set; } = true;
private readonly Action<Container> applyDefaults;
/// <summary>