mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 20:07:29 +08:00
Remove all legacy ControlPoint
s when entering the editor
This commit is contained in:
parent
6015b5037a
commit
b19dc5e41f
@ -10,6 +10,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Beatmaps.Legacy;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
@ -69,6 +70,32 @@ namespace osu.Game.Screens.Edit
|
||||
public EditorBeatmap(IBeatmap playableBeatmap, ISkin beatmapSkin = null)
|
||||
{
|
||||
PlayableBeatmap = playableBeatmap;
|
||||
|
||||
// ensure we are not working with legacy control points.
|
||||
// if we leave the legacy points around they will be applied over any local changes on
|
||||
// ApplyDefaults calls. this should eventually be removed once the default logic is moved to the decoder/converter.
|
||||
if (PlayableBeatmap.ControlPointInfo is LegacyControlPointInfo)
|
||||
{
|
||||
var newControlPoints = new ControlPointInfo();
|
||||
|
||||
foreach (var controlPoint in PlayableBeatmap.ControlPointInfo.AllControlPoints)
|
||||
{
|
||||
switch (controlPoint)
|
||||
{
|
||||
case DifficultyControlPoint _:
|
||||
case SampleControlPoint _:
|
||||
// skip legacy types.
|
||||
continue;
|
||||
|
||||
default:
|
||||
newControlPoints.Add(controlPoint.Time, controlPoint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
playableBeatmap.ControlPointInfo = newControlPoints;
|
||||
}
|
||||
|
||||
if (beatmapSkin is Skin skin)
|
||||
BeatmapSkin = new EditorBeatmapSkin(skin);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user