mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Merge pull request #13929 from peppy/i-deep-cloneable
Create a deep clone of score for score submission purposes
This commit is contained in:
@ -3,11 +3,12 @@
|
||||
|
||||
using System;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Utils;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Beatmaps.ControlPoints
|
||||
{
|
||||
public abstract class ControlPoint : IComparable<ControlPoint>
|
||||
public abstract class ControlPoint : IComparable<ControlPoint>, IDeepCloneable<ControlPoint>
|
||||
{
|
||||
/// <summary>
|
||||
/// The time at which the control point takes effect.
|
||||
@ -32,7 +33,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
/// <summary>
|
||||
/// Create an unbound copy of this control point.
|
||||
/// </summary>
|
||||
public ControlPoint CreateCopy()
|
||||
public ControlPoint DeepClone()
|
||||
{
|
||||
var copy = (ControlPoint)Activator.CreateInstance(GetType());
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user