From a84f20bf32fbd4639571c4800a77b0233b04e70b Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Wed, 15 Feb 2023 23:09:55 +0300 Subject: [PATCH 1/4] Add triangles to ModSelectColumn --- osu.Game/Overlays/Mods/ModSelectColumn.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectColumn.cs b/osu.Game/Overlays/Mods/ModSelectColumn.cs index e5154fd631..d9023e8dde 100644 --- a/osu.Game/Overlays/Mods/ModSelectColumn.cs +++ b/osu.Game/Overlays/Mods/ModSelectColumn.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; using osuTK; using osuTK.Graphics; @@ -27,7 +28,12 @@ namespace osu.Game.Overlays.Mods public Color4 AccentColour { 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); + } } /// @@ -44,6 +50,7 @@ namespace osu.Game.Overlays.Mods private readonly Box headerBackground; private readonly Container contentContainer; private readonly Box contentBackground; + private readonly TrianglesV2 triangles; private const float header_height = 42; @@ -73,6 +80,16 @@ namespace osu.Game.Overlays.Mods RelativeSizeAxes = Axes.X, 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 => { t.Font = OsuFont.TorusAlternate.With(size: 17); From 0838fa636fc8dd3fba186383c45deb469efc220a Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Fri, 17 Feb 2023 15:16:00 +0300 Subject: [PATCH 2/4] Make triangles slower --- osu.Game/Overlays/Mods/ModSelectColumn.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Mods/ModSelectColumn.cs b/osu.Game/Overlays/Mods/ModSelectColumn.cs index d9023e8dde..843f978c13 100644 --- a/osu.Game/Overlays/Mods/ModSelectColumn.cs +++ b/osu.Game/Overlays/Mods/ModSelectColumn.cs @@ -88,6 +88,7 @@ namespace osu.Game.Overlays.Mods Width = 1.1f, Height = header_height, Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0), + Velocity = 0.7f, Masking = true }, headerText = new OsuTextFlowContainer(t => From 51940133df8f938356295c017a4677058aea358b Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Fri, 17 Feb 2023 15:18:45 +0300 Subject: [PATCH 3/4] Adjust width and add comment --- osu.Game/Overlays/Mods/ModSelectColumn.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSelectColumn.cs b/osu.Game/Overlays/Mods/ModSelectColumn.cs index 843f978c13..41a6cbd549 100644 --- a/osu.Game/Overlays/Mods/ModSelectColumn.cs +++ b/osu.Game/Overlays/Mods/ModSelectColumn.cs @@ -85,7 +85,7 @@ namespace osu.Game.Overlays.Mods Anchor = Anchor.TopRight, Origin = Anchor.TopRight, RelativeSizeAxes = Axes.X, - Width = 1.1f, + Width = 1.03f, // Makes sure the sheared area is fully covered Height = header_height, Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0), Velocity = 0.7f, From ffcca9fd89db75ddf9b28bc00f3de59cdc4d5c78 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Fri, 17 Feb 2023 23:23:58 +0300 Subject: [PATCH 4/4] Remove awkward width specification --- osu.Game/Overlays/Mods/ModSelectColumn.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectColumn.cs b/osu.Game/Overlays/Mods/ModSelectColumn.cs index 41a6cbd549..e6d7bcd97d 100644 --- a/osu.Game/Overlays/Mods/ModSelectColumn.cs +++ b/osu.Game/Overlays/Mods/ModSelectColumn.cs @@ -31,8 +31,10 @@ namespace osu.Game.Overlays.Mods 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); + var trianglesColour = Colour4.FromHSV(hsv.X, hsv.Y + 0.2f, hsv.Z - 0.1f); + triangles.Colour = ColourInfo.GradientVertical(trianglesColour, trianglesColour.MultiplyAlpha(0f)); } } @@ -82,14 +84,10 @@ namespace osu.Game.Overlays.Mods }, triangles = new TrianglesV2 { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, RelativeSizeAxes = Axes.X, - Width = 1.03f, // Makes sure the sheared area is fully covered Height = header_height, Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0), Velocity = 0.7f, - Masking = true }, headerText = new OsuTextFlowContainer(t => {