1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-18 13:53:20 +08:00
osu-lazer/osu.Game.Rulesets.Osu/Skinning/Argon/ArgonSliderBody.cs

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

41 lines
1.4 KiB
C#
Raw Normal View History

2022-09-19 13:38:21 +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.Extensions.Color4Extensions;
using osu.Game.Rulesets.Osu.Skinning.Default;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.Skinning.Argon
{
public class ArgonSliderBody : PlaySliderBody
{
protected override void LoadComplete()
{
2022-09-19 16:05:36 +08:00
const float path_radius = ArgonMainCirclePiece.OUTER_GRADIENT_SIZE / 2;
2022-09-19 13:38:21 +08:00
base.LoadComplete();
2022-09-19 16:05:36 +08:00
AccentColourBindable.BindValueChanged(accent => BorderColour = accent.NewValue, true);
ScaleBindable.BindValueChanged(scale => PathRadius = path_radius * scale.NewValue, true);
// This border size thing is kind of weird, hey.
const float intended_thickness = ArgonMainCirclePiece.GRADIENT_THICKNESS / path_radius;
2022-09-19 13:38:21 +08:00
2022-09-19 16:05:36 +08:00
BorderSize = intended_thickness / Default.DrawableSliderPath.BORDER_PORTION;
2022-09-19 13:38:21 +08:00
}
protected override Default.DrawableSliderPath CreateSliderPath() => new DrawableSliderPath();
private class DrawableSliderPath : Default.DrawableSliderPath
{
protected override Color4 ColourAt(float position)
{
if (CalculatedBorderPortion != 0f && position <= CalculatedBorderPortion)
return BorderColour;
return AccentColour.Darken(4);
}
}
}
}