mirror of
https://github.com/ppy/osu
synced 2024-12-11 17:42:28 +00:00
Make triangles opaque.
This commit is contained in:
parent
a315db68ab
commit
f0d30cc873
@ -27,6 +27,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
|
|
||||||
public Action<BeatmapPanel> GainedSelection;
|
public Action<BeatmapPanel> GainedSelection;
|
||||||
public Action<BeatmapPanel> StartRequested;
|
public Action<BeatmapPanel> StartRequested;
|
||||||
|
private Triangles triangles;
|
||||||
|
|
||||||
protected override void Selected()
|
protected override void Selected()
|
||||||
{
|
{
|
||||||
@ -36,6 +37,8 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
background.ColourInfo = ColourInfo.GradientVertical(
|
background.ColourInfo = ColourInfo.GradientVertical(
|
||||||
new Color4(20, 43, 51, 255),
|
new Color4(20, 43, 51, 255),
|
||||||
new Color4(40, 86, 102, 255));
|
new Color4(40, 86, 102, 255));
|
||||||
|
|
||||||
|
triangles.Colour = Color4.White;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Deselected()
|
protected override void Deselected()
|
||||||
@ -43,6 +46,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
base.Deselected();
|
base.Deselected();
|
||||||
|
|
||||||
background.Colour = new Color4(20, 43, 51, 255);
|
background.Colour = new Color4(20, 43, 51, 255);
|
||||||
|
triangles.Colour = OsuColour.Gray(0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(InputState state)
|
protected override bool OnClick(InputState state)
|
||||||
@ -64,15 +68,11 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
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,
|
RelativeSizeAxes = Axes.Both,
|
||||||
BlendingMode = BlendingMode.Additive,
|
ColourLight = OsuColour.FromHex(@"3a7285"),
|
||||||
Colour = new Color4(20, 43, 51, 255),
|
ColourDark = OsuColour.FromHex(@"123744")
|
||||||
},
|
},
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Backgrounds
|
namespace osu.Game.Graphics.Backgrounds
|
||||||
{
|
{
|
||||||
@ -17,10 +18,8 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
{
|
{
|
||||||
public override bool HandleInput => false;
|
public override bool HandleInput => false;
|
||||||
|
|
||||||
public Triangles()
|
public Color4 ColourLight = Color4.White;
|
||||||
{
|
public Color4 ColourDark = Color4.Black;
|
||||||
Alpha = 0.3f;
|
|
||||||
}
|
|
||||||
|
|
||||||
private float triangleScale = 1;
|
private float triangleScale = 1;
|
||||||
|
|
||||||
@ -65,12 +64,14 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
RelativePositionAxes = Axes.Both,
|
RelativePositionAxes = Axes.Both,
|
||||||
Scale = new Vector2(scale),
|
Scale = new Vector2(scale),
|
||||||
// Scaling height by 0.866 results in equiangular triangles (== 60° and equal side length)
|
// Scaling height by 0.866 results in equiangular triangles (== 60° and equal side length)
|
||||||
|
Colour = GetTriangleShade(),
|
||||||
Size = new Vector2(size, 0.866f * size),
|
Size = new Vector2(size, 0.866f * size),
|
||||||
Alpha = RNG.NextSingle(),
|
|
||||||
Depth = scale,
|
Depth = scale,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual Color4 GetTriangleShade() => Interpolation.ValueAt(RNG.NextSingle(), ColourDark, ColourLight, 0, 1);
|
||||||
|
|
||||||
private void addTriangle(bool randomX)
|
private void addTriangle(bool randomX)
|
||||||
{
|
{
|
||||||
var sprite = CreateTriangle();
|
var sprite = CreateTriangle();
|
||||||
|
@ -110,8 +110,11 @@ namespace osu.Game.Screens.Menu
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = OsuPink,
|
Colour = OsuPink,
|
||||||
},
|
},
|
||||||
new OsuLogoTriangles
|
new Triangles
|
||||||
{
|
{
|
||||||
|
TriangleScale = 4,
|
||||||
|
ColourLight = OsuColour.FromHex(@"ff7db7"),
|
||||||
|
ColourDark = OsuColour.FromHex(@"de5b95"),
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -218,35 +221,5 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
logoHoverContainer.ScaleTo(1, 500, EasingTypes.OutElastic);
|
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
Block a user