From bfc6bfc91b19a1fc9fb57518e490b81d9c09b8c3 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 28 Apr 2022 05:50:55 +0300 Subject: [PATCH] Let `CatchHitObjectComposer` inherit from `DistancedHitObjectComposer` and hide control --- .../Edit/CatchHitObjectComposer.cs | 9 +++++---- .../Edit/DistancedHitObjectComposer.cs | 20 +++++++++++-------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs index b3e6fe382a..a90b0d3e89 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs @@ -24,10 +24,7 @@ namespace osu.Game.Rulesets.Catch.Edit { - /// - /// todo: should inherit once it supports distance spacing properly. - /// - public class CatchHitObjectComposer : HitObjectComposer + public class CatchHitObjectComposer : DistancedHitObjectComposer { 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, diff --git a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs index a3624f6d77..d0c9babf24 100644 --- a/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/DistancedHitObjectComposer.cs @@ -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;