mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 21:03:21 +08:00
Move DifficultyControlPoint
s list to LegacyControlPointInfo
This commit is contained in:
parent
b41b1e2394
commit
db3fc1d4af
@ -33,14 +33,6 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
|
|
||||||
private readonly SortedList<TimingControlPoint> timingPoints = new SortedList<TimingControlPoint>(Comparer<TimingControlPoint>.Default);
|
private readonly SortedList<TimingControlPoint> timingPoints = new SortedList<TimingControlPoint>(Comparer<TimingControlPoint>.Default);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// All difficulty points.
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty]
|
|
||||||
public IReadOnlyList<DifficultyControlPoint> DifficultyPoints => difficultyPoints;
|
|
||||||
|
|
||||||
private readonly SortedList<DifficultyControlPoint> difficultyPoints = new SortedList<DifficultyControlPoint>(Comparer<DifficultyControlPoint>.Default);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All effect points.
|
/// All effect points.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -55,14 +47,6 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public IEnumerable<ControlPoint> AllControlPoints => Groups.SelectMany(g => g.ControlPoints).ToArray();
|
public IEnumerable<ControlPoint> AllControlPoints => Groups.SelectMany(g => g.ControlPoints).ToArray();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Finds the difficulty control point that is active at <paramref name="time"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="time">The time to find the difficulty control point at.</param>
|
|
||||||
/// <returns>The difficulty control point.</returns>
|
|
||||||
[NotNull]
|
|
||||||
public DifficultyControlPoint DifficultyPointAt(double time) => BinarySearchWithFallback(DifficultyPoints, time, DifficultyControlPoint.DEFAULT);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Finds the effect control point that is active at <paramref name="time"/>.
|
/// Finds the effect control point that is active at <paramref name="time"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -100,7 +84,6 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
{
|
{
|
||||||
groups.Clear();
|
groups.Clear();
|
||||||
timingPoints.Clear();
|
timingPoints.Clear();
|
||||||
difficultyPoints.Clear();
|
|
||||||
effectPoints.Clear();
|
effectPoints.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,10 +260,6 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
case EffectControlPoint _:
|
case EffectControlPoint _:
|
||||||
existing = EffectPointAt(time);
|
existing = EffectPointAt(time);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DifficultyControlPoint _:
|
|
||||||
existing = DifficultyPointAt(time);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return newPoint?.IsRedundant(existing) == true;
|
return newPoint?.IsRedundant(existing) == true;
|
||||||
@ -297,10 +276,6 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
case EffectControlPoint typed:
|
case EffectControlPoint typed:
|
||||||
effectPoints.Add(typed);
|
effectPoints.Add(typed);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DifficultyControlPoint typed:
|
|
||||||
difficultyPoints.Add(typed);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,10 +290,6 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
case EffectControlPoint typed:
|
case EffectControlPoint typed:
|
||||||
effectPoints.Remove(typed);
|
effectPoints.Remove(typed);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DifficultyControlPoint typed:
|
|
||||||
difficultyPoints.Remove(typed);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Lists;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Legacy
|
namespace osu.Game.Beatmaps.Legacy
|
||||||
@ -26,35 +28,72 @@ namespace osu.Game.Beatmaps.Legacy
|
|||||||
[NotNull]
|
[NotNull]
|
||||||
public SampleControlPoint SamplePointAt(double time) => BinarySearchWithFallback(SamplePoints, time, SamplePoints.Count > 0 ? SamplePoints[0] : SampleControlPoint.DEFAULT);
|
public SampleControlPoint SamplePointAt(double time) => BinarySearchWithFallback(SamplePoints, time, SamplePoints.Count > 0 ? SamplePoints[0] : SampleControlPoint.DEFAULT);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// All difficulty points.
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty]
|
||||||
|
public IReadOnlyList<DifficultyControlPoint> DifficultyPoints => difficultyPoints;
|
||||||
|
|
||||||
|
private readonly SortedList<DifficultyControlPoint> difficultyPoints = new SortedList<DifficultyControlPoint>(Comparer<DifficultyControlPoint>.Default);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the difficulty control point that is active at <paramref name="time"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="time">The time to find the difficulty control point at.</param>
|
||||||
|
/// <returns>The difficulty control point.</returns>
|
||||||
|
[NotNull]
|
||||||
|
public DifficultyControlPoint DifficultyPointAt(double time) => BinarySearchWithFallback(DifficultyPoints, time, DifficultyControlPoint.DEFAULT);
|
||||||
|
|
||||||
public override void Clear()
|
public override void Clear()
|
||||||
{
|
{
|
||||||
base.Clear();
|
base.Clear();
|
||||||
samplePoints.Clear();
|
samplePoints.Clear();
|
||||||
|
difficultyPoints.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool CheckAlreadyExisting(double time, ControlPoint newPoint)
|
protected override bool CheckAlreadyExisting(double time, ControlPoint newPoint)
|
||||||
{
|
{
|
||||||
if (newPoint is SampleControlPoint)
|
switch (newPoint)
|
||||||
{
|
{
|
||||||
var existing = BinarySearch(SamplePoints, time);
|
case SampleControlPoint _:
|
||||||
return newPoint.IsRedundant(existing);
|
return newPoint.IsRedundant(SamplePointAt(time));
|
||||||
}
|
|
||||||
|
|
||||||
|
case DifficultyControlPoint _:
|
||||||
|
return newPoint.IsRedundant(DifficultyPointAt(time));
|
||||||
|
|
||||||
|
default:
|
||||||
return base.CheckAlreadyExisting(time, newPoint);
|
return base.CheckAlreadyExisting(time, newPoint);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void GroupItemAdded(ControlPoint controlPoint)
|
protected override void GroupItemAdded(ControlPoint controlPoint)
|
||||||
{
|
{
|
||||||
if (controlPoint is SampleControlPoint typed)
|
switch (controlPoint)
|
||||||
|
{
|
||||||
|
case SampleControlPoint typed:
|
||||||
samplePoints.Add(typed);
|
samplePoints.Add(typed);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DifficultyControlPoint typed:
|
||||||
|
difficultyPoints.Add(typed);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
base.GroupItemAdded(controlPoint);
|
base.GroupItemAdded(controlPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void GroupItemRemoved(ControlPoint controlPoint)
|
protected override void GroupItemRemoved(ControlPoint controlPoint)
|
||||||
{
|
{
|
||||||
if (controlPoint is SampleControlPoint typed)
|
switch (controlPoint)
|
||||||
|
{
|
||||||
|
case SampleControlPoint typed:
|
||||||
samplePoints.Remove(typed);
|
samplePoints.Remove(typed);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DifficultyControlPoint typed:
|
||||||
|
difficultyPoints.Remove(typed);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
base.GroupItemRemoved(controlPoint);
|
base.GroupItemRemoved(controlPoint);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user