1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 10:27:35 +08:00
osu-lazer/osu.Game.Rulesets.Mania/Skinning/Argon/ArgonHoldNoteTailPiece.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

86 lines
3.0 KiB
C#
Raw Normal View History

2022-10-06 15:54:47 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
2022-10-06 15:54:47 +08:00
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.UI.Scrolling;
2022-10-06 15:54:47 +08:00
namespace osu.Game.Rulesets.Mania.Skinning.Argon
{
internal partial class ArgonHoldNoteTailPiece : CompositeDrawable
{
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
private readonly Container container;
2022-10-06 15:54:47 +08:00
public ArgonHoldNoteTailPiece()
{
2023-01-31 01:14:29 +08:00
// holds end at the middle of the tail,
// so we do * 2 pull up the hold body to be the height of a note
2023-01-23 15:50:50 +08:00
Height = ArgonNotePiece.NOTE_HEIGHT * 2;
RelativeSizeAxes = Axes.X;
CornerRadius = ArgonNotePiece.CORNER_RADIUS;
Masking = true;
2023-01-31 16:23:25 +08:00
InternalChildren = new Drawable[]
{
container = new Container
{
2023-02-01 09:52:58 +08:00
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.Both,
Height = 0.5f,
CornerRadius = ArgonNotePiece.CORNER_RADIUS,
Masking = true,
2023-01-31 16:23:25 +08:00
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Colour4.Black,
Alpha = 0.4f,
},
2023-02-01 09:52:58 +08:00
new Container
2023-01-31 16:23:25 +08:00
{
2023-02-01 09:52:58 +08:00
CornerRadius = ArgonNotePiece.CORNER_RADIUS,
Masking = true,
RelativeSizeAxes = Axes.Both,
Height = 1 - ArgonNotePiece.NOTE_ACCENT_RATIO,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
2023-02-01 09:52:58 +08:00
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Colour4.Black,
Alpha = 0.3f,
}
}
},
},
}
};
}
[BackgroundDependencyLoader(true)]
private void load(IScrollingInfo scrollingInfo)
{
direction.BindTo(scrollingInfo.Direction);
direction.BindValueChanged(onDirectionChanged, true);
}
private void onDirectionChanged(ValueChangedEvent<ScrollingDirection> direction)
{
2023-02-01 09:52:58 +08:00
Scale = new osuTK.Vector2(1, direction.NewValue == ScrollingDirection.Up ? -1 : 1);
2022-10-06 15:54:47 +08:00
}
}
}