1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 12:42:54 +08:00

Match settings panels' backgrounds visually and behaviourally

This commit is contained in:
Dean Herbert 2024-03-16 10:23:21 +08:00
parent 0f8d526453
commit a49c4ebea6
No known key found for this signature in database

View File

@ -18,6 +18,8 @@ namespace osu.Game.Screens.Play
private readonly LocalisableString title; private readonly LocalisableString title;
private readonly LocalisableString content; private readonly LocalisableString content;
private Box background = null!;
public PlayerLoaderDisclaimer(LocalisableString title, LocalisableString content) public PlayerLoaderDisclaimer(LocalisableString title, LocalisableString content)
{ {
this.title = title; this.title = title;
@ -34,10 +36,11 @@ namespace osu.Game.Screens.Play
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new Box background = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background4, Colour = colourProvider.Background4,
Alpha = 0.1f,
}, },
new Container new Container
{ {
@ -81,7 +84,24 @@ namespace osu.Game.Screens.Play
}; };
} }
// handle hover so that users can hover the disclaimer to delay load if they want to read it. protected override bool OnHover(HoverEvent e)
protected override bool OnHover(HoverEvent e) => true; {
updateFadeState();
// handle hover so that users can hover the disclaimer to delay load if they want to read it.
return true;
}
protected override void OnHoverLost(HoverLostEvent e)
{
updateFadeState();
base.OnHoverLost(e);
}
private void updateFadeState()
{
// Matches SettingsToolboxGroup
background.FadeTo(IsHovered ? 1 : 0.1f, (float)500, Easing.OutQuint);
}
} }
} }