1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 23:12:55 +08:00

Move dim layer to top and only apply dimming at one location

This commit is contained in:
Dean Herbert 2022-04-14 21:04:52 +09:00
parent 59bb6b8f7c
commit f19208a245

View File

@ -13,7 +13,6 @@ 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
{ {
@ -26,8 +25,6 @@ namespace osu.Game.Overlays.Settings
private Box dim; private Box dim;
private OsuSpriteText header;
public abstract Drawable CreateIcon(); public abstract Drawable CreateIcon();
public abstract LocalisableString Header { get; } public abstract LocalisableString Header { get; }
@ -86,12 +83,6 @@ namespace osu.Game.Overlays.Settings
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Children = new Drawable[] Children = new Drawable[]
{ {
dim = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0f,
},
new Container new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -103,7 +94,7 @@ namespace osu.Game.Overlays.Settings
}, },
Children = new Drawable[] Children = new Drawable[]
{ {
header = new OsuSpriteText new OsuSpriteText
{ {
Font = OsuFont.TorusAlternate.With(size: header_size), Font = OsuFont.TorusAlternate.With(size: header_size),
Text = Header, Text = Header,
@ -114,7 +105,13 @@ namespace osu.Game.Overlays.Settings
}, },
FlowContent FlowContent
} }
} },
dim = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background5,
Alpha = 0f,
},
} }
}, },
}); });
@ -152,18 +149,12 @@ namespace osu.Game.Overlays.Settings
private void updateContentFade() private void updateContentFade()
{ {
float contentFade = 1;
float dimFade = 0; float dimFade = 0;
if (!isCurrentSection) if (!isCurrentSection)
{ dimFade = IsHovered ? 0.5f : 0.8f;
contentFade = IsHovered ? 0.5f : 0.25f;
dimFade = IsHovered ? 0.125f : 0.25f;
}
dim.FadeTo(dimFade, 500, Easing.OutQuint); dim.FadeTo(dimFade, 300, Easing.OutQuint);
header.FadeTo(contentFade, 500, Easing.OutQuint);
FlowContent.FadeTo(contentFade, 500, Easing.OutQuint);
} }
} }
} }