1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 21:27:24 +08:00

Back to using SortedLists

This commit is contained in:
smoogipoo 2017-12-21 19:40:41 +09:00
parent cb7e192aff
commit a3fcc0b60c
7 changed files with 18 additions and 20 deletions

@ -1 +1 @@
Subproject commit 28fbd0711c09d3b06b51fc728b025f83ded2f0f8
Subproject commit d997b34da4556e4fcfc2de5413ded92c6ee9bec1

View File

@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Mania.UI
// Generate the bar lines
double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue;
List<TimingControlPoint> timingPoints = Beatmap.ControlPointInfo.TimingPoints;
var timingPoints = Beatmap.ControlPointInfo.TimingPoints;
var barLines = new List<DrawableBarLine>();
for (int i = 0; i < timingPoints.Count; i++)

View File

@ -10,7 +10,6 @@ using System.Linq;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Framework.Extensions.IEnumerableExtensions;
namespace osu.Game.Rulesets.Osu.Objects
{

View File

@ -140,19 +140,19 @@ namespace osu.Game.Tests.Beatmaps.Formats
}
/// <summary>
/// Reads a .osu file first with a <see cref="OsuLegacyDecoder"/>, serializes the resulting <see cref="Beatmap"/> to JSON
/// Reads a .osu file first with a <see cref="LegacyBeatmapDecoder"/>, serializes the resulting <see cref="Beatmap"/> to JSON
/// and then deserializes the result back into a <see cref="Beatmap"/> through an <see cref="JsonBeatmapDecoder"/>.
/// </summary>
/// <param name="filename">The .osu file to decode.</param>
/// <returns>The <see cref="Beatmap"/> after being decoded by an <see cref="OsuLegacyDecoder"/>.</returns>
/// <returns>The <see cref="Beatmap"/> after being decoded by an <see cref="LegacyBeatmapDecoder"/>.</returns>
private Beatmap decodeAsJson(string filename) => decode(filename).jsonDecoded;
/// <summary>
/// Reads a .osu file first with a <see cref="OsuLegacyDecoder"/>, serializes the resulting <see cref="Beatmap"/> to JSON
/// Reads a .osu file first with a <see cref="LegacyBeatmapDecoder"/>, serializes the resulting <see cref="Beatmap"/> to JSON
/// and then deserializes the result back into a <see cref="Beatmap"/> through an <see cref="JsonBeatmapDecoder"/>.
/// </summary>
/// <param name="filename">The .osu file to decode.</param>
/// <returns>The <see cref="Beatmap"/> after being decoded by an <see cref="OsuLegacyDecoder"/>.</returns>
/// <returns>The <see cref="Beatmap"/> after being decoded by an <see cref="LegacyBeatmapDecoder"/>.</returns>
private (Beatmap legacyDecoded, Beatmap jsonDecoded) decode(string filename)
{
using (var stream = Resource.OpenResource(filename))

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Framework.Audio.Track;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
@ -14,6 +13,7 @@ using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using OpenTK.Graphics;
using osu.Framework.Lists;
namespace osu.Game.Tests.Visual
{
@ -137,7 +137,7 @@ namespace osu.Game.Tests.Visual
};
}
private List<TimingControlPoint> timingPoints => Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints;
private SortedList<TimingControlPoint> timingPoints => Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints;
private TimingControlPoint getNextTimingPoint(TimingControlPoint current)
{
if (timingPoints[timingPoints.Count - 1] == current)

View File

@ -2,8 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using Newtonsoft.Json;
using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Audio
{

View File

@ -5,35 +5,36 @@ 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 List<TimingControlPoint> TimingPoints { get; private set; } = new List<TimingControlPoint>();
[JsonProperty]
public SortedList<TimingControlPoint> TimingPoints { get; private set; } = new SortedList<TimingControlPoint>(Comparer<TimingControlPoint>.Default);
/// <summary>
/// All difficulty points.
/// </summary>
public List<DifficultyControlPoint> DifficultyPoints { get; private set; } = new List<DifficultyControlPoint>();
[JsonProperty]
public SortedList<DifficultyControlPoint> DifficultyPoints { get; private set; } = new SortedList<DifficultyControlPoint>(Comparer<DifficultyControlPoint>.Default);
/// <summary>
/// All sound points.
/// </summary>
public List<SoundControlPoint> SoundPoints { get; private set; } = new List<SoundControlPoint>();
[JsonProperty]
public SortedList<SoundControlPoint> SoundPoints { get; private set; } = new SortedList<SoundControlPoint>(Comparer<SoundControlPoint>.Default);
/// <summary>
/// All effect points.
/// </summary>
public List<EffectControlPoint> EffectPoints { get; private set; } = new List<EffectControlPoint>();
[JsonProperty]
public SortedList<EffectControlPoint> EffectPoints { get; private set; } = new SortedList<EffectControlPoint>(Comparer<EffectControlPoint>.Default);
/// <summary>
/// Finds the difficulty control point that is active at <paramref name="time"/>.
@ -91,7 +92,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>(List<T> list, double time, T prePoint = null)
private T binarySearch<T>(SortedList<T> list, double time, T prePoint = null)
where T : ControlPoint, new()
{
if (list == null)