Fix judgement counter not loading after first attempt in gameplay, Fix typo in Display

This commit is contained in:
mk56-spn 2022-12-12 10:52:55 +01:00
parent f0c780f1f6
commit 58bf081096
2 changed files with 13 additions and 17 deletions

View File

@ -98,7 +98,7 @@ public void TestAddWhilstHidden()
public void TestChangeFlowDirection()
{
AddStep("Set direction vertical", () => counter.FlowDirection.Value = JudgementCounterDisplay.Flow.Vertical);
AddStep("Set direction horizontal", () => counter.FlowDirection.Value = JudgementCounterDisplay.Flow.Horizonal);
AddStep("Set direction horizontal", () => counter.FlowDirection.Value = JudgementCounterDisplay.Flow.Horizontal);
}
[Test]

View File

@ -33,32 +33,28 @@ public partial class JudgementCounterDisplay : CompositeDrawable, ISkinnableDraw
[Resolved]
private JudgementTally tally { get; set; } = null!;
protected FillFlowContainer JudgementContainer = null!;
protected FillFlowContainer JudgementContainer;
[BackgroundDependencyLoader]
private void load()
public JudgementCounterDisplay()
{
AutoSizeAxes = Axes.Both;
InternalChild = JudgementContainer = new FillFlowContainer
{
Direction = getFlow(FlowDirection.Value),
Spacing = new Vector2(10),
AutoSizeAxes = Axes.Both
};
foreach (var result in tally.Results)
{
JudgementContainer.Add(createCounter(result));
}
}
protected override void Update()
{
Size = JudgementContainer.Size;
base.Update();
}
protected override void LoadComplete()
{
//Adding this in "load" will cause it to not load in properly after the first beatmap attempt. Or after existing and reentering.
//this does not happen in tests, or in the skin editor component preview button.
foreach (var result in tally.Results)
{
JudgementContainer.Add(createCounter(result));
}
base.LoadComplete();
FlowDirection.BindValueChanged(direction =>
@ -125,7 +121,7 @@ private FillDirection getFlow(Flow flow)
{
switch (flow)
{
case Flow.Horizonal:
case Flow.Horizontal:
return FillDirection.Horizontal;
case Flow.Vertical:
@ -139,7 +135,7 @@ private FillDirection getFlow(Flow flow)
//Used to hide default full option in FillDirection
public enum Flow
{
Horizonal,
Horizontal,
Vertical
}