2020-10-13 19:57:26 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2020-10-13 11:50:39 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Colour;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Beatmaps.Drawables;
|
|
|
|
using osuTK;
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Select.Carousel
|
|
|
|
{
|
2020-10-13 16:55:56 +08:00
|
|
|
public partial class SetPanelBackground : BufferedContainer
|
2020-10-13 11:50:39 +08:00
|
|
|
{
|
2021-11-15 17:46:11 +08:00
|
|
|
public SetPanelBackground(IWorkingBeatmap working)
|
2021-11-05 14:54:27 +08:00
|
|
|
: base(cachedFrameBuffer: true)
|
2020-10-13 11:50:39 +08:00
|
|
|
{
|
|
|
|
RedrawOnScale = false;
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new BeatmapBackgroundSprite(working)
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
FillMode = FillMode.Fill,
|
|
|
|
},
|
|
|
|
new FillFlowContainer
|
|
|
|
{
|
|
|
|
Depth = -1,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
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,
|
|
|
|
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)),
|
|
|
|
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,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|