mirror of https://github.com/ppy/osu
Merge branch 'no-auto-gen' into editor-timing-screen
This commit is contained in:
commit
acc0251124
|
@ -184,7 +184,7 @@ private T binarySearch<T>(IReadOnlyList<T> list, double time)
|
|||
|
||||
public void Add(double time, ControlPoint newPoint, bool force = false)
|
||||
{
|
||||
if (!force && SimilarPointAt(time, newPoint)?.EquivalentTo(newPoint) == true)
|
||||
if (!force && checkAlreadyExisting(time, newPoint))
|
||||
return;
|
||||
|
||||
GroupAt(time, true).Add(newPoint);
|
||||
|
@ -209,6 +209,39 @@ public ControlPointGroup GroupAt(double time, bool createIfNotExisting = false)
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check whether <see cref="newPoint"/> should be added.
|
||||
/// </summary>
|
||||
/// <param name="time">The time to find the timing control point at.</param>
|
||||
/// <param name="newPoint">A point to be added.</param>
|
||||
/// <returns>Whether the new point should be added.</returns>
|
||||
private bool checkAlreadyExisting(double time, ControlPoint newPoint)
|
||||
{
|
||||
ControlPoint existing = null;
|
||||
|
||||
switch (newPoint)
|
||||
{
|
||||
case TimingControlPoint _:
|
||||
// Timing points are a special case and need to be added regardless of fallback availability.
|
||||
existing = binarySearch(TimingPoints, time);
|
||||
break;
|
||||
|
||||
case EffectControlPoint _:
|
||||
existing = EffectPointAt(time);
|
||||
break;
|
||||
|
||||
case SampleControlPoint _:
|
||||
existing = SamplePointAt(time);
|
||||
break;
|
||||
|
||||
case DifficultyControlPoint _:
|
||||
existing = DifficultyPointAt(time);
|
||||
break;
|
||||
}
|
||||
|
||||
return existing?.EquivalentTo(newPoint) == true;
|
||||
}
|
||||
|
||||
private void groupItemRemoved(ControlPoint obj)
|
||||
{
|
||||
switch (obj)
|
||||
|
|
Loading…
Reference in New Issue