Let `CatchHitObjectComposer` inherit from `DistancedHitObjectComposer` and hide control

This commit is contained in:
Salman Ahmed 2022-04-28 05:50:55 +03:00
parent 835898dd30
commit bfc6bfc91b
2 changed files with 17 additions and 12 deletions

View File

@ -24,10 +24,7 @@
namespace osu.Game.Rulesets.Catch.Edit
{
/// <remarks>
/// todo: should inherit <see cref="IDistanceSnapProvider"/> once it supports distance spacing properly.
/// </remarks>
public class CatchHitObjectComposer : HitObjectComposer<CatchHitObject>
public class CatchHitObjectComposer : DistancedHitObjectComposer<CatchHitObject>
{
private const float distance_snap_radius = 50;
@ -45,6 +42,10 @@ public CatchHitObjectComposer(CatchRuleset ruleset)
[BackgroundDependencyLoader]
private void load()
{
// todo: enable distance spacing once catch supports it.
RightSideToolboxContainer.Alpha = 0;
DistanceSpacingMultiplier.Disabled = true;
LayerBelowRuleset.Add(new PlayfieldBorder
{
RelativeSizeAxes = Axes.Both,

View File

@ -45,6 +45,7 @@ private void load()
{
AddInternal(RightSideToolboxContainer = new ExpandingToolboxContainer
{
Alpha = DistanceSpacingMultiplier.Disabled ? 0 : 1,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Child = new EditorToolboxGroup("snapping")
@ -62,18 +63,21 @@ protected override void LoadComplete()
{
base.LoadComplete();
DistanceSpacingMultiplier.Value = EditorBeatmap.BeatmapInfo.DistanceSpacing;
DistanceSpacingMultiplier.BindValueChanged(v =>
if (!DistanceSpacingMultiplier.Disabled)
{
distanceSpacingSlider.ContractedLabelText = $"D. S. ({v.NewValue:0.##x})";
distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({v.NewValue:0.##x})";
EditorBeatmap.BeatmapInfo.DistanceSpacing = v.NewValue;
}, true);
DistanceSpacingMultiplier.Value = EditorBeatmap.BeatmapInfo.DistanceSpacing;
DistanceSpacingMultiplier.BindValueChanged(v =>
{
distanceSpacingSlider.ContractedLabelText = $"D. S. ({v.NewValue:0.##x})";
distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({v.NewValue:0.##x})";
EditorBeatmap.BeatmapInfo.DistanceSpacing = v.NewValue;
}, true);
}
}
protected override bool OnKeyDown(KeyDownEvent e)
{
if (e.ControlPressed && e.AltPressed && !e.Repeat)
if (!DistanceSpacingMultiplier.Disabled && e.ControlPressed && e.AltPressed && !e.Repeat)
{
RightSideToolboxContainer.Expanded.Value = true;
distanceSpacingScrollActive = true;
@ -85,7 +89,7 @@ protected override bool OnKeyDown(KeyDownEvent e)
protected override void OnKeyUp(KeyUpEvent e)
{
if (distanceSpacingScrollActive && (!e.AltPressed || !e.ControlPressed))
if (!DistanceSpacingMultiplier.Disabled && distanceSpacingScrollActive && (!e.AltPressed || !e.ControlPressed))
{
RightSideToolboxContainer.Expanded.Value = false;
distanceSpacingScrollActive = false;