Make Beatmap ISerializable and add more JsonIgnores

This commit is contained in:
smoogipoo
2017-12-06 00:37:37 +09:00
parent 58777a9674
commit b584178e85
14 changed files with 322 additions and 15 deletions

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using osu.Framework.Lists;
namespace osu.Game.Beatmaps.ControlPoints
@ -58,18 +59,21 @@ namespace osu.Game.Beatmaps.ControlPoints
/// <returns>The timing control point.</returns>
public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, TimingPoints.FirstOrDefault());
[JsonIgnore]
/// <summary>
/// Finds the maximum BPM represented by any timing control point.
/// </summary>
public double BPMMaximum =>
60000 / (TimingPoints.OrderBy(c => c.BeatLength).FirstOrDefault() ?? new TimingControlPoint()).BeatLength;
[JsonIgnore]
/// <summary>
/// Finds the minimum BPM represented by any timing control point.
/// </summary>
public double BPMMinimum =>
60000 / (TimingPoints.OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? new TimingControlPoint()).BeatLength;
[JsonIgnore]
/// <summary>
/// Finds the mode BPM (most common BPM) represented by the control points.
/// </summary>
@ -108,4 +112,4 @@ namespace osu.Game.Beatmaps.ControlPoints
return list[index - 1];
}
}
}
}