2019-01-24 16:43:03 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 17:19:50 +08:00
2022-06-17 15:37:17 +08:00
#nullable disable
2019-11-06 13:55:05 +08:00
using System ;
2018-04-13 17:19:50 +08:00
using System.Collections.Generic ;
2019-10-16 19:20:07 +08:00
using System.Linq ;
2023-11-11 21:02:42 +08:00
using System.Text.RegularExpressions ;
2020-05-21 16:13:22 +08:00
using osu.Framework.Allocation ;
2020-09-09 18:14:28 +08:00
using osu.Framework.Bindables ;
2020-05-21 16:13:22 +08:00
using osu.Framework.Caching ;
2022-05-12 14:23:41 +08:00
using osu.Framework.Extensions.EnumExtensions ;
2020-05-21 16:13:22 +08:00
using osu.Framework.Graphics ;
using osu.Framework.Graphics.Containers ;
2020-09-25 15:33:22 +08:00
using osu.Framework.Graphics.Sprites ;
2022-10-19 19:06:39 +08:00
using osu.Framework.Input.Events ;
2023-05-02 14:36:01 +08:00
using osu.Framework.Utils ;
2018-04-13 17:19:50 +08:00
using osu.Game.Beatmaps ;
2023-12-27 23:03:57 +08:00
using osu.Game.Graphics ;
2020-09-25 15:33:22 +08:00
using osu.Game.Graphics.UserInterface ;
2018-04-13 17:19:50 +08:00
using osu.Game.Rulesets.Edit ;
using osu.Game.Rulesets.Edit.Tools ;
2019-04-08 17:32:05 +08:00
using osu.Game.Rulesets.Mods ;
2019-10-16 19:20:07 +08:00
using osu.Game.Rulesets.Objects ;
2018-10-17 17:01:38 +08:00
using osu.Game.Rulesets.Osu.Objects ;
2023-12-29 06:38:10 +08:00
using osu.Game.Rulesets.Osu.UI ;
2018-10-17 17:01:38 +08:00
using osu.Game.Rulesets.UI ;
2020-09-25 15:33:22 +08:00
using osu.Game.Screens.Edit.Components.TernaryButtons ;
2018-11-16 16:12:24 +08:00
using osu.Game.Screens.Edit.Compose.Components ;
2020-05-21 16:13:22 +08:00
using osuTK ;
2018-04-13 17:19:50 +08:00
namespace osu.Game.Rulesets.Osu.Edit
{
2023-10-19 17:20:10 +08:00
public partial class OsuHitObjectComposer : HitObjectComposer < OsuHitObject >
2018-04-13 17:19:50 +08:00
{
public OsuHitObjectComposer ( Ruleset ruleset )
: base ( ruleset )
{
}
2023-09-20 14:27:50 +08:00
protected override DrawableRuleset < OsuHitObject > CreateDrawableRuleset ( Ruleset ruleset , IBeatmap beatmap , IReadOnlyList < Mod > mods )
2021-04-26 13:33:30 +08:00
= > new DrawableOsuEditorRuleset ( ruleset , beatmap , mods ) ;
2018-04-13 17:19:50 +08:00
2018-10-04 12:44:49 +08:00
protected override IReadOnlyList < HitObjectCompositionTool > CompositionTools = > new HitObjectCompositionTool [ ]
2018-04-13 17:19:50 +08:00
{
2018-10-03 15:27:26 +08:00
new HitCircleCompositionTool ( ) ,
2018-10-04 12:44:49 +08:00
new SliderCompositionTool ( ) ,
2018-10-29 17:35:46 +08:00
new SpinnerCompositionTool ( )
2018-04-13 17:19:50 +08:00
} ;
2021-09-21 02:14:28 +08:00
private readonly Bindable < TernaryState > rectangularGridSnapToggle = new Bindable < TernaryState > ( ) ;
2020-09-09 18:14:28 +08:00
2024-06-27 22:54:48 +08:00
protected override Drawable CreateHitObjectInspector ( ) = > new OsuHitObjectInspector ( ) ;
2023-10-19 17:20:10 +08:00
protected override IEnumerable < TernaryButton > CreateTernaryButtons ( )
= > base . CreateTernaryButtons ( )
. Concat ( DistanceSnapProvider . CreateTernaryButtons ( ) )
. Concat ( new [ ]
{
2023-12-27 23:03:57 +08:00
new TernaryButton ( rectangularGridSnapToggle , "Grid Snap" , ( ) = > new SpriteIcon { Icon = OsuIcon . EditorGridSnap } )
2023-10-19 17:20:10 +08:00
} ) ;
2020-09-09 18:14:28 +08:00
2020-09-21 17:15:33 +08:00
private BindableList < HitObject > selectedHitObjects ;
private Bindable < HitObject > placementObject ;
2023-10-19 17:20:10 +08:00
[Cached(typeof(IDistanceSnapProvider))]
protected readonly OsuDistanceSnapProvider DistanceSnapProvider = new OsuDistanceSnapProvider ( ) ;
2023-12-29 05:36:30 +08:00
[Cached]
2023-12-29 06:10:06 +08:00
protected readonly OsuGridToolboxGroup OsuGridToolboxGroup = new OsuGridToolboxGroup ( ) ;
2023-12-29 05:36:30 +08:00
2023-11-20 12:02:51 +08:00
[Cached]
2023-11-21 08:59:49 +08:00
protected readonly FreehandSliderToolboxGroup FreehandlSliderToolboxGroup = new FreehandSliderToolboxGroup ( ) ;
2023-11-11 17:45:22 +08:00
2020-05-21 16:13:22 +08:00
[BackgroundDependencyLoader]
private void load ( )
{
2023-10-19 17:20:10 +08:00
AddInternal ( DistanceSnapProvider ) ;
DistanceSnapProvider . AttachToToolbox ( RightToolbox ) ;
2022-10-18 13:31:54 +08:00
// Give a bit of breathing room around the playfield content.
2023-07-21 14:20:19 +08:00
PlayfieldContentContainer . Padding = new MarginPadding ( 10 ) ;
2022-10-18 13:31:54 +08:00
2020-10-20 12:59:03 +08:00
LayerBelowRuleset . AddRange ( new Drawable [ ]
2020-10-20 03:20:13 +08:00
{
2020-10-20 12:59:03 +08:00
distanceSnapGridContainer = new Container
{
RelativeSizeAxes = Axes . Both
}
2020-10-20 03:20:13 +08:00
} ) ;
2020-05-23 09:44:53 +08:00
2020-09-21 17:15:33 +08:00
selectedHitObjects = EditorBeatmap . SelectedHitObjects . GetBoundCopy ( ) ;
2022-06-24 20:25:23 +08:00
selectedHitObjects . CollectionChanged + = ( _ , _ ) = > updateDistanceSnapGrid ( ) ;
2020-09-21 17:15:33 +08:00
placementObject = EditorBeatmap . PlacementObject . GetBoundCopy ( ) ;
placementObject . ValueChanged + = _ = > updateDistanceSnapGrid ( ) ;
2023-10-19 17:20:10 +08:00
DistanceSnapProvider . DistanceSnapToggle . ValueChanged + = _ = > updateDistanceSnapGrid ( ) ;
2020-09-22 15:02:07 +08:00
// we may be entering the screen with a selection already active
updateDistanceSnapGrid ( ) ;
2023-07-10 03:00:35 +08:00
2024-01-01 22:44:20 +08:00
updatePositionSnapGrid ( ) ;
2023-12-29 05:36:30 +08:00
2024-06-27 22:54:48 +08:00
RightToolbox . AddRange ( new Drawable [ ]
2023-11-21 13:10:48 +08:00
{
2023-12-29 06:10:06 +08:00
OsuGridToolboxGroup ,
2024-05-26 00:31:19 +08:00
new TransformToolboxGroup
{
RotationHandler = BlueprintContainer . SelectionHandler . RotationHandler ,
2024-05-28 23:12:16 +08:00
ScaleHandler = ( OsuSelectionScaleHandler ) BlueprintContainer . SelectionHandler . ScaleHandler ,
2024-05-26 00:31:19 +08:00
} ,
2023-11-21 13:10:48 +08:00
FreehandlSliderToolboxGroup
}
) ;
2020-05-21 16:13:22 +08:00
}
2024-01-01 22:44:20 +08:00
private void updatePositionSnapGrid ( )
2023-12-30 00:25:17 +08:00
{
if ( positionSnapGrid ! = null )
LayerBelowRuleset . Remove ( positionSnapGrid , true ) ;
2024-01-01 22:44:20 +08:00
var rectangularPositionSnapGrid = new RectangularPositionSnapGrid ( ) ;
2023-12-30 00:25:17 +08:00
2024-01-01 22:44:20 +08:00
rectangularPositionSnapGrid . StartPosition . BindTo ( OsuGridToolboxGroup . StartPosition ) ;
rectangularPositionSnapGrid . Spacing . BindTo ( OsuGridToolboxGroup . SpacingVector ) ;
rectangularPositionSnapGrid . GridLineRotation . BindTo ( OsuGridToolboxGroup . GridLinesRotation ) ;
2023-12-30 00:25:17 +08:00
2024-01-01 22:44:20 +08:00
positionSnapGrid = rectangularPositionSnapGrid ;
2023-12-30 07:43:41 +08:00
2023-12-30 00:25:17 +08:00
positionSnapGrid . RelativeSizeAxes = Axes . Both ;
LayerBelowRuleset . Add ( positionSnapGrid ) ;
}
2020-11-12 18:52:02 +08:00
protected override ComposeBlueprintContainer CreateBlueprintContainer ( )
= > new OsuBlueprintContainer ( this ) ;
2019-10-16 19:20:07 +08:00
2021-03-29 17:29:05 +08:00
public override string ConvertSelectionToString ( )
2023-11-11 21:02:42 +08:00
= > string . Join ( ',' , selectedHitObjects . Cast < OsuHitObject > ( ) . OrderBy ( h = > h . StartTime ) . Select ( h = > ( h . IndexInCurrentCombo + 1 ) . ToString ( ) ) ) ;
2023-11-07 08:36:58 +08:00
2023-11-20 21:03:25 +08:00
// 1,2,3,4 ...
private static readonly Regex selection_regex = new Regex ( @"^\d+(,\d+)*$" , RegexOptions . Compiled ) ;
2023-11-20 20:37:29 +08:00
public override void SelectFromTimestamp ( double timestamp , string objectDescription )
2023-11-07 08:36:58 +08:00
{
2023-11-11 21:02:42 +08:00
if ( ! selection_regex . IsMatch ( objectDescription ) )
return ;
List < OsuHitObject > remainingHitObjects = EditorBeatmap . HitObjects . Cast < OsuHitObject > ( ) . Where ( h = > h . StartTime > = timestamp ) . ToList ( ) ;
2023-11-12 21:58:46 +08:00
string [ ] splitDescription = objectDescription . Split ( ',' ) . ToArray ( ) ;
2023-11-11 21:02:42 +08:00
2023-11-12 21:58:46 +08:00
for ( int i = 0 ; i < splitDescription . Length ; i + + )
2023-11-11 21:02:42 +08:00
{
2023-11-12 21:58:46 +08:00
if ( ! int . TryParse ( splitDescription [ i ] , out int combo ) | | combo < 1 )
continue ;
OsuHitObject current = remainingHitObjects . FirstOrDefault ( h = > h . IndexInCurrentCombo + 1 = = combo ) ;
2023-11-07 08:36:58 +08:00
2023-11-11 21:02:42 +08:00
if ( current = = null )
continue ;
EditorBeatmap . SelectedHitObjects . Add ( current ) ;
2023-11-12 21:58:46 +08:00
if ( i < splitDescription . Length - 1 )
2023-11-11 21:02:42 +08:00
remainingHitObjects = remainingHitObjects . Where ( h = > h ! = current & & h . StartTime > = current . StartTime ) . ToList ( ) ;
}
}
2020-05-21 16:13:22 +08:00
private DistanceSnapGrid distanceSnapGrid ;
private Container distanceSnapGridContainer ;
private readonly Cached distanceSnapGridCache = new Cached ( ) ;
private double? lastDistanceSnapGridTime ;
2023-12-30 00:25:17 +08:00
private PositionSnapGrid positionSnapGrid ;
2021-09-21 02:13:06 +08:00
2020-05-21 16:13:22 +08:00
protected override void Update ( )
{
base . Update ( ) ;
if ( ! ( BlueprintContainer . CurrentTool is SelectTool ) )
{
if ( EditorClock . CurrentTime ! = lastDistanceSnapGridTime )
{
distanceSnapGridCache . Invalidate ( ) ;
lastDistanceSnapGridTime = EditorClock . CurrentTime ;
}
if ( ! distanceSnapGridCache . IsValid )
updateDistanceSnapGrid ( ) ;
}
}
2022-05-12 14:23:41 +08:00
public override SnapResult FindSnappedPositionAndTime ( Vector2 screenSpacePosition , SnapType snapType = SnapType . All )
2020-05-21 16:13:22 +08:00
{
2022-05-12 14:23:41 +08:00
if ( snapType . HasFlagFast ( SnapType . NearbyObjects ) & & snapToVisibleBlueprints ( screenSpacePosition , out var snapResult ) )
2022-10-26 13:39:39 +08:00
{
// In the case of snapping to nearby objects, a time value is not provided.
// This matches the stable editor (which also uses current time), but with the introduction of time-snapping distance snap
2022-10-27 05:30:14 +08:00
// this could result in unexpected behaviour when distance snapping is turned on and a user attempts to place an object that is
2022-10-26 13:39:39 +08:00
// BOTH on a valid distance snap ring, and also at the same position as a previous object.
//
// We want to ensure that in this particular case, the time-snapping component of distance snap is still applied.
// The easiest way to ensure this is to attempt application of distance snap after a nearby object is found, and copy over
// the time value if the proposed positions are roughly the same.
2023-10-19 17:20:10 +08:00
if ( snapType . HasFlagFast ( SnapType . RelativeGrids ) & & DistanceSnapProvider . DistanceSnapToggle . Value = = TernaryState . True & & distanceSnapGrid ! = null )
2022-10-26 13:39:39 +08:00
{
( Vector2 distanceSnappedPosition , double distanceSnappedTime ) = distanceSnapGrid . GetSnappedPosition ( distanceSnapGrid . ToLocalSpace ( snapResult . ScreenSpacePosition ) ) ;
if ( Precision . AlmostEquals ( distanceSnapGrid . ToScreenSpace ( distanceSnappedPosition ) , snapResult . ScreenSpacePosition , 1 ) )
snapResult . Time = distanceSnappedTime ;
}
2020-09-24 13:22:18 +08:00
return snapResult ;
2022-10-26 13:39:39 +08:00
}
2020-09-24 13:22:18 +08:00
2022-10-25 13:09:22 +08:00
SnapResult result = base . FindSnappedPositionAndTime ( screenSpacePosition , snapType ) ;
2023-05-25 20:41:19 +08:00
if ( snapType . HasFlagFast ( SnapType . RelativeGrids ) )
2021-09-19 23:48:29 +08:00
{
2023-10-19 17:20:10 +08:00
if ( DistanceSnapProvider . DistanceSnapToggle . Value = = TernaryState . True & & distanceSnapGrid ! = null )
2022-05-12 14:23:41 +08:00
{
( Vector2 pos , double time ) = distanceSnapGrid . GetSnappedPosition ( distanceSnapGrid . ToLocalSpace ( screenSpacePosition ) ) ;
2022-10-25 13:09:22 +08:00
result . ScreenSpacePosition = distanceSnapGrid . ToScreenSpace ( pos ) ;
result . Time = time ;
2022-05-12 14:23:41 +08:00
}
2023-05-25 20:41:19 +08:00
}
2020-05-21 16:13:22 +08:00
2023-05-25 20:41:19 +08:00
if ( snapType . HasFlagFast ( SnapType . GlobalGrids ) )
{
2022-05-12 14:23:41 +08:00
if ( rectangularGridSnapToggle . Value = = TernaryState . True )
{
2023-12-30 00:25:17 +08:00
Vector2 pos = positionSnapGrid . GetSnappedPosition ( positionSnapGrid . ToLocalSpace ( result . ScreenSpacePosition ) ) ;
2022-10-25 13:09:22 +08:00
2023-12-29 06:39:24 +08:00
// A grid which doesn't perfectly fit the playfield can produce a position that is outside of the playfield.
2023-12-29 06:38:10 +08:00
// We need to clamp the position to the playfield bounds to ensure that the snapped position is always in bounds.
pos = Vector2 . Clamp ( pos , Vector2 . Zero , OsuPlayfield . BASE_SIZE ) ;
2023-12-30 00:25:17 +08:00
result . ScreenSpacePosition = positionSnapGrid . ToScreenSpace ( pos ) ;
2022-05-12 14:23:41 +08:00
}
2021-09-19 23:48:29 +08:00
}
2020-05-21 16:13:22 +08:00
2022-10-25 13:09:22 +08:00
return result ;
2020-05-21 16:13:22 +08:00
}
2020-09-24 13:22:18 +08:00
private bool snapToVisibleBlueprints ( Vector2 screenSpacePosition , out SnapResult snapResult )
{
// check other on-screen objects for snapping/stacking
var blueprints = BlueprintContainer . SelectionBlueprints . AliveChildren ;
var playfield = PlayfieldAtScreenSpacePosition ( screenSpacePosition ) ;
float snapRadius =
2023-06-08 16:44:32 +08:00
playfield . GamefieldToScreenSpace ( new Vector2 ( OsuHitObject . OBJECT_RADIUS * 0.10f ) ) . X -
2020-09-24 13:22:18 +08:00
playfield . GamefieldToScreenSpace ( Vector2 . Zero ) . X ;
foreach ( var b in blueprints )
{
if ( b . IsSelected )
continue ;
2023-02-02 21:22:30 +08:00
var snapPositions = b . ScreenSpaceSnapPoints ;
2020-09-24 13:22:18 +08:00
2023-02-03 23:05:16 +08:00
if ( ! snapPositions . Any ( ) )
continue ;
2023-02-03 23:13:37 +08:00
2023-02-03 23:05:16 +08:00
var closestSnapPosition = snapPositions . MinBy ( p = > Vector2 . Distance ( p , screenSpacePosition ) ) ;
2020-09-24 13:22:18 +08:00
2023-02-03 23:05:16 +08:00
if ( Vector2 . Distance ( closestSnapPosition , screenSpacePosition ) < snapRadius )
2020-09-24 13:34:41 +08:00
{
// only return distance portion, since time is not really valid
2023-02-04 21:36:30 +08:00
snapResult = new SnapResult ( closestSnapPosition , null , playfield ) ;
2020-09-24 13:34:41 +08:00
return true ;
}
2020-09-24 13:22:18 +08:00
}
snapResult = null ;
return false ;
}
2020-05-21 16:13:22 +08:00
private void updateDistanceSnapGrid ( )
{
distanceSnapGridContainer . Clear ( ) ;
distanceSnapGridCache . Invalidate ( ) ;
2020-09-09 18:14:28 +08:00
distanceSnapGrid = null ;
2023-10-19 17:20:10 +08:00
if ( DistanceSnapProvider . DistanceSnapToggle . Value ! = TernaryState . True )
2020-09-09 18:14:28 +08:00
return ;
2020-05-21 16:13:22 +08:00
2020-05-23 09:57:17 +08:00
switch ( BlueprintContainer . CurrentTool )
{
2022-06-24 20:25:23 +08:00
case SelectTool :
2020-05-23 09:57:17 +08:00
if ( ! EditorBeatmap . SelectedHitObjects . Any ( ) )
return ;
distanceSnapGrid = createDistanceSnapGrid ( EditorBeatmap . SelectedHitObjects ) ;
break ;
default :
if ( ! CursorInPlacementArea )
return ;
distanceSnapGrid = createDistanceSnapGrid ( Enumerable . Empty < HitObject > ( ) ) ;
break ;
}
2020-05-21 16:13:22 +08:00
2020-05-23 09:57:17 +08:00
if ( distanceSnapGrid ! = null )
2020-05-21 16:13:22 +08:00
{
distanceSnapGridContainer . Add ( distanceSnapGrid ) ;
distanceSnapGridCache . Validate ( ) ;
}
}
2022-10-19 19:06:39 +08:00
protected override bool OnKeyDown ( KeyDownEvent e )
{
if ( e . Repeat )
return false ;
2022-10-21 15:11:19 +08:00
handleToggleViaKey ( e ) ;
2022-10-19 19:06:39 +08:00
return base . OnKeyDown ( e ) ;
}
protected override void OnKeyUp ( KeyUpEvent e )
{
2022-10-21 15:11:19 +08:00
handleToggleViaKey ( e ) ;
2022-10-19 19:06:39 +08:00
base . OnKeyUp ( e ) ;
}
2022-10-25 13:22:28 +08:00
private bool gridSnapMomentary ;
2022-10-21 15:11:19 +08:00
private void handleToggleViaKey ( KeyboardEvent key )
2022-10-19 19:06:39 +08:00
{
2022-10-25 13:22:28 +08:00
bool shiftPressed = key . ShiftPressed ;
if ( shiftPressed ! = gridSnapMomentary )
2022-10-21 15:11:19 +08:00
{
2022-10-25 13:22:28 +08:00
gridSnapMomentary = shiftPressed ;
rectangularGridSnapToggle . Value = rectangularGridSnapToggle . Value = = TernaryState . False ? TernaryState . True : TernaryState . False ;
2022-10-19 19:06:39 +08:00
}
}
2020-05-21 16:13:22 +08:00
private DistanceSnapGrid createDistanceSnapGrid ( IEnumerable < HitObject > selectedHitObjects )
2019-10-16 19:20:07 +08:00
{
2020-02-07 18:08:49 +08:00
if ( BlueprintContainer . CurrentTool is SpinnerCompositionTool )
return null ;
2019-10-16 19:20:07 +08:00
var objects = selectedHitObjects . ToList ( ) ;
if ( objects . Count = = 0 )
2020-05-22 15:40:52 +08:00
// use accurate time value to give more instantaneous feedback to the user.
return createGrid ( h = > h . StartTime < = EditorClock . CurrentTimeAccurate ) ;
2019-11-06 13:55:05 +08:00
double minTime = objects . Min ( h = > h . StartTime ) ;
2019-11-06 15:04:20 +08:00
return createGrid ( h = > h . StartTime < minTime , objects . Count + 1 ) ;
2019-11-06 13:55:05 +08:00
}
2019-11-06 15:04:20 +08:00
/// <summary>
/// Creates a grid from the last <see cref="HitObject"/> matching a predicate to a target <see cref="HitObject"/>.
/// </summary>
/// <param name="sourceSelector">A predicate that matches <see cref="HitObject"/>s where the grid can start from.
/// Only the last <see cref="HitObject"/> matching the predicate is used.</param>
/// <param name="targetOffset">An offset from the <see cref="HitObject"/> selected via <paramref name="sourceSelector"/> at which the grid should stop.</param>
/// <returns>The <see cref="OsuDistanceSnapGrid"/> from a selected <see cref="HitObject"/> to a target <see cref="HitObject"/>.</returns>
private OsuDistanceSnapGrid createGrid ( Func < HitObject , bool > sourceSelector , int targetOffset = 1 )
2019-11-06 13:55:05 +08:00
{
2024-03-05 17:20:30 +08:00
ArgumentOutOfRangeException . ThrowIfNegativeOrZero ( targetOffset ) ;
2019-11-06 15:04:20 +08:00
int sourceIndex = - 1 ;
2019-11-06 13:55:05 +08:00
for ( int i = 0 ; i < EditorBeatmap . HitObjects . Count ; i + + )
2019-10-16 19:20:07 +08:00
{
2019-11-06 15:04:20 +08:00
if ( ! sourceSelector ( EditorBeatmap . HitObjects [ i ] ) )
2019-11-06 13:55:05 +08:00
break ;
2019-10-16 19:20:07 +08:00
2019-11-06 15:04:20 +08:00
sourceIndex = i ;
2019-10-16 19:20:07 +08:00
}
2019-11-06 15:04:20 +08:00
if ( sourceIndex = = - 1 )
2019-11-06 13:55:05 +08:00
return null ;
2019-10-16 19:20:07 +08:00
2019-12-27 18:39:30 +08:00
HitObject sourceObject = EditorBeatmap . HitObjects [ sourceIndex ] ;
2019-12-17 15:35:40 +08:00
int targetIndex = sourceIndex + targetOffset ;
2019-12-27 18:39:30 +08:00
HitObject targetObject = null ;
2019-12-17 15:35:40 +08:00
// Keep advancing the target object while its start time falls before the end time of the source object
while ( true )
{
if ( targetIndex > = EditorBeatmap . HitObjects . Count )
break ;
if ( EditorBeatmap . HitObjects [ targetIndex ] . StartTime > = sourceObject . GetEndTime ( ) )
{
targetObject = EditorBeatmap . HitObjects [ targetIndex ] ;
break ;
}
targetIndex + + ;
}
2019-10-16 19:20:07 +08:00
2020-02-07 18:08:49 +08:00
if ( sourceObject is Spinner )
return null ;
2019-12-27 18:39:30 +08:00
return new OsuDistanceSnapGrid ( ( OsuHitObject ) sourceObject , ( OsuHitObject ) targetObject ) ;
2019-10-16 19:20:07 +08:00
}
2018-04-13 17:19:50 +08:00
}
}