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

Add spinnerbonus-max support and fallback to spinnerbonus

This commit is contained in:
Dean Herbert 2023-11-06 18:43:47 +09:00
parent b219a371a9
commit 92e4a8666d
No known key found for this signature in database

View File

@ -4,6 +4,7 @@
#nullable disable
using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Allocation;
@ -144,7 +145,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
spinningSample.Samples = HitObject.CreateSpinningSamples().Cast<ISampleInfo>().ToArray();
spinningSample.Frequency.Value = spinning_sample_initial_frequency;
maxBonusSample.Samples = new ISampleInfo[] { HitObject.CreateHitSampleInfo("spinnerbonus") };
maxBonusSample.Samples = new ISampleInfo[] { new SpinnerBonusMaxSampleInfo(HitObject.CreateHitSampleInfo()) };
}
private void updateSpinningSample(ValueChangedEvent<bool> tracking)
@ -344,5 +345,26 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
completedFullSpins.Value++;
}
}
public class SpinnerBonusMaxSampleInfo : HitSampleInfo
{
public override IEnumerable<string> LookupNames
{
get
{
foreach (string name in base.LookupNames)
yield return name;
foreach (string name in base.LookupNames)
yield return name.Replace("-max", string.Empty);
}
}
public SpinnerBonusMaxSampleInfo(HitSampleInfo sampleInfo)
: base("spinnerbonus-max", sampleInfo.Bank, sampleInfo.Suffix, sampleInfo.Volume)
{
}
}
}
}