Add deep cloning support to Score/ScoreInfo/Replay

This commit is contained in:
Dean Herbert
2021-07-19 13:02:40 +09:00
parent 3c028ce05c
commit e507faef29
4 changed files with 67 additions and 3 deletions

View File

@ -2,11 +2,13 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Game.Rulesets.Replays;
using osu.Game.Utils;
namespace osu.Game.Replays
{
public class Replay
public class Replay : IDeepCloneable<Replay>
{
/// <summary>
/// Whether all frames for this replay have been received.
@ -15,5 +17,15 @@ namespace osu.Game.Replays
public bool HasReceivedAllFrames = true;
public List<ReplayFrame> Frames = new List<ReplayFrame>();
public Replay DeepClone()
{
return new Replay
{
HasReceivedAllFrames = HasReceivedAllFrames,
// individual frames are mutable for now but hopefully this will not be a thing in the future.
Frames = Frames.ToList(),
};
}
}
}