mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:42:57 +08:00
Update test scene to allow checking samples
This commit is contained in:
parent
a4254802c1
commit
c47f762f24
@ -29,13 +29,16 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
StartTime = hitObject.StartTime,
|
||||
EndTime = hitObject.GetEndTime(),
|
||||
Column = ((ManiaHitObject)hitObject).Column,
|
||||
NodeSamples = getSampleNames((hitObject as HoldNote)?.NodeSamples)
|
||||
Samples = getSampleNames(hitObject.Samples),
|
||||
NodeSamples = getNodeSampleNames((hitObject as HoldNote)?.NodeSamples)
|
||||
};
|
||||
}
|
||||
|
||||
private IList<IList<string>> getSampleNames(List<IList<HitSampleInfo>> hitSampleInfo)
|
||||
=> hitSampleInfo?.Select(samples =>
|
||||
(IList<string>)samples.Select(sample => sample.LookupNames.First()).ToList())
|
||||
private IList<string> getSampleNames(IList<HitSampleInfo> hitSampleInfo)
|
||||
=> hitSampleInfo.Select(sample => sample.LookupNames.First()).ToList();
|
||||
|
||||
private IList<IList<string>> getNodeSampleNames(List<IList<HitSampleInfo>> hitSampleInfo)
|
||||
=> hitSampleInfo?.Select(getSampleNames)
|
||||
.ToList();
|
||||
|
||||
protected override Ruleset CreateRuleset() => new ManiaRuleset();
|
||||
@ -51,14 +54,19 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
public double StartTime;
|
||||
public double EndTime;
|
||||
public int Column;
|
||||
public IList<string> Samples;
|
||||
public IList<IList<string>> NodeSamples;
|
||||
|
||||
public bool Equals(SampleConvertValue other)
|
||||
=> Precision.AlmostEquals(StartTime, other.StartTime, conversion_lenience)
|
||||
&& Precision.AlmostEquals(EndTime, other.EndTime, conversion_lenience)
|
||||
&& samplesEqual(NodeSamples, other.NodeSamples);
|
||||
&& samplesEqual(Samples, other.Samples)
|
||||
&& nodeSamplesEqual(NodeSamples, other.NodeSamples);
|
||||
|
||||
private static bool samplesEqual(ICollection<IList<string>> firstSampleList, ICollection<IList<string>> secondSampleList)
|
||||
private static bool samplesEqual(ICollection<string> firstSampleList, ICollection<string> secondSampleList)
|
||||
=> firstSampleList.SequenceEqual(secondSampleList);
|
||||
|
||||
private static bool nodeSamplesEqual(ICollection<IList<string>> firstSampleList, ICollection<IList<string>> secondSampleList)
|
||||
{
|
||||
if (firstSampleList == null && secondSampleList == null)
|
||||
return true;
|
||||
|
@ -9,7 +9,8 @@
|
||||
["normal-hitnormal"],
|
||||
["soft-hitnormal"],
|
||||
["drum-hitnormal"]
|
||||
]
|
||||
],
|
||||
"Samples": ["drum-hitnormal"]
|
||||
}, {
|
||||
"StartTime": 1875.0,
|
||||
"EndTime": 2750.0,
|
||||
@ -17,14 +18,16 @@
|
||||
"NodeSamples": [
|
||||
["soft-hitnormal"],
|
||||
["drum-hitnormal"]
|
||||
]
|
||||
],
|
||||
"Samples": ["drum-hitnormal"]
|
||||
}]
|
||||
}, {
|
||||
"StartTime": 3750.0,
|
||||
"Objects": [{
|
||||
"StartTime": 3750.0,
|
||||
"EndTime": 3750.0,
|
||||
"Column": 3
|
||||
"Column": 3,
|
||||
"Samples": ["normal-hitnormal"]
|
||||
}]
|
||||
}]
|
||||
}
|
@ -13,4 +13,4 @@ SliderTickRate:1
|
||||
|
||||
[HitObjects]
|
||||
88,99,1000,6,0,L|306:259,2,245,0|0|0,1:0|2:0|3:0,0:0:0:0:
|
||||
259,118,3750,1,0,0:0:0:0:
|
||||
259,118,3750,1,0,1:0:0:0:
|
||||
|
@ -8,7 +8,8 @@
|
||||
"NodeSamples": [
|
||||
["normal-hitnormal"],
|
||||
[]
|
||||
]
|
||||
],
|
||||
"Samples": ["normal-hitnormal"]
|
||||
}]
|
||||
}, {
|
||||
"StartTime": 2000.0,
|
||||
@ -19,7 +20,8 @@
|
||||
"NodeSamples": [
|
||||
["drum-hitnormal"],
|
||||
[]
|
||||
]
|
||||
],
|
||||
"Samples": ["drum-hitnormal"]
|
||||
}]
|
||||
}]
|
||||
}
|
Loading…
Reference in New Issue
Block a user