mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 12:53:11 +08:00
Re-privatise buttons
This commit is contained in:
parent
7aafc018ad
commit
435c9de8b9
@ -79,11 +79,11 @@ namespace osu.Game.Tests.Visual.Settings
|
||||
|
||||
clickClearButton();
|
||||
|
||||
AddAssert("first binding cleared", () => string.IsNullOrEmpty(backBindingRow.Buttons.First().Text.Text));
|
||||
AddAssert("first binding cleared", () => string.IsNullOrEmpty(backBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().First().Text.Text));
|
||||
|
||||
AddStep("click second binding", () =>
|
||||
{
|
||||
var target = backBindingRow.Buttons.ElementAt(1);
|
||||
var target = backBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(1);
|
||||
|
||||
InputManager.MoveMouseTo(target);
|
||||
InputManager.Click(MouseButton.Left);
|
||||
@ -91,7 +91,7 @@ namespace osu.Game.Tests.Visual.Settings
|
||||
|
||||
clickClearButton();
|
||||
|
||||
AddAssert("second binding cleared", () => string.IsNullOrEmpty(backBindingRow.Buttons.ElementAt(1).Text.Text));
|
||||
AddAssert("second binding cleared", () => string.IsNullOrEmpty(backBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(1).Text.Text));
|
||||
|
||||
void clickClearButton()
|
||||
{
|
||||
@ -117,11 +117,11 @@ namespace osu.Game.Tests.Visual.Settings
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddAssert("first binding selected", () => backBindingRow.Buttons.First().IsBinding);
|
||||
AddAssert("first binding selected", () => backBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().First().IsBinding);
|
||||
|
||||
AddStep("click second binding", () =>
|
||||
{
|
||||
var target = backBindingRow.Buttons.ElementAt(1);
|
||||
var target = backBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(1);
|
||||
|
||||
InputManager.MoveMouseTo(target);
|
||||
InputManager.Click(MouseButton.Left);
|
||||
@ -134,7 +134,7 @@ namespace osu.Game.Tests.Visual.Settings
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddAssert("first binding selected", () => backBindingRow.Buttons.First().IsBinding);
|
||||
AddAssert("first binding selected", () => backBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().First().IsBinding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,8 +49,7 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
|
||||
private OsuSpriteText text;
|
||||
private FillFlowContainer cancelAndClearButtons;
|
||||
|
||||
public FillFlowContainer<KeyButton> Buttons;
|
||||
private FillFlowContainer<KeyButton> buttons;
|
||||
|
||||
public IEnumerable<string> FilterTerms => bindings.Select(b => b.KeyCombination.ReadableString()).Prepend((string)text.Text);
|
||||
|
||||
@ -93,7 +92,7 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
Text = action.GetDescription(),
|
||||
Margin = new MarginPadding(padding),
|
||||
},
|
||||
Buttons = new FillFlowContainer<KeyButton>
|
||||
buttons = new FillFlowContainer<KeyButton>
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.TopRight,
|
||||
@ -116,7 +115,7 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
};
|
||||
|
||||
foreach (var b in bindings)
|
||||
Buttons.Add(new KeyButton(b));
|
||||
buttons.Add(new KeyButton(b));
|
||||
}
|
||||
|
||||
public void RestoreDefaults()
|
||||
@ -125,7 +124,7 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
|
||||
foreach (var d in Defaults)
|
||||
{
|
||||
var button = Buttons[i++];
|
||||
var button = buttons[i++];
|
||||
button.UpdateKeyCombination(d);
|
||||
store.Update(button.KeyBinding);
|
||||
}
|
||||
@ -327,7 +326,7 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
private void updateBindTarget()
|
||||
{
|
||||
if (bindTarget != null) bindTarget.IsBinding = false;
|
||||
bindTarget = Buttons.FirstOrDefault(b => b.IsHovered) ?? Buttons.FirstOrDefault();
|
||||
bindTarget = buttons.FirstOrDefault(b => b.IsHovered) ?? buttons.FirstOrDefault();
|
||||
if (bindTarget != null) bindTarget.IsBinding = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user