1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 15:27:26 +08:00

Merge pull request #17822 from frenzibyte/settings-inactive-dim

Add background dim effect to inactive settings sections
This commit is contained in:
Dean Herbert 2022-04-14 22:23:44 +09:00 committed by GitHub
commit 1e977ffeef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 19 deletions

View File

@ -23,7 +23,9 @@ namespace osu.Game.Overlays.Settings
private IBindable<SettingsSection> selectedSection;
private OsuSpriteText header;
private Box dim;
private const float inactive_alpha = 0.8f;
public abstract Drawable CreateIcon();
public abstract LocalisableString Header { get; }
@ -78,16 +80,23 @@ namespace osu.Game.Overlays.Settings
},
new Container
{
Padding = new MarginPadding
{
Top = 28,
Bottom = 40,
},
Padding = new MarginPadding { Top = border_size },
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
header = new OsuSpriteText
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding
{
Top = 24,
Bottom = 40,
},
Children = new Drawable[]
{
new OsuSpriteText
{
Font = OsuFont.TorusAlternate.With(size: header_size),
Text = Header,
@ -99,6 +108,14 @@ namespace osu.Game.Overlays.Settings
FlowContent
}
},
dim = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background5,
Alpha = inactive_alpha,
},
}
},
});
selectedSection = settingsPanel.CurrentSection.GetBoundCopy();
@ -134,17 +151,14 @@ namespace osu.Game.Overlays.Settings
private void updateContentFade()
{
float contentFade = 1;
float headerFade = 1;
float dimFade = 0;
if (!isCurrentSection)
{
contentFade = 0.25f;
headerFade = IsHovered ? 0.5f : 0.25f;
dimFade = IsHovered ? 0.5f : inactive_alpha;
}
header.FadeTo(headerFade, 500, Easing.OutQuint);
FlowContent.FadeTo(contentFade, 500, Easing.OutQuint);
dim.FadeTo(dimFade, 300, Easing.OutQuint);
}
}
}

View File

@ -197,7 +197,7 @@ namespace osu.Game.Overlays
ContentContainer.Margin = new MarginPadding { Left = Sidebar?.DrawWidth ?? 0 };
}
private const double fade_in_duration = 1000;
private const double fade_in_duration = 500;
private void loadSections()
{