Adjust appearance of keybinding subpanel

This commit is contained in:
Bartłomiej Dach 2021-10-09 20:29:44 +02:00
parent 855a74b8a0
commit b8616bf910
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
3 changed files with 16 additions and 15 deletions

View File

@ -78,7 +78,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
private RealmContextFactory realmFactory { get; set; } private RealmContextFactory realmFactory { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OverlayColourProvider colourProvider)
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
@ -101,7 +101,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
EdgeEffect = new EdgeEffectParameters EdgeEffect = new EdgeEffectParameters
{ {
Radius = 2, Radius = 2,
Colour = colours.YellowDark.Opacity(0), Colour = colourProvider.Highlight1.Opacity(0),
Type = EdgeEffectType.Shadow, Type = EdgeEffectType.Shadow,
Hollow = true, Hollow = true,
}, },
@ -110,13 +110,12 @@ namespace osu.Game.Overlays.Settings.Sections.Input
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.Black, Colour = colourProvider.Background5,
Alpha = 0.6f,
}, },
text = new OsuSpriteText text = new OsuSpriteText
{ {
Text = action.GetLocalisableDescription(), Text = action.GetLocalisableDescription(),
Margin = new MarginPadding(padding), Margin = new MarginPadding(1.5f * padding),
}, },
buttons = new FillFlowContainer<KeyButton> buttons = new FillFlowContainer<KeyButton>
{ {
@ -405,7 +404,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
private readonly Box box; private readonly Box box;
public readonly OsuSpriteText Text; public readonly OsuSpriteText Text;
private Color4 hoverColour; [Resolved]
private OverlayColourProvider colourProvider { get; set; }
private bool isBinding; private bool isBinding;
@ -448,7 +448,6 @@ namespace osu.Game.Overlays.Settings.Sections.Input
box = new Box box = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.Black
}, },
Text = new OsuSpriteText Text = new OsuSpriteText
{ {
@ -463,9 +462,9 @@ namespace osu.Game.Overlays.Settings.Sections.Input
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load()
{ {
hoverColour = colours.YellowDark; updateHoverState();
} }
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
@ -484,12 +483,12 @@ namespace osu.Game.Overlays.Settings.Sections.Input
{ {
if (isBinding) if (isBinding)
{ {
box.FadeColour(Color4.White, transition_time, Easing.OutQuint); box.FadeColour(colourProvider.Light2, transition_time, Easing.OutQuint);
Text.FadeColour(Color4.Black, transition_time, Easing.OutQuint); Text.FadeColour(Color4.Black, transition_time, Easing.OutQuint);
} }
else else
{ {
box.FadeColour(IsHovered ? hoverColour : Color4.Black, transition_time, Easing.OutQuint); box.FadeColour(IsHovered ? colourProvider.Light4 : colourProvider.Background6, transition_time, Easing.OutQuint);
Text.FadeColour(IsHovered ? Color4.Black : Color4.White, transition_time, Easing.OutQuint); Text.FadeColour(IsHovered ? Color4.Black : Color4.White, transition_time, Easing.OutQuint);
} }
} }

View File

@ -27,8 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
{ {
this.variant = variant; this.variant = variant;
FlowContent.Spacing = new Vector2(0, 1); FlowContent.Spacing = new Vector2(0, 3);
FlowContent.Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS, Right = SettingsPanel.CONTENT_MARGINS };
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -10,7 +10,6 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
using osuTK; using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
@ -36,12 +35,16 @@ namespace osu.Game.Overlays
private class BackButton : OsuButton private class BackButton : OsuButton
{ {
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
Size = new Vector2(Sidebar.DEFAULT_WIDTH); Size = new Vector2(Sidebar.DEFAULT_WIDTH);
BackgroundColour = Color4.Black; BackgroundColour = colourProvider.Background5;
Hover.Colour = Colour4.Transparent;
AddRange(new Drawable[] AddRange(new Drawable[]
{ {