Merge pull request #26649 from peppy/fix-more-allocations

Remove `FillFlow` overhead of argon counters
This commit is contained in:
Bartłomiej Dach 2024-01-22 12:57:16 +01:00 committed by GitHub
commit 0d6c681275
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,35 +42,30 @@ namespace osu.Game.Screens.Play.HUD
Origin = anchor; Origin = anchor;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
InternalChild = new FillFlowContainer InternalChildren = new Drawable[]
{ {
AutoSizeAxes = Axes.Both, labelText = new OsuSpriteText
Direction = FillDirection.Vertical,
Children = new Drawable[]
{ {
labelText = new OsuSpriteText Alpha = 0,
Text = label.GetValueOrDefault(),
Font = OsuFont.Torus.With(size: 12, weight: FontWeight.Bold),
Margin = new MarginPadding { Left = 2.5f },
},
NumberContainer = new Container
{
AutoSizeAxes = Axes.Both,
Children = new[]
{ {
Alpha = 0, wireframesPart = new ArgonCounterSpriteText(wireframesLookup)
Text = label.GetValueOrDefault(),
Font = OsuFont.Torus.With(size: 12, weight: FontWeight.Bold),
Margin = new MarginPadding { Left = 2.5f },
},
NumberContainer = new Container
{
AutoSizeAxes = Axes.Both,
Children = new[]
{ {
wireframesPart = new ArgonCounterSpriteText(wireframesLookup) Anchor = anchor,
{ Origin = anchor,
Anchor = anchor, },
Origin = anchor, textPart = new ArgonCounterSpriteText(textLookup)
}, {
textPart = new ArgonCounterSpriteText(textLookup) Anchor = anchor,
{ Origin = anchor,
Anchor = anchor, },
Origin = anchor,
},
}
} }
} }
}; };
@ -110,7 +105,11 @@ namespace osu.Game.Screens.Play.HUD
{ {
base.LoadComplete(); base.LoadComplete();
WireframeOpacity.BindValueChanged(v => wireframesPart.Alpha = v.NewValue, true); WireframeOpacity.BindValueChanged(v => wireframesPart.Alpha = v.NewValue, true);
ShowLabel.BindValueChanged(s => labelText.Alpha = s.NewValue ? 1 : 0, true); ShowLabel.BindValueChanged(s =>
{
labelText.Alpha = s.NewValue ? 1 : 0;
NumberContainer.Y = s.NewValue ? 12 : 0;
}, true);
} }
private partial class ArgonCounterSpriteText : OsuSpriteText private partial class ArgonCounterSpriteText : OsuSpriteText