mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 06:52:55 +08:00
Add lane glows.
This commit is contained in:
parent
0765027cb5
commit
57ee97e27d
@ -18,6 +18,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
{
|
||||
protected readonly GlowPiece GlowPiece;
|
||||
|
||||
private readonly LaneGlowPiece laneGlowPiece;
|
||||
private readonly NotePiece headPiece;
|
||||
|
||||
public DrawableNote(Note hitObject, ManiaAction action)
|
||||
@ -28,6 +29,11 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
laneGlowPiece = new LaneGlowPiece
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
},
|
||||
GlowPiece = new GlowPiece(),
|
||||
headPiece = new NotePiece
|
||||
{
|
||||
@ -46,6 +52,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
return;
|
||||
base.AccentColour = value;
|
||||
|
||||
laneGlowPiece.AccentColour = value;
|
||||
GlowPiece.AccentColour = value;
|
||||
headPiece.AccentColour = value;
|
||||
}
|
||||
|
@ -0,0 +1,82 @@
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
|
||||
{
|
||||
public class LaneGlowPiece : CompositeDrawable, IHasAccentColour
|
||||
{
|
||||
private const float total_height = 100;
|
||||
private const float glow_height = 50;
|
||||
private const float glow_alpha = 0.4f;
|
||||
private const float edge_alpha = 0.3f;
|
||||
|
||||
public LaneGlowPiece()
|
||||
{
|
||||
BypassAutoSizeAxes = Axes.Both;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = total_height;
|
||||
|
||||
InternalChildren = new[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
Name = "Left edge",
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = 1,
|
||||
Children = createGradient(edge_alpha)
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Name = "Right edge",
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = 1,
|
||||
Children = createGradient(edge_alpha)
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Name = "Glow",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = glow_height,
|
||||
Children = createGradient(glow_alpha)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Drawable[] createGradient(float alpha) => new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Name = "Top",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Height = 0.5f,
|
||||
Blending = BlendingMode.Additive,
|
||||
Colour = ColourInfo.GradientVertical(Color4.Transparent, Color4.White.Opacity(alpha))
|
||||
},
|
||||
new Box
|
||||
{
|
||||
Name = "Bottom",
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Height = 0.5f,
|
||||
Blending = BlendingMode.Additive,
|
||||
Colour = ColourInfo.GradientVertical(Color4.White.Opacity(alpha), Color4.Transparent)
|
||||
}
|
||||
};
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return Colour; }
|
||||
set { Colour = value; }
|
||||
}
|
||||
}
|
||||
}
|
@ -71,6 +71,7 @@
|
||||
<Compile Include="Objects\Drawables\DrawableNote.cs" />
|
||||
<Compile Include="Objects\Drawables\Pieces\BodyPiece.cs" />
|
||||
<Compile Include="Objects\Drawables\Pieces\GlowPiece.cs" />
|
||||
<Compile Include="Objects\Drawables\Pieces\LaneGlowPiece.cs" />
|
||||
<Compile Include="Objects\Drawables\Pieces\NotePiece.cs" />
|
||||
<Compile Include="Objects\Types\IHasColumn.cs" />
|
||||
<Compile Include="Scoring\ManiaScoreProcessor.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user