mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 07:07:45 +08:00
Address code quality issues
This commit is contained in:
parent
e8984333f6
commit
7bb955b221
@ -29,7 +29,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
private readonly int onlineRulesetID;
|
||||
|
||||
private List<string> customSoundBanks = new List<string>();
|
||||
private readonly List<string> customSoundBanks = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="LegacyBeatmapEncoder"/>.
|
||||
@ -387,6 +387,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
private void checkCustomSoundBank(HitObject h)
|
||||
{
|
||||
string? bank = h.Samples.SingleOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL)?.Bank;
|
||||
|
||||
if (bank != null
|
||||
&& !customSoundBanks.Contains(bank)
|
||||
&& bank != "none" && bank != "normal" && bank != "soft" && bank != "drum")
|
||||
@ -396,10 +397,10 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
if (h is IHasRepeats hr)
|
||||
{
|
||||
foreach (List<HitSampleInfo> node in hr.NodeSamples)
|
||||
foreach (IList<HitSampleInfo> node in hr.NodeSamples)
|
||||
{
|
||||
if (node.Count > 0 && !customSoundBanks.Contains(node[0].Bank)
|
||||
&& node[0].Bank != "none" && node[0].Bank != "normal" && node[0].Bank != "soft" && node[0].Bank != "drum")
|
||||
if (node.Count > 0 && !customSoundBanks.Contains(node[0].Bank) &&
|
||||
node[0].Bank != "none" && node[0].Bank != "normal" && node[0].Bank != "soft" && node[0].Bank != "drum")
|
||||
{
|
||||
customSoundBanks.Add(node[0].Bank);
|
||||
}
|
||||
@ -640,8 +641,8 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
private int toLegacySampleBank(string? sampleBank)
|
||||
{
|
||||
|
||||
string? sampleBankLower = sampleBank?.ToLowerInvariant();
|
||||
|
||||
switch (sampleBankLower)
|
||||
{
|
||||
case HitSampleInfo.BANK_NORMAL:
|
||||
@ -655,6 +656,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
default:
|
||||
if (sampleBankLower != null) return customSoundBanks.IndexOf(sampleBankLower) + 4;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -194,11 +194,11 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
|
||||
string[] split = str.Split(':');
|
||||
|
||||
|
||||
string bank = (Parsing.ParseInt(split[0]) > AvailableSampleBanks.Count - 1) ? "normal" : AvailableSampleBanks[Parsing.ParseInt(split[0])];
|
||||
string addBank = (Parsing.ParseInt(split[1]) > AvailableSampleBanks.Count - 1) ? "normal" : AvailableSampleBanks[Parsing.ParseInt(split[1])];
|
||||
|
||||
if (bank == @"none") { bank = null; };
|
||||
if (bank == @"none") { bank = null; }
|
||||
|
||||
if (addBank == @"none") { addBank = null; }
|
||||
|
||||
bankInfo.BankForNormal = bank;
|
||||
|
Loading…
Reference in New Issue
Block a user