mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Merge branch 'no-auto-gen' into editor-timing-screen
This commit is contained in:
commit
acc0251124
@ -184,7 +184,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
|
||||
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 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
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
Block a user