2021-04-19 14:57:27 +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.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2021-04-19 14:57:27 +08:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit.Timing.RowAttributes
|
|
|
|
{
|
2022-11-24 13:32:20 +08:00
|
|
|
public partial class DifficultyRowAttribute : RowAttribute
|
2021-04-19 14:57:27 +08:00
|
|
|
{
|
|
|
|
private readonly BindableNumber<double> speedMultiplier;
|
|
|
|
|
|
|
|
private OsuSpriteText text;
|
|
|
|
|
|
|
|
public DifficultyRowAttribute(DifficultyControlPoint difficulty)
|
|
|
|
: base(difficulty, "difficulty")
|
|
|
|
{
|
2021-08-31 22:59:36 +08:00
|
|
|
speedMultiplier = difficulty.SliderVelocityBindable.GetBoundCopy();
|
2021-04-19 14:57:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
|
|
|
Content.AddRange(new Drawable[]
|
|
|
|
{
|
|
|
|
new AttributeProgressBar(Point)
|
|
|
|
{
|
|
|
|
Current = speedMultiplier,
|
2021-04-19 16:57:07 +08:00
|
|
|
},
|
|
|
|
text = new AttributeText(Point)
|
|
|
|
{
|
2021-09-06 20:40:30 +08:00
|
|
|
Width = 45,
|
2021-04-19 16:57:07 +08:00
|
|
|
},
|
2021-04-19 14:57:27 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
speedMultiplier.BindValueChanged(_ => updateText(), true);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void updateText() => text.Text = $"{speedMultiplier.Value:n2}x";
|
|
|
|
}
|
|
|
|
}
|