mirror of https://github.com/ppy/osu
Make hit sounds into consts.
This commit is contained in:
parent
c65ab5b6f1
commit
4cc309e5a7
|
@ -59,7 +59,7 @@ private IEnumerable<TaikoHitObject> convertHitObject(HitObject obj, Beatmap beat
|
|||
// Old osu! used hit sounding to determine various hit type information
|
||||
List<SampleInfo> samples = obj.Samples;
|
||||
|
||||
bool strong = samples.Any(s => s.Name == @"hitfinish");
|
||||
bool strong = samples.Any(s => s.Name == SampleInfo.HIT_FINISH);
|
||||
|
||||
if (distanceData != null)
|
||||
{
|
||||
|
@ -133,7 +133,7 @@ private IEnumerable<TaikoHitObject> convertHitObject(HitObject obj, Beatmap beat
|
|||
}
|
||||
else
|
||||
{
|
||||
bool isRim = samples.Any(s => s.Name == @"hitclap" || s.Name == @"hitwhistle");
|
||||
bool isRim = samples.Any(s => s.Name == SampleInfo.HIT_CLAP || s.Name == SampleInfo.HIT_WHISTLE);
|
||||
|
||||
if (isRim)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
using osu.Game.Modes.Osu;
|
||||
using osu.Game.Modes.Objects.Legacy;
|
||||
using System.Linq;
|
||||
using osu.Game.Audio;
|
||||
|
||||
namespace osu.Game.Tests.Beatmaps.Formats
|
||||
{
|
||||
|
@ -136,12 +137,12 @@ public void TestDecodeHitObjects()
|
|||
Assert.IsNotNull(slider);
|
||||
Assert.AreEqual(new Vector2(192, 168), slider.Position);
|
||||
Assert.AreEqual(956, slider.StartTime);
|
||||
Assert.IsTrue(slider.Samples.Any(s => s.Name == @"hitnormal"));
|
||||
Assert.IsTrue(slider.Samples.Any(s => s.Name == SampleInfo.HIT_NORMAL));
|
||||
var hit = beatmap.HitObjects[1] as LegacyHit;
|
||||
Assert.IsNotNull(hit);
|
||||
Assert.AreEqual(new Vector2(304, 56), hit.Position);
|
||||
Assert.AreEqual(1285, hit.StartTime);
|
||||
Assert.IsTrue(hit.Samples.Any(s => s.Name == @"hitclap"));
|
||||
Assert.IsTrue(hit.Samples.Any(s => s.Name == SampleInfo.HIT_CLAP));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,11 @@ namespace osu.Game.Audio
|
|||
{
|
||||
public class SampleInfo
|
||||
{
|
||||
public const string HIT_WHISTLE = @"hitwhistle";
|
||||
public const string HIT_FINISH = @"hitfinish";
|
||||
public const string HIT_NORMAL = @"hitnormal";
|
||||
public const string HIT_CLAP = @"hitclap";
|
||||
|
||||
/// <summary>
|
||||
/// The bank to load the sample from.
|
||||
/// </summary>
|
||||
|
|
|
@ -129,7 +129,7 @@ public override HitObject Parse(string text)
|
|||
result.Samples.Add(new SampleInfo
|
||||
{
|
||||
Bank = normalSampleBank,
|
||||
Name = "hitnormal",
|
||||
Name = SampleInfo.HIT_NORMAL,
|
||||
Volume = sampleVolume
|
||||
});
|
||||
|
||||
|
@ -138,7 +138,7 @@ public override HitObject Parse(string text)
|
|||
result.Samples.Add(new SampleInfo
|
||||
{
|
||||
Bank = addSampleBank,
|
||||
Name = "hitfinish",
|
||||
Name = SampleInfo.HIT_FINISH,
|
||||
Volume = sampleVolume
|
||||
});
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ public override HitObject Parse(string text)
|
|||
result.Samples.Add(new SampleInfo
|
||||
{
|
||||
Bank = addSampleBank,
|
||||
Name = "hitwhistle",
|
||||
Name = SampleInfo.HIT_WHISTLE,
|
||||
Volume = sampleVolume
|
||||
});
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ public override HitObject Parse(string text)
|
|||
result.Samples.Add(new SampleInfo
|
||||
{
|
||||
Bank = addSampleBank,
|
||||
Name = "hitclap",
|
||||
Name = SampleInfo.HIT_CLAP,
|
||||
Volume = sampleVolume
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue