mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Merge pull request #22290 from mk56-spn/judgement_fix
Fix JudgementCounterDisplay.cs max judgement not hiding upon display mode change
This commit is contained in:
@ -136,6 +136,17 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddAssert("Check max hidden", () => counterDisplay.CounterFlow.ChildrenOfType<JudgementCounter>().First().Alpha == 0);
|
AddAssert("Check max hidden", () => counterDisplay.CounterFlow.ChildrenOfType<JudgementCounter>().First().Alpha == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMaxValueHiddenOnModeChange()
|
||||||
|
{
|
||||||
|
AddStep("create counter", () => Child = counterDisplay = new TestJudgementCounterDisplay());
|
||||||
|
|
||||||
|
AddStep("Set max judgement to hide itself", () => counterDisplay.ShowMaxJudgement.Value = false);
|
||||||
|
AddStep("Show all judgements", () => counterDisplay.Mode.Value = JudgementCounterDisplay.DisplayMode.All);
|
||||||
|
AddWaitStep("wait some", 2);
|
||||||
|
AddAssert("Assert max judgement hidden", () => counterDisplay.CounterFlow.ChildrenOfType<JudgementCounter>().First().Alpha == 0);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestCycleDisplayModes()
|
public void TestCycleDisplayModes()
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -66,29 +65,27 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
|
|||||||
counter.Direction.Value = convertedDirection;
|
counter.Direction.Value = convertedDirection;
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
Mode.BindValueChanged(_ => updateMode(), true);
|
Mode.BindValueChanged(_ => updateDisplay());
|
||||||
|
ShowMaxJudgement.BindValueChanged(_ => updateDisplay(), true);
|
||||||
ShowMaxJudgement.BindValueChanged(showMax =>
|
|
||||||
{
|
|
||||||
var firstChild = CounterFlow.Children.FirstOrDefault();
|
|
||||||
|
|
||||||
if (firstChild != null)
|
|
||||||
firstChild.State.Value = showMax.NewValue ? Visibility.Visible : Visibility.Hidden;
|
|
||||||
}, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMode()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
foreach (var counter in CounterFlow.Children)
|
for (int i = 0; i < CounterFlow.Children.Count; i++)
|
||||||
{
|
{
|
||||||
if (shouldShow(counter))
|
JudgementCounter counter = CounterFlow.Children[i];
|
||||||
|
|
||||||
|
if (shouldShow(i, counter))
|
||||||
counter.Show();
|
counter.Show();
|
||||||
else
|
else
|
||||||
counter.Hide();
|
counter.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shouldShow(JudgementCounter counter)
|
bool shouldShow(int index, JudgementCounter counter)
|
||||||
{
|
{
|
||||||
|
if (index == 0 && !ShowMaxJudgement.Value)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (counter.Result.Type.IsBasic())
|
if (counter.Result.Type.IsBasic())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user