mirror of
https://github.com/ppy/osu
synced 2025-01-11 08:39:31 +00:00
Add background dim effect to inactive settings sections
This commit is contained in:
parent
d96337e093
commit
59bb6b8f7c
@ -13,6 +13,7 @@ using osu.Framework.Localisation;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings
|
namespace osu.Game.Overlays.Settings
|
||||||
{
|
{
|
||||||
@ -23,6 +24,8 @@ namespace osu.Game.Overlays.Settings
|
|||||||
|
|
||||||
private IBindable<SettingsSection> selectedSection;
|
private IBindable<SettingsSection> selectedSection;
|
||||||
|
|
||||||
|
private Box dim;
|
||||||
|
|
||||||
private OsuSpriteText header;
|
private OsuSpriteText header;
|
||||||
|
|
||||||
public abstract Drawable CreateIcon();
|
public abstract Drawable CreateIcon();
|
||||||
@ -78,25 +81,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
|
dim = new Box
|
||||||
{
|
{
|
||||||
Font = OsuFont.TorusAlternate.With(size: header_size),
|
RelativeSizeAxes = Axes.Both,
|
||||||
Text = Header,
|
Colour = Color4.Black,
|
||||||
Margin = new MarginPadding
|
Alpha = 0f,
|
||||||
{
|
|
||||||
Horizontal = SettingsPanel.CONTENT_MARGINS
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
FlowContent
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Padding = new MarginPadding
|
||||||
|
{
|
||||||
|
Top = 24,
|
||||||
|
Bottom = 40,
|
||||||
|
},
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
header = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Font = OsuFont.TorusAlternate.With(size: header_size),
|
||||||
|
Text = Header,
|
||||||
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Horizontal = SettingsPanel.CONTENT_MARGINS
|
||||||
|
}
|
||||||
|
},
|
||||||
|
FlowContent
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -135,15 +153,16 @@ namespace osu.Game.Overlays.Settings
|
|||||||
private void updateContentFade()
|
private void updateContentFade()
|
||||||
{
|
{
|
||||||
float contentFade = 1;
|
float contentFade = 1;
|
||||||
float headerFade = 1;
|
float dimFade = 0;
|
||||||
|
|
||||||
if (!isCurrentSection)
|
if (!isCurrentSection)
|
||||||
{
|
{
|
||||||
contentFade = 0.25f;
|
contentFade = IsHovered ? 0.5f : 0.25f;
|
||||||
headerFade = IsHovered ? 0.5f : 0.25f;
|
dimFade = IsHovered ? 0.125f : 0.25f;
|
||||||
}
|
}
|
||||||
|
|
||||||
header.FadeTo(headerFade, 500, Easing.OutQuint);
|
dim.FadeTo(dimFade, 500, Easing.OutQuint);
|
||||||
|
header.FadeTo(contentFade, 500, Easing.OutQuint);
|
||||||
FlowContent.FadeTo(contentFade, 500, Easing.OutQuint);
|
FlowContent.FadeTo(contentFade, 500, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user