Formatting, renaming

This commit is contained in:
Swords 2021-05-25 21:37:08 +10:00
parent d9f5b578bf
commit d5feb8353d
3 changed files with 9 additions and 8 deletions

View File

@ -131,7 +131,7 @@ namespace osu.Game.Tests.Visual.Settings
AddUntilStep("restore button hidden", () => settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First().Alpha == 0); AddUntilStep("restore button hidden", () => settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First().Alpha == 0);
AddAssert("binding cleared", () => settingsKeyBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(0).KeyBinding.KeyCombination.Equals(settingsKeyBindingRow.BasicKeyBindingRow.Defaults.ElementAt(0))); AddAssert("binding cleared", () => settingsKeyBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(0).KeyBinding.KeyCombination.Equals(settingsKeyBindingRow.KeyBindingRow.Defaults.ElementAt(0)));
} }
[Test] [Test]
@ -160,7 +160,7 @@ namespace osu.Game.Tests.Visual.Settings
AddUntilStep("restore button hidden", () => settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First().Alpha == 0); AddUntilStep("restore button hidden", () => settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First().Alpha == 0);
AddAssert("binding cleared", () => settingsKeyBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(0).KeyBinding.KeyCombination.Equals(settingsKeyBindingRow.BasicKeyBindingRow.Defaults.ElementAt(0))); AddAssert("binding cleared", () => settingsKeyBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(0).KeyBinding.KeyCombination.Equals(settingsKeyBindingRow.KeyBindingRow.Defaults.ElementAt(0)));
} }
[Test] [Test]

View File

@ -43,7 +43,7 @@ namespace osu.Game.Overlays.KeyBinding
Add(new ResetButton Add(new ResetButton
{ {
Action = () => Children.OfType<RestorableKeyBindingRow>().ForEach(k => k.BasicKeyBindingRow.RestoreDefaults()) Action = () => Children.OfType<RestorableKeyBindingRow>().ForEach(k => k.KeyBindingRow.RestoreDefaults())
}); });
} }
} }

View File

@ -14,7 +14,7 @@ namespace osu.Game.Overlays.KeyBinding
{ {
private readonly object key; private readonly object key;
private readonly ICollection<Input.Bindings.DatabasedKeyBinding> bindings; private readonly ICollection<Input.Bindings.DatabasedKeyBinding> bindings;
public readonly KeyBindingRow BasicKeyBindingRow; public readonly KeyBindingRow KeyBindingRow;
private bool matchingFilter; private bool matchingFilter;
@ -32,7 +32,8 @@ namespace osu.Game.Overlays.KeyBinding
public IEnumerable<string> FilterTerms => bindings.Select(b => b.KeyCombination.ReadableString()).Prepend(key.ToString()); public IEnumerable<string> FilterTerms => bindings.Select(b => b.KeyCombination.ReadableString()).Prepend(key.ToString());
public RestorableKeyBindingRow(object key, ICollection<Input.Bindings.DatabasedKeyBinding> bindings, RulesetInfo ruleset, IEnumerable<KeyCombination> defaults) { public RestorableKeyBindingRow(object key, ICollection<Input.Bindings.DatabasedKeyBinding> bindings, RulesetInfo ruleset, IEnumerable<KeyCombination> defaults)
{
this.key = key; this.key = key;
this.bindings = bindings; this.bindings = bindings;
@ -44,15 +45,15 @@ namespace osu.Game.Overlays.KeyBinding
{ {
new RestoreDefaultValueButton<bool>() new RestoreDefaultValueButton<bool>()
{ {
Current = BasicKeyBindingRow.IsDefault, Current = KeyBindingRow.IsDefault,
Action = () => { BasicKeyBindingRow.RestoreDefaults(); } Action = () => { KeyBindingRow.RestoreDefaults(); }
}, },
new FillFlowContainer new FillFlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS },
Child = BasicKeyBindingRow = new KeyBindingRow(key, bindings.Where(b => ((int)b.Action).Equals((int)key))) Child = KeyBindingRow = new KeyBindingRow(key, bindings.Where(b => ((int)b.Action).Equals((int)key)))
{ {
AllowMainMouseButtons = ruleset != null, AllowMainMouseButtons = ruleset != null,
Defaults = defaults Defaults = defaults