mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Add LegacyScoreInfo for statistics preservation/conversion
This commit is contained in:
@ -34,7 +34,9 @@ namespace osu.Game.Scoring.Legacy
|
||||
using (SerializationReader sr = new SerializationReader(stream))
|
||||
{
|
||||
currentRuleset = GetRuleset(sr.ReadByte());
|
||||
score.ScoreInfo = new ScoreInfo { Ruleset = currentRuleset.RulesetInfo };
|
||||
var scoreInfo = new LegacyScoreInfo { Ruleset = currentRuleset.RulesetInfo };
|
||||
|
||||
scoreInfo = scoreInfo;
|
||||
|
||||
var version = sr.ReadInt32();
|
||||
|
||||
@ -43,69 +45,39 @@ namespace osu.Game.Scoring.Legacy
|
||||
throw new BeatmapNotFoundException();
|
||||
|
||||
currentBeatmap = workingBeatmap.Beatmap;
|
||||
score.ScoreInfo.Beatmap = currentBeatmap.BeatmapInfo;
|
||||
scoreInfo.Beatmap = currentBeatmap.BeatmapInfo;
|
||||
|
||||
score.ScoreInfo.User = new User { Username = sr.ReadString() };
|
||||
scoreInfo.User = new User { Username = sr.ReadString() };
|
||||
|
||||
// MD5Hash
|
||||
sr.ReadString();
|
||||
|
||||
var count300 = (int)sr.ReadUInt16();
|
||||
var count100 = (int)sr.ReadUInt16();
|
||||
var count50 = (int)sr.ReadUInt16();
|
||||
var countGeki = (int)sr.ReadUInt16();
|
||||
var countKatu = (int)sr.ReadUInt16();
|
||||
var countMiss = (int)sr.ReadUInt16();
|
||||
scoreInfo.Count300 = sr.ReadUInt16();
|
||||
scoreInfo.Count100 = sr.ReadUInt16();
|
||||
scoreInfo.Count50 = sr.ReadUInt16();
|
||||
scoreInfo.CountGeki = sr.ReadUInt16();
|
||||
scoreInfo.CountKatu = sr.ReadUInt16();
|
||||
scoreInfo.CountMiss = sr.ReadUInt16();
|
||||
|
||||
switch (currentRuleset.LegacyID)
|
||||
{
|
||||
case 0:
|
||||
score.ScoreInfo.Statistics[HitResult.Great] = count300;
|
||||
score.ScoreInfo.Statistics[HitResult.Good] = count100;
|
||||
score.ScoreInfo.Statistics[HitResult.Meh] = count50;
|
||||
score.ScoreInfo.Statistics[HitResult.Miss] = countMiss;
|
||||
break;
|
||||
case 1:
|
||||
score.ScoreInfo.Statistics[HitResult.Great] = count300;
|
||||
score.ScoreInfo.Statistics[HitResult.Good] = count100;
|
||||
score.ScoreInfo.Statistics[HitResult.Miss] = countMiss;
|
||||
break;
|
||||
case 2:
|
||||
score.ScoreInfo.Statistics[HitResult.Great] = count300;
|
||||
score.ScoreInfo.Statistics[HitResult.Good] = count100;
|
||||
score.ScoreInfo.Statistics[HitResult.Ok] = countKatu;
|
||||
score.ScoreInfo.Statistics[HitResult.Meh] = count50;
|
||||
score.ScoreInfo.Statistics[HitResult.Miss] = countMiss;
|
||||
break;
|
||||
case 3:
|
||||
score.ScoreInfo.Statistics[HitResult.Perfect] = countGeki;
|
||||
score.ScoreInfo.Statistics[HitResult.Great] = count300;
|
||||
score.ScoreInfo.Statistics[HitResult.Good] = countKatu;
|
||||
score.ScoreInfo.Statistics[HitResult.Ok] = count100;
|
||||
score.ScoreInfo.Statistics[HitResult.Meh] = count50;
|
||||
score.ScoreInfo.Statistics[HitResult.Miss] = countMiss;
|
||||
break;
|
||||
}
|
||||
|
||||
score.ScoreInfo.TotalScore = sr.ReadInt32();
|
||||
score.ScoreInfo.MaxCombo = sr.ReadUInt16();
|
||||
scoreInfo.TotalScore = sr.ReadInt32();
|
||||
scoreInfo.MaxCombo = sr.ReadUInt16();
|
||||
|
||||
/* score.Perfect = */
|
||||
sr.ReadBoolean();
|
||||
|
||||
score.ScoreInfo.Mods = currentRuleset.ConvertLegacyMods((LegacyMods)sr.ReadInt32()).ToArray();
|
||||
scoreInfo.Mods = currentRuleset.ConvertLegacyMods((LegacyMods)sr.ReadInt32()).ToArray();
|
||||
|
||||
/* score.HpGraphString = */
|
||||
sr.ReadString();
|
||||
|
||||
score.ScoreInfo.Date = sr.ReadDateTime();
|
||||
scoreInfo.Date = sr.ReadDateTime();
|
||||
|
||||
var compressedReplay = sr.ReadByteArray();
|
||||
|
||||
if (version >= 20140721)
|
||||
score.ScoreInfo.OnlineScoreID = sr.ReadInt64();
|
||||
scoreInfo.OnlineScoreID = sr.ReadInt64();
|
||||
else if (version >= 20121008)
|
||||
score.ScoreInfo.OnlineScoreID = sr.ReadInt32();
|
||||
scoreInfo.OnlineScoreID = sr.ReadInt32();
|
||||
|
||||
if (compressedReplay?.Length > 0)
|
||||
{
|
||||
|
Reference in New Issue
Block a user