Add IDeepCloneable interface and update existing CreateCopy methods to use it

This commit is contained in:
Dean Herbert
2021-07-19 12:38:22 +09:00
parent 48b34457e7
commit 3c028ce05c
16 changed files with 45 additions and 25 deletions

View File

@ -10,11 +10,12 @@ using osu.Framework.Bindables;
using osu.Framework.Lists;
using osu.Framework.Utils;
using osu.Game.Screens.Edit;
using osu.Game.Utils;
namespace osu.Game.Beatmaps.ControlPoints
{
[Serializable]
public class ControlPointInfo
public class ControlPointInfo : IDeepCloneable<ControlPointInfo>
{
/// <summary>
/// All control points grouped by time.
@ -350,12 +351,12 @@ namespace osu.Game.Beatmaps.ControlPoints
}
}
public ControlPointInfo CreateCopy()
public ControlPointInfo DeepClone()
{
var controlPointInfo = new ControlPointInfo();
foreach (var point in AllControlPoints)
controlPointInfo.Add(point.Time, point.CreateCopy());
controlPointInfo.Add(point.Time, point.DeepClone());
return controlPointInfo;
}