mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 09:57:21 +09:00
Give flow container a type to avoid locally casting in every location
This commit is contained in:
parent
09c7ab3af6
commit
35ad66eef9
@ -103,10 +103,10 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
AddStep("Hide judgement names", () => counterDisplay.ShowJudgementNames.Value = false);
|
AddStep("Hide judgement names", () => counterDisplay.ShowJudgementNames.Value = false);
|
||||||
AddWaitStep("wait some", 2);
|
AddWaitStep("wait some", 2);
|
||||||
AddAssert("Assert hidden", () => counterDisplay.JudgementContainer.Children.OfType<JudgementCounter>().First().ResultName.Alpha == 0);
|
AddAssert("Assert hidden", () => counterDisplay.JudgementContainer.Children.First().ResultName.Alpha == 0);
|
||||||
AddStep("Hide judgement names", () => counterDisplay.ShowJudgementNames.Value = true);
|
AddStep("Hide judgement names", () => counterDisplay.ShowJudgementNames.Value = true);
|
||||||
AddWaitStep("wait some", 2);
|
AddWaitStep("wait some", 2);
|
||||||
AddAssert("Assert shown", () => counterDisplay.JudgementContainer.Children.OfType<JudgementCounter>().First().ResultName.Alpha == 1);
|
AddAssert("Assert shown", () => counterDisplay.JudgementContainer.Children.First().ResultName.Alpha == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -132,13 +132,13 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
private int hiddenCount()
|
private int hiddenCount()
|
||||||
{
|
{
|
||||||
var num = counterDisplay.JudgementContainer.Children.OfType<JudgementCounter>().First(child => child.Result.Type == HitResult.LargeTickHit);
|
var num = counterDisplay.JudgementContainer.Children.First(child => child.Result.Type == HitResult.LargeTickHit);
|
||||||
return num.Result.ResultCount.Value;
|
return num.Result.ResultCount.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private partial class TestJudgementCounterDisplay : JudgementCounterDisplay
|
private partial class TestJudgementCounterDisplay : JudgementCounterDisplay
|
||||||
{
|
{
|
||||||
public new FillFlowContainer JudgementContainer => base.JudgementContainer;
|
public new FillFlowContainer<JudgementCounter> JudgementContainer => base.JudgementContainer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,13 +34,13 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private JudgementTally tally { get; set; } = null!;
|
private JudgementTally tally { get; set; } = null!;
|
||||||
|
|
||||||
protected FillFlowContainer JudgementContainer = null!;
|
protected FillFlowContainer<JudgementCounter> JudgementContainer = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
InternalChild = JudgementContainer = new FillFlowContainer
|
InternalChild = JudgementContainer = new FillFlowContainer<JudgementCounter>
|
||||||
{
|
{
|
||||||
Direction = getFillDirection(FlowDirection.Value),
|
Direction = getFillDirection(FlowDirection.Value),
|
||||||
Spacing = new Vector2(10),
|
Spacing = new Vector2(10),
|
||||||
@ -60,7 +60,7 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
|
|||||||
JudgementContainer.Direction = getFillDirection(direction.NewValue);
|
JudgementContainer.Direction = getFillDirection(direction.NewValue);
|
||||||
|
|
||||||
//Can't pass directly due to Enum conversion
|
//Can't pass directly due to Enum conversion
|
||||||
foreach (var counter in JudgementContainer.Children.OfType<JudgementCounter>())
|
foreach (var counter in JudgementContainer.Children)
|
||||||
counter.Direction.Value = getFillDirection(direction.NewValue);
|
counter.Direction.Value = getFillDirection(direction.NewValue);
|
||||||
}, true);
|
}, true);
|
||||||
Mode.BindValueChanged(_ => updateMode(), true);
|
Mode.BindValueChanged(_ => updateMode(), true);
|
||||||
@ -73,7 +73,7 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
|
|||||||
|
|
||||||
private void updateMode()
|
private void updateMode()
|
||||||
{
|
{
|
||||||
foreach (var counter in JudgementContainer.Children.OfType<JudgementCounter>().Where(counter => !counter.Result.Type.IsBasic()))
|
foreach (var counter in JudgementContainer.Children.Where(counter => !counter.Result.Type.IsBasic()))
|
||||||
{
|
{
|
||||||
switch (Mode.Value)
|
switch (Mode.Value)
|
||||||
{
|
{
|
||||||
@ -110,15 +110,12 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private JudgementCounter createCounter(JudgementTally.JudgementCount info)
|
private JudgementCounter createCounter(JudgementTally.JudgementCount info) =>
|
||||||
{
|
new JudgementCounter(info)
|
||||||
JudgementCounter counter = new JudgementCounter(info)
|
|
||||||
{
|
{
|
||||||
State = { Value = Visibility.Visible },
|
State = { Value = Visibility.Visible },
|
||||||
ShowName = { BindTarget = ShowJudgementNames }
|
ShowName = { BindTarget = ShowJudgementNames }
|
||||||
};
|
};
|
||||||
return counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum DisplayMode
|
public enum DisplayMode
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user