mirror of
https://github.com/ppy/osu.git
synced 2026-05-31 18:31:01 +08:00
Adjust panel selection glow and background
This commit is contained in:
@@ -94,8 +94,8 @@ namespace osu.Game.Screens.SelectV2
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Offset = new Vector2(1f),
|
||||
Radius = 10,
|
||||
Hollow = true,
|
||||
Radius = 2,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@@ -123,6 +123,8 @@ namespace osu.Game.Screens.SelectV2
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
// TODO: this is only used by beatmap panels and should NOT be in this class.
|
||||
// it's wasting fill rate.
|
||||
backgroundAccentGradient = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@@ -157,10 +159,9 @@ namespace osu.Game.Screens.SelectV2
|
||||
selectionLayer = new Box
|
||||
{
|
||||
Alpha = 0,
|
||||
Colour = ColourInfo.GradientHorizontal(colours.BlueDark.Opacity(0), colours.BlueDark.Opacity(0.6f)),
|
||||
Blending = BlendingParameters.Additive,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0.3f,
|
||||
Width = 0.6f,
|
||||
Blending = BlendingParameters.Additive,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
},
|
||||
@@ -202,6 +203,7 @@ namespace osu.Game.Screens.SelectV2
|
||||
else
|
||||
selectionLayer.FadeOut(200, Easing.OutQuint);
|
||||
|
||||
updateEdgeEffect();
|
||||
updateXOffset();
|
||||
}, true);
|
||||
|
||||
@@ -249,13 +251,15 @@ namespace osu.Game.Screens.SelectV2
|
||||
backgroundAccentGradient.Colour = ColourInfo.GradientHorizontal(backgroundColour.Opacity(0.25f), backgroundColour.Opacity(0f));
|
||||
backgroundBorder.Colour = backgroundColour;
|
||||
|
||||
selectionLayer.Colour = ColourInfo.GradientHorizontal(backgroundColour.Opacity(0), backgroundColour.Opacity(0.5f));
|
||||
|
||||
updateEdgeEffect(animated: false);
|
||||
}
|
||||
|
||||
private void updateEdgeEffect(bool animated = true)
|
||||
{
|
||||
var edgeEffectColour = accentColour ?? Color4Extensions.FromHex(@"4EBFFF");
|
||||
TopLevelContent.FadeEdgeEffectTo(Expanded.Value ? edgeEffectColour.Opacity(0.5f) : Color4.Black.Opacity(0.4f), animated ? DURATION : 0, Easing.OutQuint);
|
||||
TopLevelContent.FadeEdgeEffectTo(Expanded.Value || Selected.Value ? edgeEffectColour.Opacity(0.8f) : Color4.Black.Opacity(0.4f), animated ? DURATION : 0, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private void updateXOffset()
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@@ -61,34 +62,27 @@ namespace osu.Game.Screens.SelectV2
|
||||
Direction = FillDirection.Horizontal,
|
||||
// This makes the gradient not be perfectly horizontal, but diagonal at a ~40° angle
|
||||
Shear = new Vector2(0.8f, 0),
|
||||
Alpha = 0.5f,
|
||||
Children = new[]
|
||||
{
|
||||
// The left half with no gradient applied
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
Width = 0.4f,
|
||||
},
|
||||
// Piecewise-linear gradient with 3 segments to make it appear smoother
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientHorizontal(Color4.Black, new Color4(0f, 0f, 0f, 0.9f)),
|
||||
Width = 0.05f,
|
||||
},
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.9f), new Color4(0f, 0f, 0f, 0.1f)),
|
||||
Colour = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.5f), Color4.Black.Opacity(0.3f)),
|
||||
Width = 0.2f,
|
||||
},
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.1f), new Color4(0, 0, 0, 0)),
|
||||
Width = 0.05f,
|
||||
Colour = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.3f), Color4.Black.Opacity(0.2f)),
|
||||
// Slightly more than 1.0 in total to account for shear.
|
||||
Width = 0.45f,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user