mirror of
https://github.com/ppy/osu
synced 2025-03-01 00:51:39 +00:00
Generic infer for IJsonSerializable.DeepClone.
This commit is contained in:
parent
345f80b775
commit
e466380ee2
@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
|
||||
protected override Beatmap<TaikoHitObject> ConvertBeatmap(Beatmap original)
|
||||
{
|
||||
// Rewrite the beatmap info to add the slider velocity multiplier
|
||||
BeatmapInfo info = original.BeatmapInfo.DeepClone<BeatmapInfo>();
|
||||
BeatmapInfo info = original.BeatmapInfo.DeepClone();
|
||||
info.Difficulty.SliderMultiplier *= legacy_velocity_multiplier;
|
||||
|
||||
Beatmap<TaikoHitObject> converted = base.ConvertBeatmap(original);
|
||||
|
@ -16,12 +16,13 @@ namespace osu.Game.IO.Serialization
|
||||
return JsonConvert.SerializeObject(obj);
|
||||
}
|
||||
|
||||
public static T Deserialize<T>(string objString)
|
||||
public static T Deserialize<T>(this string objString)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(objString);
|
||||
}
|
||||
|
||||
public static T DeepClone<T>(this IJsonSerializable obj)
|
||||
public static T DeepClone<T>(this T obj)
|
||||
where T : IJsonSerializable
|
||||
{
|
||||
return Deserialize<T>(Serialize(obj));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user