1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:07:25 +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 Name = "Bar line",
{ EdgeSmoothness = edgeSmoothness,
RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre,
EdgeSmoothness = new Vector2(0.5f, 0), Origin = Anchor.Centre,
Anchor = Anchor.Centre, RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre, });
},
majorEdgeContainer = new Container const float major_extension = 10;
{
Anchor = Anchor.Centre, AddInternal(topAnchor = new Box
Origin = Anchor.Centre, {
RelativeSizeAxes = Axes.Both, Name = "Top anchor",
Children = new[] EdgeSmoothness = edgeSmoothness,
{ Blending = BlendingParameters.Additive,
new Circle Anchor = Anchor.TopCentre,
{ Origin = Anchor.BottomCentre,
Name = "Top line", Height = major_extension,
Anchor = Anchor.TopCentre, RelativeSizeAxes = Axes.X,
Origin = Anchor.BottomCentre, Colour = ColourInfo.GradientVertical(Colour4.Transparent, Colour4.White),
Size = majorPieceSize, });
Y = -line_offset,
}, AddInternal(bottomAnchor = new Box
new Circle {
{ Name = "Bottom anchor",
Name = "Bottom line", EdgeSmoothness = edgeSmoothness,
Anchor = Anchor.BottomCentre, Blending = BlendingParameters.Additive,
Origin = Anchor.TopCentre, Anchor = Anchor.BottomCentre,
Size = majorPieceSize, Origin = Anchor.TopCentre,
Y = line_offset, Height = major_extension,
}, 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;
} }
} }
} }