mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 08:02:55 +08:00
Refactor a bit for readability
This commit is contained in:
parent
d1b2116400
commit
551192b413
@ -34,9 +34,9 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
public class KeyBindingRow : Container, IFilterable
|
public class KeyBindingRow : Container, IFilterable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when binding of this row finalises with a change being written.
|
/// Invoked when the binding of this row is updated with a change being written.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Action<KeyBindingRow> BindingFinalised { get; set; }
|
public Action<KeyBindingRow> BindingUpdated { get; set; }
|
||||||
|
|
||||||
private readonly object action;
|
private readonly object action;
|
||||||
private readonly IEnumerable<RealmKeyBinding> bindings;
|
private readonly IEnumerable<RealmKeyBinding> bindings;
|
||||||
@ -385,7 +385,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
finalise(false);
|
finalise(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void finalise(bool changedKey = true)
|
private void finalise(bool hasChanged = true)
|
||||||
{
|
{
|
||||||
if (bindTarget != null)
|
if (bindTarget != null)
|
||||||
{
|
{
|
||||||
@ -398,8 +398,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
{
|
{
|
||||||
// schedule to ensure we don't instantly get focus back on next OnMouseClick (see AcceptFocus impl.)
|
// schedule to ensure we don't instantly get focus back on next OnMouseClick (see AcceptFocus impl.)
|
||||||
bindTarget = null;
|
bindTarget = null;
|
||||||
if (changedKey)
|
if (hasChanged)
|
||||||
BindingFinalised?.Invoke(this);
|
BindingUpdated?.Invoke(this);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
{
|
{
|
||||||
AllowMainMouseButtons = Ruleset != null,
|
AllowMainMouseButtons = Ruleset != null,
|
||||||
Defaults = defaultGroup.Select(d => d.KeyCombination),
|
Defaults = defaultGroup.Select(d => d.KeyCombination),
|
||||||
BindingFinalised = bindingCompleted
|
BindingUpdated = onBindingUpdated
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindingCompleted(KeyBindingRow sender)
|
private void onBindingUpdated(KeyBindingRow sender)
|
||||||
{
|
{
|
||||||
if (AutoAdvanceTarget)
|
if (AutoAdvanceTarget)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user