2021-08-26 16:19:46 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using osu.Game.Audio;
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects;
|
|
|
|
using osu.Game.Rulesets.UI;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.UI
|
|
|
|
{
|
2022-11-24 13:32:20 +08:00
|
|
|
public partial class DrumSampleTriggerSource : GameplaySampleTriggerSource
|
2021-08-26 16:19:46 +08:00
|
|
|
{
|
|
|
|
public DrumSampleTriggerSource(HitObjectContainer hitObjectContainer)
|
|
|
|
: base(hitObjectContainer)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-06-30 15:03:11 +08:00
|
|
|
public virtual void Play(HitType hitType)
|
2021-08-26 16:19:46 +08:00
|
|
|
{
|
2023-06-30 14:06:32 +08:00
|
|
|
TaikoHitObject? hitObject = GetMostValidObject() as TaikoHitObject;
|
2021-08-26 16:19:46 +08:00
|
|
|
|
2023-06-30 14:06:32 +08:00
|
|
|
if (hitObject == null)
|
2021-08-26 16:19:46 +08:00
|
|
|
return;
|
|
|
|
|
2023-06-30 14:42:39 +08:00
|
|
|
var baseSample = hitObject.CreateHitSampleInfo(hitType == HitType.Rim ? HitSampleInfo.HIT_CLAP : HitSampleInfo.HIT_NORMAL);
|
2023-06-30 14:06:32 +08:00
|
|
|
|
2023-06-30 14:38:17 +08:00
|
|
|
if ((hitObject as TaikoStrongableHitObject)?.IsStrong == true || hitObject is StrongNestedHitObject)
|
2023-06-30 14:06:32 +08:00
|
|
|
{
|
2023-06-30 14:42:39 +08:00
|
|
|
PlaySamples(new ISampleInfo[]
|
|
|
|
{
|
2023-07-05 17:44:01 +08:00
|
|
|
baseSample,
|
|
|
|
hitObject.CreateHitSampleInfo(hitType == HitType.Rim ? HitSampleInfo.HIT_WHISTLE : HitSampleInfo.HIT_FINISH)
|
2023-06-30 14:42:39 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PlaySamples(new ISampleInfo[] { baseSample });
|
2023-06-30 14:06:32 +08:00
|
|
|
}
|
2021-08-26 16:19:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void Play() => throw new InvalidOperationException(@"Use override with HitType parameter instead");
|
|
|
|
}
|
|
|
|
}
|