mirror of https://github.com/ppy/osu
Hide "Full" option from counter flow directions
This commit is contained in:
parent
161894da3b
commit
a107fca5d0
|
@ -97,8 +97,8 @@ public void TestAddWhilstHidden()
|
|||
[Test]
|
||||
public void TestChangeFlowDirection()
|
||||
{
|
||||
AddStep("Set direction vertical", () => counter.Direction.Value = FillDirection.Vertical);
|
||||
AddStep("Set direction horizontal", () => counter.Direction.Value = FillDirection.Vertical);
|
||||
AddStep("Set direction vertical", () => counter.FlowDirection.Value = JudgementCounterDisplay.Flow.Vertical);
|
||||
AddStep("Set direction horizontal", () => counter.FlowDirection.Value = JudgementCounterDisplay.Flow.Horizonal);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -19,7 +19,7 @@ public partial class JudgementCounterDisplay : CompositeDrawable, ISkinnableDraw
|
|||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
[SettingSource("Counter direction")]
|
||||
public Bindable<FillDirection> Direction { get; set; } = new Bindable<FillDirection>();
|
||||
public Bindable<Flow> FlowDirection { get; set; } = new Bindable<Flow>();
|
||||
|
||||
[SettingSource("Show judgement names")]
|
||||
public BindableBool ShowName { get; set; } = new BindableBool(true);
|
||||
|
@ -40,7 +40,7 @@ private void load()
|
|||
{
|
||||
InternalChild = JudgementContainer = new FillFlowContainer
|
||||
{
|
||||
Direction = Direction.Value,
|
||||
Direction = getFlow(FlowDirection.Value),
|
||||
Spacing = new Vector2(10),
|
||||
AutoSizeAxes = Axes.Both
|
||||
};
|
||||
|
@ -61,9 +61,17 @@ protected override void LoadComplete()
|
|||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Direction.BindValueChanged(direction => JudgementContainer.Direction = direction.NewValue);
|
||||
Mode.BindValueChanged(_ => updateCounter(), true);
|
||||
FlowDirection.BindValueChanged(direction =>
|
||||
{
|
||||
JudgementContainer.Direction = getFlow(direction.NewValue);
|
||||
|
||||
//Can't pass directly due to Enum conversion
|
||||
foreach (var counter in JudgementContainer.Children.OfType<JudgementCounter>())
|
||||
{
|
||||
counter.Direction.Value = getFlow(direction.NewValue);
|
||||
}
|
||||
});
|
||||
Mode.BindValueChanged(_ => updateCounter(), true);
|
||||
ShowMax.BindValueChanged(value =>
|
||||
{
|
||||
var firstChild = JudgementContainer.Children.FirstOrDefault();
|
||||
|
@ -113,6 +121,28 @@ private void updateCounter()
|
|||
}
|
||||
}
|
||||
|
||||
private FillDirection getFlow(Flow flow)
|
||||
{
|
||||
switch (flow)
|
||||
{
|
||||
case Flow.Horizonal:
|
||||
return FillDirection.Horizontal;
|
||||
|
||||
case Flow.Vertical:
|
||||
return FillDirection.Vertical;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(flow), flow, @"Unsupported direction");
|
||||
}
|
||||
}
|
||||
|
||||
//Used to hide default full option in FillDirection
|
||||
public enum Flow
|
||||
{
|
||||
Horizonal,
|
||||
Vertical
|
||||
}
|
||||
|
||||
public enum DisplayMode
|
||||
{
|
||||
Simple,
|
||||
|
@ -125,7 +155,6 @@ private JudgementCounter createCounter(JudgementCounterInfo info)
|
|||
JudgementCounter counter = new JudgementCounter(info)
|
||||
{
|
||||
ShowName = { BindTarget = ShowName },
|
||||
Direction = { BindTarget = Direction }
|
||||
};
|
||||
return counter;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue