mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Extract legacy sound type enum
This commit is contained in:
14
osu.Game/Beatmaps/Legacy/LegacyHitSoundType.cs
Normal file
14
osu.Game/Beatmaps/Legacy/LegacyHitSoundType.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps.Legacy
|
||||||
|
{
|
||||||
|
[Flags]
|
||||||
|
internal enum LegacyHitSoundType
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Normal = 1,
|
||||||
|
Whistle = 2,
|
||||||
|
Finish = 4,
|
||||||
|
Clap = 8
|
||||||
|
}
|
||||||
|
}
|
@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
bool combo = type.HasFlag(ConvertHitObjectType.NewCombo);
|
bool combo = type.HasFlag(ConvertHitObjectType.NewCombo);
|
||||||
type &= ~ConvertHitObjectType.NewCombo;
|
type &= ~ConvertHitObjectType.NewCombo;
|
||||||
|
|
||||||
var soundType = (LegacySoundType)Parsing.ParseInt(split[4]);
|
var soundType = (LegacyHitSoundType)Parsing.ParseInt(split[4]);
|
||||||
var bankInfo = new SampleBankInfo();
|
var bankInfo = new SampleBankInfo();
|
||||||
|
|
||||||
HitObject result = null;
|
HitObject result = null;
|
||||||
@ -157,7 +157,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Populate node sound types with the default hit object sound type
|
// Populate node sound types with the default hit object sound type
|
||||||
var nodeSoundTypes = new List<LegacySoundType>();
|
var nodeSoundTypes = new List<LegacyHitSoundType>();
|
||||||
for (int i = 0; i < nodes; i++)
|
for (int i = 0; i < nodes; i++)
|
||||||
nodeSoundTypes.Add(soundType);
|
nodeSoundTypes.Add(soundType);
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
int.TryParse(adds[i], out var sound);
|
int.TryParse(adds[i], out var sound);
|
||||||
nodeSoundTypes[i] = (LegacySoundType)sound;
|
nodeSoundTypes[i] = (LegacyHitSoundType)sound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
/// <param name="endTime">The hold end time.</param>
|
/// <param name="endTime">The hold end time.</param>
|
||||||
protected abstract HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime);
|
protected abstract HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime);
|
||||||
|
|
||||||
private List<HitSampleInfo> convertSoundType(LegacySoundType type, SampleBankInfo bankInfo)
|
private List<HitSampleInfo> convertSoundType(LegacyHitSoundType type, SampleBankInfo bankInfo)
|
||||||
{
|
{
|
||||||
// Todo: This should return the normal SampleInfos if the specified sample file isn't found, but that's a pretty edge-case scenario
|
// Todo: This should return the normal SampleInfos if the specified sample file isn't found, but that's a pretty edge-case scenario
|
||||||
if (!string.IsNullOrEmpty(bankInfo.Filename))
|
if (!string.IsNullOrEmpty(bankInfo.Filename))
|
||||||
@ -359,7 +359,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (type.HasFlag(LegacySoundType.Finish))
|
if (type.HasFlag(LegacyHitSoundType.Finish))
|
||||||
{
|
{
|
||||||
soundTypes.Add(new LegacyHitSampleInfo
|
soundTypes.Add(new LegacyHitSampleInfo
|
||||||
{
|
{
|
||||||
@ -370,7 +370,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type.HasFlag(LegacySoundType.Whistle))
|
if (type.HasFlag(LegacyHitSoundType.Whistle))
|
||||||
{
|
{
|
||||||
soundTypes.Add(new LegacyHitSampleInfo
|
soundTypes.Add(new LegacyHitSampleInfo
|
||||||
{
|
{
|
||||||
@ -381,7 +381,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type.HasFlag(LegacySoundType.Clap))
|
if (type.HasFlag(LegacyHitSoundType.Clap))
|
||||||
{
|
{
|
||||||
soundTypes.Add(new LegacyHitSampleInfo
|
soundTypes.Add(new LegacyHitSampleInfo
|
||||||
{
|
{
|
||||||
@ -430,15 +430,5 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
Path.ChangeExtension(Filename, null)
|
Path.ChangeExtension(Filename, null)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[Flags]
|
|
||||||
private enum LegacySoundType
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
Normal = 1,
|
|
||||||
Whistle = 2,
|
|
||||||
Finish = 4,
|
|
||||||
Clap = 8
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user