Apply the rest of requested changes

This commit is contained in:
Swords 2021-05-25 21:00:38 +10:00
parent 518999ffab
commit ce845a9f8d
2 changed files with 12 additions and 23 deletions

View File

@ -37,10 +37,7 @@ namespace osu.Game.Overlays.KeyBinding
private FillFlowContainer cancelAndClearButtons; private FillFlowContainer cancelAndClearButtons;
private FillFlowContainer<KeyButton> buttons; private FillFlowContainer<KeyButton> buttons;
public Bindable<bool> IsDefault { get; } = new BindableBool(true) public Bindable<bool> IsDefault { get; } = new BindableBool(true);
{
Default = true
};
public BasicKeyBindingRow(object action, IEnumerable<Framework.Input.Bindings.KeyBinding> bindings) public BasicKeyBindingRow(object action, IEnumerable<Framework.Input.Bindings.KeyBinding> bindings)
{ {

View File

@ -32,41 +32,33 @@ 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 KeyBindingRow( public KeyBindingRow(object key, ICollection<Input.Bindings.DatabasedKeyBinding> bindings, RulesetInfo ruleset, IEnumerable<KeyCombination> defaults) {
object key,
ICollection<Input.Bindings.DatabasedKeyBinding> bindings,
RulesetInfo ruleset,
IEnumerable<KeyCombination> defaults)
{
this.key = key; this.key = key;
this.bindings = bindings; this.bindings = bindings;
RestoreDefaultValueButton<bool> restoreDefaultButton;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Padding = new MarginPadding { Right = SettingsPanel.CONTENT_MARGINS }; Padding = new MarginPadding { Right = SettingsPanel.CONTENT_MARGINS };
BasicKeyBindingRow = new BasicKeyBindingRow(key, bindings.Where(b => ((int)b.Action).Equals((int)key)))
{
AllowMainMouseButtons = ruleset != null,
Defaults = defaults
};
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
restoreDefaultButton = new RestoreDefaultValueButton<bool>(), new RestoreDefaultValueButton<bool>()
{
Current = BasicKeyBindingRow.IsDefault,
Action = () => { BasicKeyBindingRow.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 Child = BasicKeyBindingRow = new BasicKeyBindingRow(key, bindings.Where(b => ((int)b.Action).Equals((int)key)))
{
AllowMainMouseButtons = ruleset != null,
Defaults = defaults
}
}, },
}; };
restoreDefaultButton.Action = () => { BasicKeyBindingRow.RestoreDefaults(); };
restoreDefaultButton.Current = BasicKeyBindingRow.IsDefault;
} }
} }
} }