From 74b86349d58e5169e52bbdc70cef3dec81579a74 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 Oct 2023 23:57:36 +0900 Subject: [PATCH] Tidy up `CatchHitObjectComposer` --- .../Edit/CatchHitObjectComposer.cs | 56 ++++++------------- 1 file changed, 17 insertions(+), 39 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs index 9b258841b2..6f0ee260ab 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Beatmaps; -using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.UI; @@ -75,6 +74,23 @@ namespace osu.Game.Rulesets.Catch.Edit => base.CreateTernaryButtons() .Concat(DistanceSnapProvider.CreateTernaryButtons()); + protected override DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods) => + new DrawableCatchEditorRuleset(ruleset, beatmap, mods) + { + TimeRangeMultiplier = { BindTarget = timeRangeMultiplier, } + }; + + protected override ComposeBlueprintContainer CreateBlueprintContainer() => new CatchBlueprintContainer(this); + + protected override BeatSnapGrid CreateBeatSnapGrid() => new CatchBeatSnapGrid(); + + protected override IReadOnlyList CompositionTools => new HitObjectCompositionTool[] + { + new FruitCompositionTool(), + new JuiceStreamCompositionTool(), + new BananaShowerCompositionTool() + }; + public bool OnPressed(KeyBindingPressEvent e) { switch (e.Action) @@ -98,19 +114,6 @@ namespace osu.Game.Rulesets.Catch.Edit { } - protected override DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods) => - new DrawableCatchEditorRuleset(ruleset, beatmap, mods) - { - TimeRangeMultiplier = { BindTarget = timeRangeMultiplier, } - }; - - protected override IReadOnlyList CompositionTools => new HitObjectCompositionTool[] - { - new FruitCompositionTool(), - new JuiceStreamCompositionTool(), - new BananaShowerCompositionTool() - }; - public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All) { var result = base.FindSnappedPositionAndTime(screenSpacePosition, snapType); @@ -129,10 +132,6 @@ namespace osu.Game.Rulesets.Catch.Edit return result; } - protected override ComposeBlueprintContainer CreateBlueprintContainer() => new CatchBlueprintContainer(this); - - protected override BeatSnapGrid CreateBeatSnapGrid() => new CatchBeatSnapGrid(); - private PalpableCatchHitObject? getLastSnappableHitObject(double time) { var hitObject = EditorBeatmap.HitObjects.OfType().LastOrDefault(h => h.GetEndTime() < time && !(h is BananaShower)); @@ -180,26 +179,5 @@ namespace osu.Game.Rulesets.Catch.Edit return null; } } - - private void updateDistanceSnapGrid() - { - if (DistanceSnapProvider.DistanceSnapToggle.Value != TernaryState.True) - { - distanceSnapGrid.Hide(); - return; - } - - var sourceHitObject = getDistanceSnapGridSourceHitObject(); - - if (sourceHitObject == null) - { - distanceSnapGrid.Hide(); - return; - } - - distanceSnapGrid.Show(); - distanceSnapGrid.StartTime = sourceHitObject.GetEndTime(); - distanceSnapGrid.StartX = sourceHitObject.EffectiveX; - } } }