mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 22:28:20 +08:00
Merge pull request #17822 from frenzibyte/settings-inactive-dim
Add background dim effect to inactive settings sections
This commit is contained in:
commit
1e977ffeef
@ -23,7 +23,9 @@ namespace osu.Game.Overlays.Settings
|
|||||||
|
|
||||||
private IBindable<SettingsSection> selectedSection;
|
private IBindable<SettingsSection> selectedSection;
|
||||||
|
|
||||||
private OsuSpriteText header;
|
private Box dim;
|
||||||
|
|
||||||
|
private const float inactive_alpha = 0.8f;
|
||||||
|
|
||||||
public abstract Drawable CreateIcon();
|
public abstract Drawable CreateIcon();
|
||||||
public abstract LocalisableString Header { get; }
|
public abstract LocalisableString Header { get; }
|
||||||
@ -78,25 +80,40 @@ namespace osu.Game.Overlays.Settings
|
|||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
Padding = new MarginPadding
|
Padding = new MarginPadding { Top = border_size },
|
||||||
{
|
|
||||||
Top = 28,
|
|
||||||
Bottom = 40,
|
|
||||||
},
|
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
header = new OsuSpriteText
|
new Container
|
||||||
{
|
{
|
||||||
Font = OsuFont.TorusAlternate.With(size: header_size),
|
RelativeSizeAxes = Axes.X,
|
||||||
Text = Header,
|
AutoSizeAxes = Axes.Y,
|
||||||
Margin = new MarginPadding
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
Horizontal = SettingsPanel.CONTENT_MARGINS
|
Top = 24,
|
||||||
|
Bottom = 40,
|
||||||
|
},
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Font = OsuFont.TorusAlternate.With(size: header_size),
|
||||||
|
Text = Header,
|
||||||
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Horizontal = SettingsPanel.CONTENT_MARGINS
|
||||||
|
}
|
||||||
|
},
|
||||||
|
FlowContent
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
FlowContent
|
dim = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colourProvider.Background5,
|
||||||
|
Alpha = inactive_alpha,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -134,17 +151,14 @@ namespace osu.Game.Overlays.Settings
|
|||||||
|
|
||||||
private void updateContentFade()
|
private void updateContentFade()
|
||||||
{
|
{
|
||||||
float contentFade = 1;
|
float dimFade = 0;
|
||||||
float headerFade = 1;
|
|
||||||
|
|
||||||
if (!isCurrentSection)
|
if (!isCurrentSection)
|
||||||
{
|
{
|
||||||
contentFade = 0.25f;
|
dimFade = IsHovered ? 0.5f : inactive_alpha;
|
||||||
headerFade = IsHovered ? 0.5f : 0.25f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
header.FadeTo(headerFade, 500, Easing.OutQuint);
|
dim.FadeTo(dimFade, 300, Easing.OutQuint);
|
||||||
FlowContent.FadeTo(contentFade, 500, Easing.OutQuint);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ namespace osu.Game.Overlays
|
|||||||
ContentContainer.Margin = new MarginPadding { Left = Sidebar?.DrawWidth ?? 0 };
|
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()
|
private void loadSections()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user