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

Use framework Direction instead of local enum

It should be stable enough to use.
This commit is contained in:
Dean Herbert 2023-01-17 18:21:30 +09:00
parent 0a7d6948ca
commit f923dc5009
2 changed files with 16 additions and 23 deletions

View File

@ -94,8 +94,8 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
public void TestChangeFlowDirection()
{
AddStep("Set direction vertical", () => counterDisplay.FlowDirection.Value = JudgementCounterDisplay.Flow.Vertical);
AddStep("Set direction horizontal", () => counterDisplay.FlowDirection.Value = JudgementCounterDisplay.Flow.Horizontal);
AddStep("Set direction vertical", () => counterDisplay.FlowDirection.Value = Direction.Vertical);
AddStep("Set direction horizontal", () => counterDisplay.FlowDirection.Value = Direction.Horizontal);
}
[Test]

View File

@ -23,7 +23,7 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
public Bindable<DisplayMode> Mode { get; set; } = new Bindable<DisplayMode>();
[SettingSource("Counter direction")]
public Bindable<Flow> FlowDirection { get; set; } = new Bindable<Flow>();
public Bindable<Direction> FlowDirection { get; set; } = new Bindable<Direction>();
[SettingSource("Show judgement names")]
public BindableBool ShowName { get; set; } = new BindableBool(true);
@ -42,7 +42,7 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
AutoSizeAxes = Axes.Both;
InternalChild = JudgementContainer = new FillFlowContainer
{
Direction = getFlow(FlowDirection.Value),
Direction = getFillDirection(FlowDirection.Value),
Spacing = new Vector2(10),
AutoSizeAxes = Axes.Both
};
@ -57,11 +57,11 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
FlowDirection.BindValueChanged(direction =>
{
JudgementContainer.Direction = getFlow(direction.NewValue);
JudgementContainer.Direction = getFillDirection(direction.NewValue);
//Can't pass directly due to Enum conversion
foreach (var counter in JudgementContainer.Children.OfType<JudgementCounter>())
counter.Direction.Value = getFlow(direction.NewValue);
counter.Direction.Value = getFillDirection(direction.NewValue);
}, true);
Mode.BindValueChanged(_ => updateMode(), true);
ShowMax.BindValueChanged(value =>
@ -95,14 +95,14 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
}
}
private FillDirection getFlow(Flow flow)
private FillDirection getFillDirection(Direction flow)
{
switch (flow)
{
case Flow.Horizontal:
case Direction.Horizontal:
return FillDirection.Horizontal;
case Flow.Vertical:
case Direction.Vertical:
return FillDirection.Vertical;
default:
@ -110,20 +110,6 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
}
}
//Used to hide default full option in FillDirection
public enum Flow
{
Horizontal,
Vertical
}
public enum DisplayMode
{
Simple,
Normal,
All
}
private JudgementCounter createCounter(JudgementTally.JudgementCount info)
{
JudgementCounter counter = new JudgementCounter(info)
@ -133,5 +119,12 @@ namespace osu.Game.Screens.Play.HUD.JudgementCounter
};
return counter;
}
public enum DisplayMode
{
Simple,
Normal,
All
}
}
}