mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 10:22:54 +08:00
Remove added property, use local decoding instead
This commit is contained in:
parent
af713a7869
commit
6e33509417
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
|
using osu.Game.IO.Legacy;
|
||||||
using osu.Game.Rulesets.Catch;
|
using osu.Game.Rulesets.Catch;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
@ -34,7 +35,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
};
|
};
|
||||||
|
|
||||||
var score = new Score { ScoreInfo = scoreInfo };
|
var score = new Score { ScoreInfo = scoreInfo };
|
||||||
var decodedAfterEncode = encodeThenDecode(LegacyBeatmapDecoder.LATEST_VERSION, score, beatmap, out _);
|
var decodedAfterEncode = encodeThenDecode(LegacyBeatmapDecoder.LATEST_VERSION, score, beatmap);
|
||||||
|
|
||||||
Assert.That(decodedAfterEncode.ScoreInfo.GetCountMiss(), Is.EqualTo(missCount + largeTickMissCount));
|
Assert.That(decodedAfterEncode.ScoreInfo.GetCountMiss(), Is.EqualTo(missCount + largeTickMissCount));
|
||||||
}
|
}
|
||||||
@ -61,12 +62,35 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
scoreInfo.Combo = 1;
|
scoreInfo.Combo = 1;
|
||||||
scoreInfo.MaxCombo = 1;
|
scoreInfo.MaxCombo = 1;
|
||||||
|
|
||||||
encodeThenDecode(LegacyBeatmapDecoder.LATEST_VERSION, new Score { ScoreInfo = scoreInfo }, beatmap, out var decoder);
|
using (var ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
new LegacyScoreEncoder(new Score { ScoreInfo = scoreInfo }, beatmap).Encode(ms, true);
|
||||||
|
|
||||||
Assert.That(decoder.DecodedPerfectValue, Is.False);
|
ms.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
|
using (var sr = new SerializationReader(ms))
|
||||||
|
{
|
||||||
|
sr.ReadByte(); // ruleset id
|
||||||
|
sr.ReadInt32(); // version
|
||||||
|
sr.ReadString(); // beatmap hash
|
||||||
|
sr.ReadString(); // username
|
||||||
|
sr.ReadString(); // score hash
|
||||||
|
sr.ReadInt16(); // count300
|
||||||
|
sr.ReadInt16(); // count100
|
||||||
|
sr.ReadInt16(); // count50
|
||||||
|
sr.ReadInt16(); // countGeki
|
||||||
|
sr.ReadInt16(); // countKatu
|
||||||
|
sr.ReadInt16(); // countMiss
|
||||||
|
sr.ReadInt32(); // total score
|
||||||
|
sr.ReadInt16(); // max combo
|
||||||
|
bool isPerfect = sr.ReadBoolean(); // full combo
|
||||||
|
|
||||||
|
Assert.That(isPerfect, Is.False);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Score encodeThenDecode(int beatmapVersion, Score score, TestBeatmap beatmap, out LegacyScoreDecoderTest.TestLegacyScoreDecoder decoder)
|
private static Score encodeThenDecode(int beatmapVersion, Score score, TestBeatmap beatmap)
|
||||||
{
|
{
|
||||||
var encodeStream = new MemoryStream();
|
var encodeStream = new MemoryStream();
|
||||||
|
|
||||||
@ -75,7 +99,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
|
|
||||||
var decodeStream = new MemoryStream(encodeStream.GetBuffer());
|
var decodeStream = new MemoryStream(encodeStream.GetBuffer());
|
||||||
|
|
||||||
decoder = new LegacyScoreDecoderTest.TestLegacyScoreDecoder(beatmapVersion);
|
var decoder = new LegacyScoreDecoderTest.TestLegacyScoreDecoder(beatmapVersion);
|
||||||
var decodedAfterEncode = decoder.Parse(decodeStream);
|
var decodedAfterEncode = decoder.Parse(decodeStream);
|
||||||
return decodedAfterEncode;
|
return decodedAfterEncode;
|
||||||
}
|
}
|
||||||
|
@ -27,11 +27,6 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
{
|
{
|
||||||
public abstract class LegacyScoreDecoder
|
public abstract class LegacyScoreDecoder
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// The decoded "IsPerfect" value. This isn't used by osu!lazer.
|
|
||||||
/// </summary>
|
|
||||||
public bool DecodedPerfectValue { get; private set; }
|
|
||||||
|
|
||||||
private IBeatmap currentBeatmap;
|
private IBeatmap currentBeatmap;
|
||||||
private Ruleset currentRuleset;
|
private Ruleset currentRuleset;
|
||||||
|
|
||||||
@ -87,7 +82,7 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
scoreInfo.MaxCombo = sr.ReadUInt16();
|
scoreInfo.MaxCombo = sr.ReadUInt16();
|
||||||
|
|
||||||
/* score.Perfect = */
|
/* score.Perfect = */
|
||||||
DecodedPerfectValue = sr.ReadBoolean();
|
sr.ReadBoolean();
|
||||||
|
|
||||||
scoreInfo.Mods = currentRuleset.ConvertFromLegacyMods((LegacyMods)sr.ReadInt32()).ToArray();
|
scoreInfo.Mods = currentRuleset.ConvertFromLegacyMods((LegacyMods)sr.ReadInt32()).ToArray();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user