2021-04-19 15:28:18 +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;
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit.Timing.RowAttributes
|
|
|
|
{
|
|
|
|
public partial class EffectRowAttribute : RowAttribute
|
|
|
|
{
|
|
|
|
private readonly Bindable<bool> kiaiMode;
|
2021-09-06 20:05:43 +08:00
|
|
|
private readonly BindableNumber<double> scrollSpeed;
|
|
|
|
|
2023-01-14 07:23:21 +08:00
|
|
|
private AttributeText kiaiModeBubble = null!;
|
|
|
|
private AttributeText text = null!;
|
2024-08-16 20:43:33 +08:00
|
|
|
private AttributeProgressBar progressBar = null!;
|
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
protected EditorBeatmap Beatmap { get; private set; } = null!;
|
2021-04-19 15:28:18 +08:00
|
|
|
|
|
|
|
public EffectRowAttribute(EffectControlPoint effect)
|
|
|
|
: base(effect, "effect")
|
|
|
|
{
|
|
|
|
kiaiMode = effect.KiaiModeBindable.GetBoundCopy();
|
2021-09-06 20:05:43 +08:00
|
|
|
scrollSpeed = effect.ScrollSpeedBindable.GetBoundCopy();
|
2021-04-19 15:28:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
|
|
|
Content.AddRange(new Drawable[]
|
|
|
|
{
|
2024-08-16 20:43:33 +08:00
|
|
|
progressBar = new AttributeProgressBar(Point)
|
2021-09-06 20:05:43 +08:00
|
|
|
{
|
|
|
|
Current = scrollSpeed,
|
|
|
|
},
|
2021-09-06 20:40:30 +08:00
|
|
|
text = new AttributeText(Point) { Width = 45 },
|
2021-04-19 16:57:07 +08:00
|
|
|
kiaiModeBubble = new AttributeText(Point) { Text = "kiai" },
|
2021-04-19 15:28:18 +08:00
|
|
|
});
|
|
|
|
|
2024-08-23 01:53:34 +08:00
|
|
|
if (!Beatmap.BeatmapInfo.Ruleset.CreateInstance().EditorShowScrollSpeed)
|
2024-08-16 20:43:33 +08:00
|
|
|
{
|
|
|
|
text.Hide();
|
|
|
|
progressBar.Hide();
|
|
|
|
}
|
|
|
|
|
2021-04-19 15:28:18 +08:00
|
|
|
kiaiMode.BindValueChanged(enabled => kiaiModeBubble.FadeTo(enabled.NewValue ? 1 : 0), true);
|
2021-09-06 20:40:30 +08:00
|
|
|
scrollSpeed.BindValueChanged(_ => updateText(), true);
|
2021-04-19 15:28:18 +08:00
|
|
|
}
|
2021-09-06 20:40:30 +08:00
|
|
|
|
|
|
|
private void updateText() => text.Text = $"{scrollSpeed.Value:n2}x";
|
2021-04-19 15:28:18 +08:00
|
|
|
}
|
|
|
|
}
|