2019-10-28 11:42:17 +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
|
|
|
|
|
2019-10-27 14:19:36 +08:00
|
|
|
using osu.Framework.Allocation;
|
2019-11-06 13:36:43 +08:00
|
|
|
using osu.Framework.Bindables;
|
2021-09-06 20:05:43 +08:00
|
|
|
using osu.Framework.Graphics;
|
2019-10-27 14:19:36 +08:00
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2022-11-20 09:12:50 +08:00
|
|
|
using osu.Game.Configuration;
|
2019-10-28 15:21:31 +08:00
|
|
|
using osu.Game.Graphics.UserInterfaceV2;
|
2022-11-20 09:12:50 +08:00
|
|
|
using osu.Game.Rulesets.UI.Scrolling;
|
2019-10-27 14:19:36 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit.Timing
|
|
|
|
{
|
|
|
|
internal class EffectSection : Section<EffectControlPoint>
|
|
|
|
{
|
2019-10-28 15:21:31 +08:00
|
|
|
private LabelledSwitchButton kiai;
|
|
|
|
private LabelledSwitchButton omitBarLine;
|
2019-10-27 14:19:36 +08:00
|
|
|
|
2021-09-06 20:05:43 +08:00
|
|
|
private SliderWithTextBoxInput<double> scrollSpeedSlider;
|
|
|
|
|
2019-10-27 14:19:36 +08:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2021-09-06 20:05:43 +08:00
|
|
|
Flow.AddRange(new Drawable[]
|
2019-10-27 14:19:36 +08:00
|
|
|
{
|
2019-10-28 15:21:31 +08:00
|
|
|
kiai = new LabelledSwitchButton { Label = "Kiai Time" },
|
|
|
|
omitBarLine = new LabelledSwitchButton { Label = "Skip Bar Line" },
|
2021-09-06 20:05:43 +08:00
|
|
|
scrollSpeedSlider = new SliderWithTextBoxInput<double>("Scroll Speed")
|
|
|
|
{
|
|
|
|
Current = new EffectControlPoint().ScrollSpeedBindable,
|
|
|
|
KeyboardStep = 0.1f
|
|
|
|
}
|
2019-10-27 14:19:36 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-06-02 02:25:56 +08:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
kiai.Current.BindValueChanged(_ => saveChanges());
|
|
|
|
omitBarLine.Current.BindValueChanged(_ => saveChanges());
|
|
|
|
scrollSpeedSlider.Current.BindValueChanged(_ => saveChanges());
|
|
|
|
|
2022-11-20 09:12:50 +08:00
|
|
|
var drawableRuleset = Beatmap.BeatmapInfo.Ruleset.CreateInstance().CreateDrawableRulesetWith(Beatmap.PlayableBeatmap);
|
|
|
|
if (drawableRuleset is not IDrawableScrollingRuleset scrollingRuleset || scrollingRuleset.VisualisationMethod == ScrollVisualisationMethod.Constant)
|
2022-11-19 11:40:20 +08:00
|
|
|
scrollSpeedSlider.Hide();
|
|
|
|
|
2022-06-02 02:25:56 +08:00
|
|
|
void saveChanges()
|
|
|
|
{
|
|
|
|
if (!isRebinding) ChangeHandler?.SaveState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private bool isRebinding;
|
|
|
|
|
2019-11-06 13:36:43 +08:00
|
|
|
protected override void OnControlPointChanged(ValueChangedEvent<EffectControlPoint> point)
|
2019-10-27 14:19:36 +08:00
|
|
|
{
|
2019-11-06 15:22:55 +08:00
|
|
|
if (point.NewValue != null)
|
2019-10-27 14:19:36 +08:00
|
|
|
{
|
2022-06-02 02:25:56 +08:00
|
|
|
isRebinding = true;
|
2020-10-02 16:56:30 +08:00
|
|
|
|
2022-06-02 02:25:56 +08:00
|
|
|
kiai.Current = point.NewValue.KiaiModeBindable;
|
2019-11-06 15:22:55 +08:00
|
|
|
omitBarLine.Current = point.NewValue.OmitFirstBarLineBindable;
|
2021-09-06 20:05:43 +08:00
|
|
|
scrollSpeedSlider.Current = point.NewValue.ScrollSpeedBindable;
|
2022-06-02 02:25:56 +08:00
|
|
|
|
|
|
|
isRebinding = false;
|
2019-11-06 15:22:55 +08:00
|
|
|
}
|
2019-10-27 14:19:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override EffectControlPoint CreatePoint()
|
|
|
|
{
|
2021-01-04 15:38:15 +08:00
|
|
|
var reference = Beatmap.ControlPointInfo.EffectPointAt(SelectedGroup.Value.Time);
|
2019-10-27 14:19:36 +08:00
|
|
|
|
|
|
|
return new EffectControlPoint
|
|
|
|
{
|
|
|
|
KiaiMode = reference.KiaiMode,
|
2021-09-06 20:05:43 +08:00
|
|
|
OmitFirstBarLine = reference.OmitFirstBarLine,
|
|
|
|
ScrollSpeed = reference.ScrollSpeed,
|
2019-10-27 14:19:36 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|