1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:17:26 +08:00

Apply same changes to "argon" osu!taiko barline design that were applied to osu!mania

This commit is contained in:
Dean Herbert 2023-10-25 14:20:43 +09:00
parent 34505b3933
commit 2886d2d4c2
No known key found for this signature in database

View File

@ -4,6 +4,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
@ -14,53 +15,54 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Argon
{ {
public partial class ArgonBarLine : CompositeDrawable public partial class ArgonBarLine : CompositeDrawable
{ {
private Container majorEdgeContainer = null!;
private Bindable<bool> major = null!; private Bindable<bool> major = null!;
private Box mainLine = null!;
private Drawable topAnchor = null!;
private Drawable bottomAnchor = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(DrawableHitObject drawableHitObject) private void load(DrawableHitObject drawableHitObject)
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
const float line_offset = 8; // Avoid flickering due to no anti-aliasing of boxes by default.
var majorPieceSize = new Vector2(6, 20); var edgeSmoothness = new Vector2(0.3f);
InternalChildren = new Drawable[] AddInternal(mainLine = new Box
{
line = new Box
{
RelativeSizeAxes = Axes.Both,
EdgeSmoothness = new Vector2(0.5f, 0),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
majorEdgeContainer = new Container
{ {
Name = "Bar line",
EdgeSmoothness = edgeSmoothness,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new[] });
const float major_extension = 10;
AddInternal(topAnchor = new Box
{ {
new Circle Name = "Top anchor",
{ EdgeSmoothness = edgeSmoothness,
Name = "Top line", Blending = BlendingParameters.Additive,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
Size = majorPieceSize, Height = major_extension,
Y = -line_offset, RelativeSizeAxes = Axes.X,
}, Colour = ColourInfo.GradientVertical(Colour4.Transparent, Colour4.White),
new Circle });
AddInternal(bottomAnchor = new Box
{ {
Name = "Bottom line", Name = "Bottom anchor",
EdgeSmoothness = edgeSmoothness,
Blending = BlendingParameters.Additive,
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Size = majorPieceSize, Height = major_extension,
Y = line_offset, RelativeSizeAxes = Axes.X,
}, Colour = ColourInfo.GradientVertical(Colour4.White, Colour4.Transparent),
} });
}
};
major = ((DrawableBarLine)drawableHitObject).Major.GetBoundCopy(); major = ((DrawableBarLine)drawableHitObject).Major.GetBoundCopy();
} }
@ -71,13 +73,10 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Argon
major.BindValueChanged(updateMajor, true); major.BindValueChanged(updateMajor, true);
} }
private Box line = null!;
private void updateMajor(ValueChangedEvent<bool> major) private void updateMajor(ValueChangedEvent<bool> major)
{ {
line.Alpha = major.NewValue ? 1f : 0.5f; mainLine.Alpha = major.NewValue ? 1f : 0.5f;
line.Width = major.NewValue ? 1 : 0.5f; topAnchor.Alpha = bottomAnchor.Alpha = major.NewValue ? mainLine.Alpha * 0.3f : 0;
majorEdgeContainer.Alpha = major.NewValue ? 1 : 0;
} }
} }
} }