1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 03:22:57 +08:00

Add argon-specific DrumSamplePlayer

This commit is contained in:
Dean Herbert 2023-06-30 16:03:11 +09:00
parent 6d4fa6569f
commit ae86fc736a
4 changed files with 59 additions and 7 deletions

View File

@ -0,0 +1,49 @@
// 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 osu.Game.Audio;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Taiko.Skinning.Argon
{
public partial class ArgonDrumSamplePlayer : DrumSamplePlayer
{
protected override DrumSampleTriggerSource CreateTriggerSource(HitObjectContainer hitObjectContainer) =>
new ArgonDrumSampleTriggerSource(hitObjectContainer);
public partial class ArgonDrumSampleTriggerSource : DrumSampleTriggerSource
{
public ArgonDrumSampleTriggerSource(HitObjectContainer hitObjectContainer)
: base(hitObjectContainer)
{
}
public override void Play(HitType hitType)
{
// let the magic begin...
TaikoHitObject? hitObject = GetMostValidObject() as TaikoHitObject;
if (hitObject == null)
return;
var baseSample = hitObject.CreateHitSampleInfo(hitType == HitType.Rim ? HitSampleInfo.HIT_CLAP : HitSampleInfo.HIT_NORMAL);
if ((hitObject as TaikoStrongableHitObject)?.IsStrong == true || hitObject is StrongNestedHitObject)
{
PlaySamples(new ISampleInfo[]
{
hitObject.CreateHitSampleInfo(hitType == HitType.Rim ? HitSampleInfo.HIT_WHISTLE : HitSampleInfo.HIT_FINISH),
baseSample
});
}
else
{
PlaySamples(new ISampleInfo[] { baseSample });
}
}
}
}
}

View File

@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Argon
return Drawable.Empty().With(d => d.Expire()); return Drawable.Empty().With(d => d.Expire());
case TaikoSkinComponents.DrumSamplePlayer: case TaikoSkinComponents.DrumSamplePlayer:
return Drawable.Empty(); return new ArgonDrumSamplePlayer();
case TaikoSkinComponents.TaikoExplosionGreat: case TaikoSkinComponents.TaikoExplosionGreat:
case TaikoSkinComponents.TaikoExplosionMiss: case TaikoSkinComponents.TaikoExplosionMiss:

View File

@ -11,7 +11,7 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Taiko.UI namespace osu.Game.Rulesets.Taiko.UI
{ {
internal partial class DrumSamplePlayer : CompositeDrawable, IKeyBindingHandler<TaikoAction> public partial class DrumSamplePlayer : CompositeDrawable, IKeyBindingHandler<TaikoAction>
{ {
private DrumSampleTriggerSource leftRimSampleTriggerSource = null!; private DrumSampleTriggerSource leftRimSampleTriggerSource = null!;
private DrumSampleTriggerSource leftCentreSampleTriggerSource = null!; private DrumSampleTriggerSource leftCentreSampleTriggerSource = null!;
@ -25,13 +25,16 @@ namespace osu.Game.Rulesets.Taiko.UI
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
leftRimSampleTriggerSource = new DrumSampleTriggerSource(hitObjectContainer), leftRimSampleTriggerSource = CreateTriggerSource(hitObjectContainer),
leftCentreSampleTriggerSource = new DrumSampleTriggerSource(hitObjectContainer), leftCentreSampleTriggerSource = CreateTriggerSource(hitObjectContainer),
rightCentreSampleTriggerSource = new DrumSampleTriggerSource(hitObjectContainer), rightCentreSampleTriggerSource = CreateTriggerSource(hitObjectContainer),
rightRimSampleTriggerSource = new DrumSampleTriggerSource(hitObjectContainer), rightRimSampleTriggerSource = CreateTriggerSource(hitObjectContainer),
}; };
} }
protected virtual DrumSampleTriggerSource CreateTriggerSource(HitObjectContainer hitObjectContainer)
=> new DrumSampleTriggerSource(hitObjectContainer);
public bool OnPressed(KeyBindingPressEvent<TaikoAction> e) public bool OnPressed(KeyBindingPressEvent<TaikoAction> e)
{ {
switch (e.Action) switch (e.Action)

View File

@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Taiko.UI
{ {
} }
public void Play(HitType hitType) public virtual void Play(HitType hitType)
{ {
TaikoHitObject? hitObject = GetMostValidObject() as TaikoHitObject; TaikoHitObject? hitObject = GetMostValidObject() as TaikoHitObject;