1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 13:22:55 +08:00

Serialise and deserialise ClientVersion to replays

This commit is contained in:
Bartłomiej Dach 2023-12-21 12:58:08 +01:00
parent 81bbdccee7
commit 2baf579f7c
No known key found for this signature in database
2 changed files with 5 additions and 0 deletions

View File

@ -35,12 +35,16 @@ namespace osu.Game.Scoring.Legacy
[JsonProperty("maximum_statistics")]
public Dictionary<HitResult, int> MaximumStatistics { get; set; } = new Dictionary<HitResult, int>();
[JsonProperty("client_version")]
public string ClientVersion = string.Empty;
public static LegacyReplaySoloScoreInfo FromScore(ScoreInfo score) => new LegacyReplaySoloScoreInfo
{
OnlineID = score.OnlineID,
Mods = score.APIMods,
Statistics = score.Statistics.Where(kvp => kvp.Value != 0).ToDictionary(kvp => kvp.Key, kvp => kvp.Value),
MaximumStatistics = score.MaximumStatistics.Where(kvp => kvp.Value != 0).ToDictionary(kvp => kvp.Key, kvp => kvp.Value),
ClientVersion = score.ClientVersion,
};
}
}

View File

@ -125,6 +125,7 @@ namespace osu.Game.Scoring.Legacy
score.ScoreInfo.Statistics = readScore.Statistics;
score.ScoreInfo.MaximumStatistics = readScore.MaximumStatistics;
score.ScoreInfo.Mods = readScore.Mods.Select(m => m.ToMod(currentRuleset)).ToArray();
score.ScoreInfo.ClientVersion = readScore.ClientVersion;
});
}
}