Assume that control points are already sequentially-ordered

Fixes up deserializing.
This commit is contained in:
smoogipoo
2017-12-06 16:23:51 +09:00
parent 887b81148d
commit f9e34dfa3d
3 changed files with 13 additions and 10 deletions

View File

@ -5,31 +5,35 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using osu.Framework.Lists;
namespace osu.Game.Beatmaps.ControlPoints
{
[Serializable]
public class ControlPointInfo
{
[JsonProperty]
/// <summary>
/// All timing points.
/// </summary>
public readonly SortedList<TimingControlPoint> TimingPoints = new SortedList<TimingControlPoint>(Comparer<TimingControlPoint>.Default);
public List<TimingControlPoint> TimingPoints { get; private set; } = new List<TimingControlPoint>();
[JsonProperty]
/// <summary>
/// All difficulty points.
/// </summary>
public readonly SortedList<DifficultyControlPoint> DifficultyPoints = new SortedList<DifficultyControlPoint>(Comparer<DifficultyControlPoint>.Default);
public List<DifficultyControlPoint> DifficultyPoints { get; private set; } = new List<DifficultyControlPoint>();
[JsonProperty]
/// <summary>
/// All sound points.
/// </summary>
public readonly SortedList<SoundControlPoint> SoundPoints = new SortedList<SoundControlPoint>(Comparer<SoundControlPoint>.Default);
public List<SoundControlPoint> SoundPoints { get; private set; } = new List<SoundControlPoint>();
[JsonProperty]
/// <summary>
/// All effect points.
/// </summary>
public readonly SortedList<EffectControlPoint> EffectPoints = new SortedList<EffectControlPoint>(Comparer<EffectControlPoint>.Default);
public List<EffectControlPoint> EffectPoints { get; private set; } = new List<EffectControlPoint>();
/// <summary>
/// Finds the difficulty control point that is active at <paramref name="time"/>.
@ -87,7 +91,7 @@ namespace osu.Game.Beatmaps.ControlPoints
/// <param name="time">The time to find the control point at.</param>
/// <param name="prePoint">The control point to use when <paramref name="time"/> is before any control points. If null, a new control point will be constructed.</param>
/// <returns>The active control point at <paramref name="time"/>.</returns>
private T binarySearch<T>(SortedList<T> list, double time, T prePoint = null)
private T binarySearch<T>(List<T> list, double time, T prePoint = null)
where T : ControlPoint, new()
{
if (list == null)