mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 11:12:59 +08:00
Tidy up CatchHitObjectComposer
This commit is contained in:
parent
013b5fa916
commit
74b86349d5
@ -10,7 +10,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Rulesets.Catch.Objects;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
using osu.Game.Rulesets.Catch.UI;
|
using osu.Game.Rulesets.Catch.UI;
|
||||||
@ -75,6 +74,23 @@ namespace osu.Game.Rulesets.Catch.Edit
|
|||||||
=> base.CreateTernaryButtons()
|
=> base.CreateTernaryButtons()
|
||||||
.Concat(DistanceSnapProvider.CreateTernaryButtons());
|
.Concat(DistanceSnapProvider.CreateTernaryButtons());
|
||||||
|
|
||||||
|
protected override DrawableRuleset<CatchHitObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> 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<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
|
||||||
|
{
|
||||||
|
new FruitCompositionTool(),
|
||||||
|
new JuiceStreamCompositionTool(),
|
||||||
|
new BananaShowerCompositionTool()
|
||||||
|
};
|
||||||
|
|
||||||
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||||
{
|
{
|
||||||
switch (e.Action)
|
switch (e.Action)
|
||||||
@ -98,19 +114,6 @@ namespace osu.Game.Rulesets.Catch.Edit
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DrawableRuleset<CatchHitObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods) =>
|
|
||||||
new DrawableCatchEditorRuleset(ruleset, beatmap, mods)
|
|
||||||
{
|
|
||||||
TimeRangeMultiplier = { BindTarget = timeRangeMultiplier, }
|
|
||||||
};
|
|
||||||
|
|
||||||
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
|
|
||||||
{
|
|
||||||
new FruitCompositionTool(),
|
|
||||||
new JuiceStreamCompositionTool(),
|
|
||||||
new BananaShowerCompositionTool()
|
|
||||||
};
|
|
||||||
|
|
||||||
public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All)
|
public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All)
|
||||||
{
|
{
|
||||||
var result = base.FindSnappedPositionAndTime(screenSpacePosition, snapType);
|
var result = base.FindSnappedPositionAndTime(screenSpacePosition, snapType);
|
||||||
@ -129,10 +132,6 @@ namespace osu.Game.Rulesets.Catch.Edit
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override ComposeBlueprintContainer CreateBlueprintContainer() => new CatchBlueprintContainer(this);
|
|
||||||
|
|
||||||
protected override BeatSnapGrid CreateBeatSnapGrid() => new CatchBeatSnapGrid();
|
|
||||||
|
|
||||||
private PalpableCatchHitObject? getLastSnappableHitObject(double time)
|
private PalpableCatchHitObject? getLastSnappableHitObject(double time)
|
||||||
{
|
{
|
||||||
var hitObject = EditorBeatmap.HitObjects.OfType<CatchHitObject>().LastOrDefault(h => h.GetEndTime() < time && !(h is BananaShower));
|
var hitObject = EditorBeatmap.HitObjects.OfType<CatchHitObject>().LastOrDefault(h => h.GetEndTime() < time && !(h is BananaShower));
|
||||||
@ -180,26 +179,5 @@ namespace osu.Game.Rulesets.Catch.Edit
|
|||||||
return null;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user