diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index ed5db58418..5d1daeb582 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -27,6 +27,7 @@ class BeatmapPanel : Panel public Action GainedSelection; public Action StartRequested; + private Triangles triangles; protected override void Selected() { @@ -36,6 +37,8 @@ protected override void Selected() background.ColourInfo = ColourInfo.GradientVertical( new Color4(20, 43, 51, 255), new Color4(40, 86, 102, 255)); + + triangles.Colour = Color4.White; } protected override void Deselected() @@ -43,6 +46,7 @@ protected override void Deselected() base.Deselected(); background.Colour = new Color4(20, 43, 51, 255); + triangles.Colour = OsuColour.Gray(0.5f); } protected override bool OnClick(InputState state) @@ -64,15 +68,11 @@ public BeatmapPanel(BeatmapInfo beatmap) { RelativeSizeAxes = Axes.Both, }, - new Triangles + triangles = new Triangles { - // The border is drawn in the shader of the children. Being additive, triangles would over-emphasize - // the border wherever they cross it, and thus they get their own masking container without a border. - Masking = true, - CornerRadius = Content.CornerRadius, RelativeSizeAxes = Axes.Both, - BlendingMode = BlendingMode.Additive, - Colour = new Color4(20, 43, 51, 255), + ColourLight = OsuColour.FromHex(@"3a7285"), + ColourDark = OsuColour.FromHex(@"123744") }, new FlowContainer { diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index b68b5ebc4a..f9bcf56d12 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Textures; using osu.Framework.MathUtils; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Graphics.Backgrounds { @@ -17,10 +18,8 @@ public class Triangles : Container { public override bool HandleInput => false; - public Triangles() - { - Alpha = 0.3f; - } + public Color4 ColourLight = Color4.White; + public Color4 ColourDark = Color4.Black; private float triangleScale = 1; @@ -65,12 +64,14 @@ protected virtual Triangle CreateTriangle() RelativePositionAxes = Axes.Both, Scale = new Vector2(scale), // Scaling height by 0.866 results in equiangular triangles (== 60° and equal side length) + Colour = GetTriangleShade(), Size = new Vector2(size, 0.866f * size), - Alpha = RNG.NextSingle(), Depth = scale, }; } + protected virtual Color4 GetTriangleShade() => Interpolation.ValueAt(RNG.NextSingle(), ColourDark, ColourLight, 0, 1); + private void addTriangle(bool randomX) { var sprite = CreateTriangle(); diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 7ede4cefbf..af552c6bb6 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -110,8 +110,11 @@ public OsuLogo() RelativeSizeAxes = Axes.Both, Colour = OsuPink, }, - new OsuLogoTriangles + new Triangles { + TriangleScale = 4, + ColourLight = OsuColour.FromHex(@"ff7db7"), + ColourDark = OsuColour.FromHex(@"de5b95"), RelativeSizeAxes = Axes.Both, }, } @@ -218,35 +221,5 @@ protected override void OnHoverLost(InputState state) { logoHoverContainer.ScaleTo(1, 500, EasingTypes.OutElastic); } - - class OsuLogoTriangles : Triangles - { - public Color4 OsuPinkLight = OsuColour.FromHex(@"ff7db7"); - public Color4 OsuPinkDark = OsuColour.FromHex(@"de5b95"); - - public OsuLogoTriangles() - { - TriangleScale = 4; - Alpha = 1; - - } - - protected override Triangle CreateTriangle() - { - var triangle = base.CreateTriangle(); - triangle.Alpha = 1; - triangle.Colour = getTriangleShade(); - return triangle; - } - - private Color4 getTriangleShade() - { - float val = RNG.NextSingle(); - return Interpolation.ValueAt(val, - OsuPinkDark, - OsuPinkLight, - 0, 1); - } - } } } \ No newline at end of file