1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:47:28 +08:00

Fix lack of fallback logic for custom bank samples

Closes #2966.

---

Was causing some beatmaps to not play all of their hitsounds
This commit is contained in:
Dean Herbert 2018-07-10 02:56:00 +09:00
parent abfebbddd9
commit ba258b8a05
2 changed files with 13 additions and 2 deletions

View File

@ -29,6 +29,11 @@ namespace osu.Game.Audio
/// </summary>
public string Name;
/// <summary>
/// An optional suffix to provide priority lookup. Falls back to non-suffixed <see cref="Name"/>.
/// </summary>
public string Suffix;
/// <summary>
/// The sample volume.
/// </summary>
@ -41,9 +46,15 @@ namespace osu.Game.Audio
{
get
{
if (!string.IsNullOrEmpty(Suffix))
{
if (!string.IsNullOrEmpty(Namespace))
yield return $"{Namespace}/{Bank}-{Name}{Suffix}";
yield return $"{Bank}-{Name}{Suffix}"; // Without namespace as a fallback even when we have a namespace
}
if (!string.IsNullOrEmpty(Namespace))
yield return $"{Namespace}/{Bank}-{Name}";
yield return $"{Bank}-{Name}"; // Without namespace as a fallback even when we have a namespace
}
}

View File

@ -179,7 +179,7 @@ namespace osu.Game.Beatmaps.Formats
var baseInfo = base.ApplyTo(sampleInfo);
if (CustomSampleBank > 1)
baseInfo.Name += CustomSampleBank;
baseInfo.Suffix = CustomSampleBank.ToString();
return baseInfo;
}