Fix custom sample set 0 not falling back to default samples

This commit is contained in:
smoogipoo
2020-04-13 20:00:06 +09:00
parent ef5e88dd82
commit cee4b005e6
3 changed files with 15 additions and 2 deletions

View File

@ -168,7 +168,7 @@ namespace osu.Game.Beatmaps.Formats
{ {
var baseInfo = base.ApplyTo(hitSampleInfo); var baseInfo = base.ApplyTo(hitSampleInfo);
if (string.IsNullOrEmpty(baseInfo.Suffix) && CustomSampleBank > 1) if (string.IsNullOrEmpty(baseInfo.Suffix) && CustomSampleBank > 0)
baseInfo.Suffix = CustomSampleBank.ToString(); baseInfo.Suffix = CustomSampleBank.ToString();
return baseInfo; return baseInfo;

View File

@ -415,7 +415,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
{ {
set set
{ {
if (value > 1) if (value > 0)
Suffix = value.ToString(); Suffix = value.ToString();
} }
} }

View File

@ -2,8 +2,10 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.IO.Stores; using osu.Framework.IO.Stores;
using osu.Game.Audio;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
namespace osu.Game.Skinning namespace osu.Game.Skinning
@ -33,6 +35,17 @@ namespace osu.Game.Skinning
return base.GetConfig<TLookup, TValue>(lookup); return base.GetConfig<TLookup, TValue>(lookup);
} }
public override SampleChannel GetSample(ISampleInfo sampleInfo)
{
if (sampleInfo is HitSampleInfo hsi && string.IsNullOrEmpty(hsi.Suffix))
{
// When no custom sample set is provided, always fall-back to the default samples.
return null;
}
return base.GetSample(sampleInfo);
}
private static SkinInfo createSkinInfo(BeatmapInfo beatmap) => private static SkinInfo createSkinInfo(BeatmapInfo beatmap) =>
new SkinInfo { Name = beatmap.ToString(), Creator = beatmap.Metadata.Author.ToString() }; new SkinInfo { Name = beatmap.ToString(), Creator = beatmap.Metadata.Author.ToString() };
} }