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

View File

@ -45,6 +45,7 @@ namespace osu.Game.Rulesets.Edit
{ {
AddInternal(RightSideToolboxContainer = new ExpandingToolboxContainer AddInternal(RightSideToolboxContainer = new ExpandingToolboxContainer
{ {
Alpha = DistanceSpacingMultiplier.Disabled ? 0 : 1,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Child = new EditorToolboxGroup("snapping") Child = new EditorToolboxGroup("snapping")
@ -62,18 +63,21 @@ namespace osu.Game.Rulesets.Edit
{ {
base.LoadComplete(); base.LoadComplete();
DistanceSpacingMultiplier.Value = EditorBeatmap.BeatmapInfo.DistanceSpacing; if (!DistanceSpacingMultiplier.Disabled)
DistanceSpacingMultiplier.BindValueChanged(v =>
{ {
distanceSpacingSlider.ContractedLabelText = $"D. S. ({v.NewValue:0.##x})"; DistanceSpacingMultiplier.Value = EditorBeatmap.BeatmapInfo.DistanceSpacing;
distanceSpacingSlider.ExpandedLabelText = $"Distance Spacing ({v.NewValue:0.##x})"; DistanceSpacingMultiplier.BindValueChanged(v =>
EditorBeatmap.BeatmapInfo.DistanceSpacing = v.NewValue; {
}, true); 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) 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; RightSideToolboxContainer.Expanded.Value = true;
distanceSpacingScrollActive = true; distanceSpacingScrollActive = true;
@ -85,7 +89,7 @@ namespace osu.Game.Rulesets.Edit
protected override void OnKeyUp(KeyUpEvent 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; RightSideToolboxContainer.Expanded.Value = false;
distanceSpacingScrollActive = false; distanceSpacingScrollActive = false;