Merge pull request #16257 from bdach/catch-combo-counter-visible

Fix legacy combo counter not fully hiding for rulesets that implement their own
This commit is contained in:
Dan Balasescu 2021-12-27 17:53:17 +09:00 committed by GitHub
commit f7715b930f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 9 deletions

View File

@ -4,6 +4,7 @@
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play.HUD;
@ -24,5 +25,17 @@ public void TestComboCounterIncrementing()
AddStep("reset combo", () => scoreProcessor.Combo.Value = 0);
}
[Test]
public void TestLegacyComboCounterHiddenByRulesetImplementation()
{
AddToggleStep("toggle legacy hidden by ruleset", visible =>
{
foreach (var legacyCounter in this.ChildrenOfType<LegacyComboCounter>())
legacyCounter.HiddenByRulesetImplementation = visible;
});
AddRepeatStep("increase combo", () => scoreProcessor.Combo.Value++, 10);
}
}
}

View File

@ -68,6 +68,12 @@ public LegacyComboCounter()
Scale = new Vector2(1.2f);
InternalChildren = new[]
{
counterContainer = new Container
{
AutoSizeAxes = Axes.Both,
AlwaysPresent = true,
Children = new[]
{
popOutCount = new LegacySpriteText(LegacyFont.Combo)
{
@ -78,12 +84,6 @@ public LegacyComboCounter()
Origin = Anchor.BottomLeft,
BypassAutoSizeAxes = Axes.Both,
},
counterContainer = new Container
{
AutoSizeAxes = Axes.Both,
AlwaysPresent = true,
Children = new[]
{
displayedCountSpriteText = new LegacySpriteText(LegacyFont.Combo)
{
// Initial text and AlwaysPresent allow the counter to have a size before it first displays a combo.