1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-23 02:22:55 +08:00

Move DrumSamplePlayer to be a skinnable component

This commit is contained in:
Dean Herbert 2023-06-30 15:07:07 +09:00
parent 72e44d20e4
commit f54eb8d7fa
5 changed files with 21 additions and 7 deletions

View File

@ -60,6 +60,9 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Argon
// the drawable needs to expire as soon as possible to avoid accumulating empty drawables on the playfield. // the drawable needs to expire as soon as possible to avoid accumulating empty drawables on the playfield.
return Drawable.Empty().With(d => d.Expire()); return Drawable.Empty().With(d => d.Expire());
case TaikoSkinComponents.DrumSamplePlayer:
return Drawable.Empty();
case TaikoSkinComponents.TaikoExplosionGreat: case TaikoSkinComponents.TaikoExplosionGreat:
case TaikoSkinComponents.TaikoExplosionMiss: case TaikoSkinComponents.TaikoExplosionMiss:
case TaikoSkinComponents.TaikoExplosionOk: case TaikoSkinComponents.TaikoExplosionOk:

View File

@ -52,6 +52,9 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
return null; return null;
case TaikoSkinComponents.DrumSamplePlayer:
return null;
case TaikoSkinComponents.CentreHit: case TaikoSkinComponents.CentreHit:
case TaikoSkinComponents.RimHit: case TaikoSkinComponents.RimHit:
if (hasHitCircle) if (hasHitCircle)

View File

@ -21,6 +21,7 @@ namespace osu.Game.Rulesets.Taiko
TaikoExplosionKiai, TaikoExplosionKiai,
Scroller, Scroller,
Mascot, Mascot,
KiaiGlow KiaiGlow,
DrumSamplePlayer
} }
} }

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
@ -12,13 +13,16 @@ namespace osu.Game.Rulesets.Taiko.UI
{ {
internal partial class DrumSamplePlayer : CompositeDrawable, IKeyBindingHandler<TaikoAction> internal partial class DrumSamplePlayer : CompositeDrawable, IKeyBindingHandler<TaikoAction>
{ {
private readonly DrumSampleTriggerSource leftRimSampleTriggerSource; private DrumSampleTriggerSource leftRimSampleTriggerSource = null!;
private readonly DrumSampleTriggerSource leftCentreSampleTriggerSource; private DrumSampleTriggerSource leftCentreSampleTriggerSource = null!;
private readonly DrumSampleTriggerSource rightCentreSampleTriggerSource; private DrumSampleTriggerSource rightCentreSampleTriggerSource = null!;
private readonly DrumSampleTriggerSource rightRimSampleTriggerSource; private DrumSampleTriggerSource rightRimSampleTriggerSource = null!;
public DrumSamplePlayer(HitObjectContainer hitObjectContainer) [BackgroundDependencyLoader]
private void load(DrawableRuleset drawableRuleset)
{ {
var hitObjectContainer = drawableRuleset.Playfield.HitObjectContainer;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
leftRimSampleTriggerSource = new DrumSampleTriggerSource(hitObjectContainer), leftRimSampleTriggerSource = new DrumSampleTriggerSource(hitObjectContainer),

View File

@ -170,7 +170,10 @@ namespace osu.Game.Rulesets.Taiko.UI
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
drumRollHitContainer.CreateProxy(), drumRollHitContainer.CreateProxy(),
new DrumSamplePlayer(HitObjectContainer), new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.DrumSamplePlayer), _ => new DrumSamplePlayer())
{
RelativeSizeAxes = Axes.Both,
},
// this is added at the end of the hierarchy to receive input before taiko objects. // this is added at the end of the hierarchy to receive input before taiko objects.
// but is proxied below everything to not cover visual effects such as hit explosions. // but is proxied below everything to not cover visual effects such as hit explosions.
inputDrum, inputDrum,