1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 02:13:21 +08:00

Rename flow to better match its purpose

This commit is contained in:
Dean Herbert 2023-01-17 18:28:08 +09:00
parent 35ad66eef9
commit 181473c5fc
2 changed files with 14 additions and 14 deletions

View File

@ -103,10 +103,10 @@ namespace osu.Game.Tests.Visual.Gameplay
{
AddStep("Hide judgement names", () => counterDisplay.ShowJudgementNames.Value = false);
AddWaitStep("wait some", 2);
AddAssert("Assert hidden", () => counterDisplay.JudgementContainer.Children.First().ResultName.Alpha == 0);
AddAssert("Assert hidden", () => counterDisplay.CounterFlow.Children.First().ResultName.Alpha == 0);
AddStep("Hide judgement names", () => counterDisplay.ShowJudgementNames.Value = true);
AddWaitStep("wait some", 2);
AddAssert("Assert shown", () => counterDisplay.JudgementContainer.Children.First().ResultName.Alpha == 1);
AddAssert("Assert shown", () => counterDisplay.CounterFlow.Children.First().ResultName.Alpha == 1);
}
[Test]
@ -114,7 +114,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{
AddStep("Hide max judgement", () => counterDisplay.ShowMaxJudgement.Value = false);
AddWaitStep("wait some", 2);
AddAssert("Check max hidden", () => counterDisplay.JudgementContainer.ChildrenOfType<JudgementCounter>().First().Alpha == 0);
AddAssert("Check max hidden", () => counterDisplay.CounterFlow.ChildrenOfType<JudgementCounter>().First().Alpha == 0);
AddStep("Show max judgement", () => counterDisplay.ShowMaxJudgement.Value = true);
}
@ -123,22 +123,22 @@ namespace osu.Game.Tests.Visual.Gameplay
{
AddStep("Show basic judgements", () => counterDisplay.Mode.Value = JudgementCounterDisplay.DisplayMode.Simple);
AddWaitStep("wait some", 2);
AddAssert("Check only basic", () => counterDisplay.JudgementContainer.ChildrenOfType<JudgementCounter>().Last().Alpha == 0);
AddAssert("Check only basic", () => counterDisplay.CounterFlow.ChildrenOfType<JudgementCounter>().Last().Alpha == 0);
AddStep("Show normal judgements", () => counterDisplay.Mode.Value = JudgementCounterDisplay.DisplayMode.Normal);
AddStep("Show all judgements", () => counterDisplay.Mode.Value = JudgementCounterDisplay.DisplayMode.All);
AddWaitStep("wait some", 2);
AddAssert("Check all visible", () => counterDisplay.JudgementContainer.ChildrenOfType<JudgementCounter>().Last().Alpha == 1);
AddAssert("Check all visible", () => counterDisplay.CounterFlow.ChildrenOfType<JudgementCounter>().Last().Alpha == 1);
}
private int hiddenCount()
{
var num = counterDisplay.JudgementContainer.Children.First(child => child.Result.Type == HitResult.LargeTickHit);
var num = counterDisplay.CounterFlow.Children.First(child => child.Result.Type == HitResult.LargeTickHit);
return num.Result.ResultCount.Value;
}
private partial class TestJudgementCounterDisplay : JudgementCounterDisplay
{
public new FillFlowContainer<JudgementCounter> JudgementContainer => base.JudgementContainer;
public new FillFlowContainer<JudgementCounter> CounterFlow => base.CounterFlow;
}
}
}

View File

@ -34,13 +34,13 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
[Resolved]
private JudgementTally tally { get; set; } = null!;
protected FillFlowContainer<JudgementCounter> JudgementContainer = null!;
protected FillFlowContainer<JudgementCounter> CounterFlow = null!;
[BackgroundDependencyLoader]
private void load()
{
AutoSizeAxes = Axes.Both;
InternalChild = JudgementContainer = new FillFlowContainer<JudgementCounter>
InternalChild = CounterFlow = new FillFlowContainer<JudgementCounter>
{
Direction = getFillDirection(FlowDirection.Value),
Spacing = new Vector2(10),
@ -48,7 +48,7 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
};
foreach (var result in tally.Results)
JudgementContainer.Add(createCounter(result));
CounterFlow.Add(createCounter(result));
}
protected override void LoadComplete()
@ -57,23 +57,23 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
FlowDirection.BindValueChanged(direction =>
{
JudgementContainer.Direction = getFillDirection(direction.NewValue);
CounterFlow.Direction = getFillDirection(direction.NewValue);
//Can't pass directly due to Enum conversion
foreach (var counter in JudgementContainer.Children)
foreach (var counter in CounterFlow.Children)
counter.Direction.Value = getFillDirection(direction.NewValue);
}, true);
Mode.BindValueChanged(_ => updateMode(), true);
ShowMaxJudgement.BindValueChanged(value =>
{
var firstChild = JudgementContainer.Children.FirstOrDefault();
var firstChild = CounterFlow.Children.FirstOrDefault();
firstChild.FadeTo(value.NewValue ? 1 : 0, TRANSFORM_DURATION, Easing.OutQuint);
}, true);
}
private void updateMode()
{
foreach (var counter in JudgementContainer.Children.Where(counter => !counter.Result.Type.IsBasic()))
foreach (var counter in CounterFlow.Children.Where(counter => !counter.Result.Type.IsBasic()))
{
switch (Mode.Value)
{