2022-10-06 07:54:47 +00: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.Extensions.Color4Extensions;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
2022-10-07 11:05:08 +00:00
|
|
|
using osu.Game.Rulesets.Mania.Skinning.Default;
|
2022-10-06 07:54:47 +00:00
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Skinning.Argon
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Represents length-wise portion of a hold note.
|
|
|
|
/// </summary>
|
2022-10-07 11:05:08 +00:00
|
|
|
public partial class ArgonHoldBodyPiece : CompositeDrawable, IHoldNoteBody
|
2022-10-06 07:54:47 +00:00
|
|
|
{
|
|
|
|
protected readonly Bindable<Color4> AccentColour = new Bindable<Color4>();
|
|
|
|
|
|
|
|
private Drawable background = null!;
|
2023-03-14 07:59:18 +00:00
|
|
|
private ArgonHoldNoteHittingLayer hittingLayer = null!;
|
2022-10-06 07:54:47 +00:00
|
|
|
|
|
|
|
public ArgonHoldBodyPiece()
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
// Without this, the width of the body will be slightly larger than the head/tail.
|
|
|
|
Masking = true;
|
|
|
|
CornerRadius = ArgonNotePiece.CORNER_RADIUS;
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader(true)]
|
|
|
|
private void load(DrawableHitObject? drawableObject)
|
|
|
|
{
|
|
|
|
InternalChildren = new[]
|
|
|
|
{
|
|
|
|
background = new Box { RelativeSizeAxes = Axes.Both },
|
2023-03-14 07:59:18 +00:00
|
|
|
hittingLayer = new ArgonHoldNoteHittingLayer()
|
2022-10-06 07:54:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (drawableObject != null)
|
|
|
|
{
|
|
|
|
var holdNote = (DrawableHoldNote)drawableObject;
|
|
|
|
|
2022-10-07 11:05:08 +00:00
|
|
|
AccentColour.BindTo(holdNote.AccentColour);
|
2023-03-14 07:59:18 +00:00
|
|
|
hittingLayer.AccentColour.BindTo(holdNote.AccentColour);
|
|
|
|
((IBindable<bool>)hittingLayer.IsHitting).BindTo(holdNote.IsHitting);
|
2022-10-06 07:54:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AccentColour.BindValueChanged(colour =>
|
|
|
|
{
|
2023-03-09 11:42:59 +00:00
|
|
|
background.Colour = colour.NewValue.Darken(0.6f);
|
2022-10-06 07:54:47 +00:00
|
|
|
}, true);
|
|
|
|
}
|
2022-10-07 11:05:08 +00:00
|
|
|
|
|
|
|
public void Recycle()
|
|
|
|
{
|
2023-03-14 07:59:18 +00:00
|
|
|
hittingLayer.Recycle();
|
2022-10-07 11:05:08 +00:00
|
|
|
}
|
2022-10-06 07:54:47 +00:00
|
|
|
}
|
|
|
|
}
|