mirror of https://github.com/ppy/osu
Make triangles opaque.
This commit is contained in:
parent
a315db68ab
commit
f0d30cc873
|
@ -27,6 +27,7 @@ class BeatmapPanel : Panel
|
|||
|
||||
public Action<BeatmapPanel> GainedSelection;
|
||||
public Action<BeatmapPanel> 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
|
||||
{
|
||||
|
|
|
@ -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<Triangle>
|
|||
{
|
||||
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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue