1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 04:07:25 +08:00

Add triangles to ModSelectColumn

This commit is contained in:
Andrei Zavatski 2023-02-15 23:09:55 +03:00
parent 455fb7789c
commit a84f20bf32

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -27,7 +28,12 @@ namespace osu.Game.Overlays.Mods
public Color4 AccentColour public Color4 AccentColour
{ {
get => headerBackground.Colour; get => headerBackground.Colour;
set => headerBackground.Colour = value; set
{
headerBackground.Colour = value;
var hsv = new Colour4(value.R, value.G, value.B, 1f).ToHSV();
triangles.Colour = ColourInfo.GradientVertical(Colour4.FromHSV(hsv.X, hsv.Y + 0.2f, hsv.Z - 0.1f), value);
}
} }
/// <summary> /// <summary>
@ -44,6 +50,7 @@ namespace osu.Game.Overlays.Mods
private readonly Box headerBackground; private readonly Box headerBackground;
private readonly Container contentContainer; private readonly Container contentContainer;
private readonly Box contentBackground; private readonly Box contentBackground;
private readonly TrianglesV2 triangles;
private const float header_height = 42; private const float header_height = 42;
@ -73,6 +80,16 @@ namespace osu.Game.Overlays.Mods
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = header_height + ModSelectPanel.CORNER_RADIUS Height = header_height + ModSelectPanel.CORNER_RADIUS
}, },
triangles = new TrianglesV2
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.X,
Width = 1.1f,
Height = header_height,
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
Masking = true
},
headerText = new OsuTextFlowContainer(t => headerText = new OsuTextFlowContainer(t =>
{ {
t.Font = OsuFont.TorusAlternate.With(size: 17); t.Font = OsuFont.TorusAlternate.With(size: 17);