mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 13:23:05 +08:00
Merge pull request #27417 from bdach/fix-wireframe
Fix wireframe misalignment in argon accuracy counter
This commit is contained in:
commit
274ec633db
@ -75,21 +75,21 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Child = wholePart = new ArgonCounterTextComponent(Anchor.TopRight, BeatmapsetsStrings.ShowScoreboardHeadersAccuracy.ToUpper())
|
Child = wholePart = new ArgonCounterTextComponent(Anchor.TopRight, BeatmapsetsStrings.ShowScoreboardHeadersAccuracy.ToUpper())
|
||||||
{
|
{
|
||||||
RequiredDisplayDigits = { Value = 3 },
|
|
||||||
WireframeOpacity = { BindTarget = WireframeOpacity },
|
WireframeOpacity = { BindTarget = WireframeOpacity },
|
||||||
|
WireframeTemplate = @"###",
|
||||||
ShowLabel = { BindTarget = ShowLabel },
|
ShowLabel = { BindTarget = ShowLabel },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fractionPart = new ArgonCounterTextComponent(Anchor.TopLeft)
|
fractionPart = new ArgonCounterTextComponent(Anchor.TopLeft)
|
||||||
{
|
{
|
||||||
RequiredDisplayDigits = { Value = 2 },
|
|
||||||
WireframeOpacity = { BindTarget = WireframeOpacity },
|
WireframeOpacity = { BindTarget = WireframeOpacity },
|
||||||
|
WireframeTemplate = @".##",
|
||||||
Scale = new Vector2(0.5f),
|
Scale = new Vector2(0.5f),
|
||||||
},
|
},
|
||||||
percentText = new ArgonCounterTextComponent(Anchor.TopLeft)
|
percentText = new ArgonCounterTextComponent(Anchor.TopLeft)
|
||||||
{
|
{
|
||||||
Text = @"%",
|
Text = @"%",
|
||||||
RequiredDisplayDigits = { Value = 1 },
|
WireframeTemplate = @"#",
|
||||||
WireframeOpacity = { BindTarget = WireframeOpacity }
|
WireframeOpacity = { BindTarget = WireframeOpacity }
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,10 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
private void updateWireframe()
|
private void updateWireframe()
|
||||||
{
|
{
|
||||||
text.RequiredDisplayDigits.Value = getDigitsRequiredForDisplayCount();
|
int digitsRequiredForDisplayCount = getDigitsRequiredForDisplayCount();
|
||||||
|
|
||||||
|
if (digitsRequiredForDisplayCount != text.WireframeTemplate.Length)
|
||||||
|
text.WireframeTemplate = new string('#', digitsRequiredForDisplayCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getDigitsRequiredForDisplayCount()
|
private int getDigitsRequiredForDisplayCount()
|
||||||
|
@ -25,7 +25,6 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
private readonly OsuSpriteText labelText;
|
private readonly OsuSpriteText labelText;
|
||||||
|
|
||||||
public IBindable<float> WireframeOpacity { get; } = new BindableFloat();
|
public IBindable<float> WireframeOpacity { get; } = new BindableFloat();
|
||||||
public Bindable<int> RequiredDisplayDigits { get; } = new BindableInt();
|
|
||||||
public Bindable<bool> ShowLabel { get; } = new BindableBool();
|
public Bindable<bool> ShowLabel { get; } = new BindableBool();
|
||||||
|
|
||||||
public Container NumberContainer { get; private set; }
|
public Container NumberContainer { get; private set; }
|
||||||
@ -36,6 +35,18 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
set => textPart.Text = value;
|
set => textPart.Text = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The template for the wireframe displayed behind the <see cref="Text"/>.
|
||||||
|
/// Any character other than a dot is interpreted to mean a full segmented display "wireframe".
|
||||||
|
/// </summary>
|
||||||
|
public string WireframeTemplate
|
||||||
|
{
|
||||||
|
get => wireframeTemplate;
|
||||||
|
set => wireframesPart.Text = wireframeTemplate = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string wireframeTemplate = string.Empty;
|
||||||
|
|
||||||
public ArgonCounterTextComponent(Anchor anchor, LocalisableString? label = null)
|
public ArgonCounterTextComponent(Anchor anchor, LocalisableString? label = null)
|
||||||
{
|
{
|
||||||
Anchor = anchor;
|
Anchor = anchor;
|
||||||
@ -69,8 +80,6 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
RequiredDisplayDigits.BindValueChanged(digits => wireframesPart.Text = new string('#', digits.NewValue));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string textLookup(char c)
|
private string textLookup(char c)
|
||||||
|
@ -58,8 +58,10 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
private void updateWireframe()
|
private void updateWireframe()
|
||||||
{
|
{
|
||||||
scoreText.RequiredDisplayDigits.Value =
|
int digitsRequiredForDisplayCount = Math.Max(RequiredDisplayDigits.Value, getDigitsRequiredForDisplayCount());
|
||||||
Math.Max(RequiredDisplayDigits.Value, getDigitsRequiredForDisplayCount());
|
|
||||||
|
if (digitsRequiredForDisplayCount != scoreText.WireframeTemplate.Length)
|
||||||
|
scoreText.WireframeTemplate = new string('#', digitsRequiredForDisplayCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getDigitsRequiredForDisplayCount()
|
private int getDigitsRequiredForDisplayCount()
|
||||||
|
Loading…
Reference in New Issue
Block a user