Revert "Change breaks list to IReadOnlyList"

This reverts commit 2c3b411bb5.
This commit is contained in:
Dan Balasescu 2024-07-02 12:16:11 +09:00
parent db84711214
commit 04da1209f7
No known key found for this signature in database
7 changed files with 10 additions and 22 deletions

View File

@ -1,7 +1,6 @@
// 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.
using System.Collections.Generic;
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Timing;
@ -25,10 +24,8 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
public void TestBreaksPreservedOnOriginalBeatmap()
{
var beatmap = CreateBeatmap(new ManiaRuleset().RulesetInfo);
var breaks = (List<BreakPeriod>)beatmap.Breaks;
breaks.Clear();
breaks.Add(new BreakPeriod(0, 1000));
beatmap.Breaks.Clear();
beatmap.Breaks.Add(new BreakPeriod(0, 1000));
var workingBeatmap = new FlatWorkingBeatmap(beatmap);

View File

@ -61,12 +61,6 @@ namespace osu.Game.Beatmaps
public ControlPointInfo ControlPointInfo { get; set; } = new ControlPointInfo();
IReadOnlyList<BreakPeriod> IBeatmap.Breaks
{
get => Breaks;
set => Breaks = new List<BreakPeriod>(value);
}
public List<BreakPeriod> Breaks { get; set; } = new List<BreakPeriod>();
public List<string> UnhandledEventLines { get; set; } = new List<string>();

View File

@ -7,7 +7,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using osu.Game.Beatmaps.Timing;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Objects;
@ -50,6 +49,9 @@ namespace osu.Game.Beatmaps
original.BeatmapInfo = original.BeatmapInfo.Clone();
original.ControlPointInfo = original.ControlPointInfo.DeepClone();
// Used in osu!mania conversion.
original.Breaks = original.Breaks.ToList();
return ConvertBeatmap(original, cancellationToken);
}
@ -66,8 +68,7 @@ namespace osu.Game.Beatmaps
beatmap.BeatmapInfo = original.BeatmapInfo;
beatmap.ControlPointInfo = original.ControlPointInfo;
beatmap.HitObjects = convertHitObjects(original.HitObjects, original, cancellationToken).OrderBy(s => s.StartTime).ToList();
// Used in osu!mania conversion.
beatmap.Breaks = new List<BreakPeriod>(original.Breaks);
beatmap.Breaks = original.Breaks;
beatmap.UnhandledEventLines = original.UnhandledEventLines;
return beatmap;

View File

@ -40,7 +40,7 @@ namespace osu.Game.Beatmaps
/// <summary>
/// The breaks in this beatmap.
/// </summary>
IReadOnlyList<BreakPeriod> Breaks { get; set; }
List<BreakPeriod> Breaks { get; set; }
/// <summary>
/// All lines from the [Events] section which aren't handled in the encoding process yet.

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
@ -65,11 +64,8 @@ namespace osu.Game.Database
foreach (var controlPoint in playableBeatmap.ControlPointInfo.AllControlPoints)
controlPoint.Time = Math.Floor(controlPoint.Time);
var breaks = new List<BreakPeriod>(playableBeatmap.Breaks.Count);
for (int i = 0; i < playableBeatmap.Breaks.Count; i++)
breaks.Add(new BreakPeriod(Math.Floor(playableBeatmap.Breaks[i].StartTime), Math.Floor(playableBeatmap.Breaks[i].EndTime)));
playableBeatmap.Breaks = breaks;
playableBeatmap.Breaks[i] = new BreakPeriod(Math.Floor(playableBeatmap.Breaks[i].StartTime), Math.Floor(playableBeatmap.Breaks[i].EndTime));
foreach (var hitObject in playableBeatmap.HitObjects)
{

View File

@ -327,7 +327,7 @@ namespace osu.Game.Rulesets.Difficulty
set => baseBeatmap.Difficulty = value;
}
public IReadOnlyList<BreakPeriod> Breaks
public List<BreakPeriod> Breaks
{
get => baseBeatmap.Breaks;
set => baseBeatmap.Breaks = value;

View File

@ -177,7 +177,7 @@ namespace osu.Game.Screens.Edit
public readonly BindableList<BreakPeriod> Breaks;
IReadOnlyList<BreakPeriod> IBeatmap.Breaks
List<BreakPeriod> IBeatmap.Breaks
{
get => PlayableBeatmap.Breaks;
set => PlayableBeatmap.Breaks = value;