1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 14:32:55 +08:00

Fix hold note end time being written incorrectly

This commit is contained in:
smoogipoo 2020-04-22 16:40:07 +09:00
parent 7cdc9a599c
commit 3b805daa0b

View File

@ -240,8 +240,9 @@ namespace osu.Game.Beatmaps.Formats
}
else
{
if (hitObject is IHasEndTime endTimeData)
writer.Write(FormattableString.Invariant($"{endTimeData.EndTime},"));
if (hitObject is IHasEndTime _)
addEndTimeData(writer, hitObject);
writer.Write(getSampleBank(hitObject.Samples));
}
@ -344,6 +345,20 @@ namespace osu.Game.Beatmaps.Formats
}
}
private void addEndTimeData(TextWriter writer, HitObject hitObject)
{
var endTimeData = (IHasEndTime)hitObject;
var type = getObjectType(hitObject);
char suffix = ',';
// Holds write the end time as if it's part of sample data.
if (type == LegacyHitObjectType.Hold)
suffix = ':';
writer.Write(FormattableString.Invariant($"{endTimeData.EndTime}{suffix}"));
}
private string getSampleBank(IList<HitSampleInfo> samples, bool banksOnly = false, bool zeroBanks = false)
{
LegacySampleBank normalBank = toLegacySampleBank(samples.SingleOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL)?.Bank);