1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 09:17:52 +08:00
osu-lazer/osu.Game/Screens/Edit/Timing/RowAttributes/EffectRowAttribute.cs

53 lines
1.9 KiB
C#
Raw Normal View History

// 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
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Screens.Edit.Timing.RowAttributes
{
2022-11-24 13:32:20 +08:00
public partial class EffectRowAttribute : RowAttribute
{
private readonly Bindable<bool> kiaiMode;
private readonly Bindable<bool> omitBarLine;
private readonly BindableNumber<double> scrollSpeed;
2021-04-19 16:57:07 +08:00
private AttributeText kiaiModeBubble;
private AttributeText omitBarLineBubble;
private AttributeText text;
public EffectRowAttribute(EffectControlPoint effect)
: base(effect, "effect")
{
kiaiMode = effect.KiaiModeBindable.GetBoundCopy();
omitBarLine = effect.OmitFirstBarLineBindable.GetBoundCopy();
scrollSpeed = effect.ScrollSpeedBindable.GetBoundCopy();
}
[BackgroundDependencyLoader]
private void load()
{
Content.AddRange(new Drawable[]
{
new AttributeProgressBar(Point)
{
Current = scrollSpeed,
},
text = new AttributeText(Point) { Width = 45 },
2021-04-19 16:57:07 +08:00
kiaiModeBubble = new AttributeText(Point) { Text = "kiai" },
omitBarLineBubble = new AttributeText(Point) { Text = "no barline" },
});
kiaiMode.BindValueChanged(enabled => kiaiModeBubble.FadeTo(enabled.NewValue ? 1 : 0), true);
omitBarLine.BindValueChanged(enabled => omitBarLineBubble.FadeTo(enabled.NewValue ? 1 : 0), true);
scrollSpeed.BindValueChanged(_ => updateText(), true);
}
private void updateText() => text.Text = $"{scrollSpeed.Value:n2}x";
}
}