mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Re-privatise buttons
This commit is contained in:
@ -79,11 +79,11 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
|
|
||||||
clickClearButton();
|
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", () =>
|
AddStep("click second binding", () =>
|
||||||
{
|
{
|
||||||
var target = backBindingRow.Buttons.ElementAt(1);
|
var target = backBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(1);
|
||||||
|
|
||||||
InputManager.MoveMouseTo(target);
|
InputManager.MoveMouseTo(target);
|
||||||
InputManager.Click(MouseButton.Left);
|
InputManager.Click(MouseButton.Left);
|
||||||
@ -91,7 +91,7 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
|
|
||||||
clickClearButton();
|
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()
|
void clickClearButton()
|
||||||
{
|
{
|
||||||
@ -117,11 +117,11 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
InputManager.Click(MouseButton.Left);
|
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", () =>
|
AddStep("click second binding", () =>
|
||||||
{
|
{
|
||||||
var target = backBindingRow.Buttons.ElementAt(1);
|
var target = backBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(1);
|
||||||
|
|
||||||
InputManager.MoveMouseTo(target);
|
InputManager.MoveMouseTo(target);
|
||||||
InputManager.Click(MouseButton.Left);
|
InputManager.Click(MouseButton.Left);
|
||||||
@ -134,7 +134,7 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
InputManager.Click(MouseButton.Left);
|
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 OsuSpriteText text;
|
||||||
private FillFlowContainer cancelAndClearButtons;
|
private FillFlowContainer cancelAndClearButtons;
|
||||||
|
private FillFlowContainer<KeyButton> buttons;
|
||||||
public FillFlowContainer<KeyButton> Buttons;
|
|
||||||
|
|
||||||
public IEnumerable<string> FilterTerms => bindings.Select(b => b.KeyCombination.ReadableString()).Prepend((string)text.Text);
|
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(),
|
Text = action.GetDescription(),
|
||||||
Margin = new MarginPadding(padding),
|
Margin = new MarginPadding(padding),
|
||||||
},
|
},
|
||||||
Buttons = new FillFlowContainer<KeyButton>
|
buttons = new FillFlowContainer<KeyButton>
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
@ -116,7 +115,7 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
};
|
};
|
||||||
|
|
||||||
foreach (var b in bindings)
|
foreach (var b in bindings)
|
||||||
Buttons.Add(new KeyButton(b));
|
buttons.Add(new KeyButton(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RestoreDefaults()
|
public void RestoreDefaults()
|
||||||
@ -125,7 +124,7 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
|
|
||||||
foreach (var d in Defaults)
|
foreach (var d in Defaults)
|
||||||
{
|
{
|
||||||
var button = Buttons[i++];
|
var button = buttons[i++];
|
||||||
button.UpdateKeyCombination(d);
|
button.UpdateKeyCombination(d);
|
||||||
store.Update(button.KeyBinding);
|
store.Update(button.KeyBinding);
|
||||||
}
|
}
|
||||||
@ -327,7 +326,7 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
private void updateBindTarget()
|
private void updateBindTarget()
|
||||||
{
|
{
|
||||||
if (bindTarget != null) bindTarget.IsBinding = false;
|
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;
|
if (bindTarget != null) bindTarget.IsBinding = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user