Merge branch 'master' into rebind-song-select

This commit is contained in:
Dean Herbert
2021-04-07 17:13:25 +09:00
2153 changed files with 88576 additions and 23214 deletions

View File

@ -23,6 +23,7 @@ namespace osu.Game.Overlays.KeyBinding
Add(new AudioControlKeyBindingsSubsection(manager));
Add(new SongSelectKeyBindingSubsection(manager));
Add(new InGameKeyBindingsSubsection(manager));
Add(new EditorKeyBindingsSubsection(manager));
}
private class DefaultBindingsSubsection : KeyBindingsSubsection
@ -68,5 +69,16 @@ namespace osu.Game.Overlays.KeyBinding
Defaults = manager.AudioControlKeyBindings;
}
}
private class EditorKeyBindingsSubsection : KeyBindingsSubsection
{
protected override string Header => "Editor";
public EditorKeyBindingsSubsection(GlobalActionContainer manager)
: base(null)
{
Defaults = manager.EditorKeyBindings;
}
}
}
}

View File

@ -48,11 +48,10 @@ namespace osu.Game.Overlays.KeyBinding
public bool FilteringActive { get; set; }
private OsuSpriteText text;
private Drawable pressAKey;
private FillFlowContainer cancelAndClearButtons;
private 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(text.Text.ToString());
public KeyBindingRow(object action, IEnumerable<Framework.Input.Bindings.KeyBinding> bindings)
{
@ -80,7 +79,7 @@ namespace osu.Game.Overlays.KeyBinding
Hollow = true,
};
Children = new[]
Children = new Drawable[]
{
new Box
{
@ -99,7 +98,7 @@ namespace osu.Game.Overlays.KeyBinding
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight
},
pressAKey = new FillFlowContainer
cancelAndClearButtons = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Padding = new MarginPadding(padding) { Top = height + padding * 2 },
@ -187,7 +186,8 @@ namespace osu.Game.Overlays.KeyBinding
if (bindTarget.IsHovered)
finalise();
else
// prevent updating bind target before clear button's action
else if (!cancelAndClearButtons.Any(b => b.IsHovered))
updateBindTarget();
}
@ -298,8 +298,8 @@ namespace osu.Game.Overlays.KeyBinding
if (HasFocus)
GetContainingInputManager().ChangeFocus(null);
pressAKey.FadeOut(300, Easing.OutQuint);
pressAKey.BypassAutoSizeAxes |= Axes.Y;
cancelAndClearButtons.FadeOut(300, Easing.OutQuint);
cancelAndClearButtons.BypassAutoSizeAxes |= Axes.Y;
}
protected override void OnFocus(FocusEvent e)
@ -307,8 +307,8 @@ namespace osu.Game.Overlays.KeyBinding
AutoSizeDuration = 500;
AutoSizeEasing = Easing.OutQuint;
pressAKey.FadeIn(300, Easing.OutQuint);
pressAKey.BypassAutoSizeAxes &= ~Axes.Y;
cancelAndClearButtons.FadeIn(300, Easing.OutQuint);
cancelAndClearButtons.BypassAutoSizeAxes &= ~Axes.Y;
updateBindTarget();
base.OnFocus(e);
@ -320,6 +320,9 @@ namespace osu.Game.Overlays.KeyBinding
base.OnFocusLost(e);
}
/// <summary>
/// Updates the bind target to the currently hovered key button or the first if clicked anywhere else.
/// </summary>
private void updateBindTarget()
{
if (bindTarget != null) bindTarget.IsBinding = false;
@ -354,7 +357,7 @@ namespace osu.Game.Overlays.KeyBinding
}
}
private class KeyButton : Container
public class KeyButton : Container
{
public readonly Framework.Input.Bindings.KeyBinding KeyBinding;