2023-09-01 10:49:57 +00: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.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2023-10-17 07:01:00 +00:00
|
|
|
using osu.Game.Configuration;
|
2023-09-01 10:49:57 +00:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
using osu.Game.Rulesets.Objects;
|
|
|
|
using osu.Game.Rulesets.UI.Scrolling;
|
|
|
|
using osu.Game.Screens.Edit.Components.TernaryButtons;
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Edit
|
|
|
|
{
|
|
|
|
public abstract partial class ScrollingHitObjectComposer<TObject> : HitObjectComposer<TObject>
|
|
|
|
where TObject : HitObject
|
|
|
|
{
|
|
|
|
private readonly Bindable<TernaryState> showSpeedChanges = new Bindable<TernaryState>();
|
2023-10-17 07:01:00 +00:00
|
|
|
private Bindable<bool> configShowSpeedChanges = null!;
|
2023-09-01 10:49:57 +00:00
|
|
|
|
|
|
|
protected ScrollingHitObjectComposer(Ruleset ruleset)
|
|
|
|
: base(ruleset)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2023-10-17 07:01:00 +00:00
|
|
|
private void load(OsuConfigManager config)
|
2023-09-01 10:49:57 +00:00
|
|
|
{
|
2023-09-20 06:27:30 +00:00
|
|
|
if (DrawableRuleset is ISupportConstantAlgorithmToggle toggleRuleset)
|
2023-09-01 10:49:57 +00:00
|
|
|
{
|
2023-09-20 06:27:30 +00:00
|
|
|
LeftToolbox.Add(new EditorToolboxGroup("playfield")
|
2023-09-01 10:49:57 +00:00
|
|
|
{
|
2023-09-20 06:27:30 +00:00
|
|
|
Child = new FillFlowContainer
|
2023-09-01 10:49:57 +00:00
|
|
|
{
|
2023-09-20 06:27:30 +00:00
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
Spacing = new Vector2(0, 5),
|
|
|
|
Children = new[]
|
2023-09-01 10:49:57 +00:00
|
|
|
{
|
2023-09-20 06:27:30 +00:00
|
|
|
new DrawableTernaryButton(new TernaryButton(showSpeedChanges, "Show speed changes", () => new SpriteIcon { Icon = FontAwesome.Solid.TachometerAlt }))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
2023-09-01 10:49:57 +00:00
|
|
|
|
2023-10-17 07:01:00 +00:00
|
|
|
configShowSpeedChanges = config.GetBindable<bool>(OsuSetting.EditorShowSpeedChanges);
|
|
|
|
configShowSpeedChanges.BindValueChanged(enabled => showSpeedChanges.Value = enabled.NewValue ? TernaryState.True : TernaryState.False, true);
|
|
|
|
|
|
|
|
showSpeedChanges.BindValueChanged(state =>
|
|
|
|
{
|
|
|
|
bool enabled = state.NewValue == TernaryState.True;
|
|
|
|
|
|
|
|
toggleRuleset.ShowSpeedChanges.Value = enabled;
|
|
|
|
configShowSpeedChanges.Value = enabled;
|
|
|
|
}, true);
|
2023-09-01 10:49:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|