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