2022-03-10 21:09:07 +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 osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Input.Bindings;
|
|
|
|
using osu.Framework.Input.Events;
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects;
|
|
|
|
using osu.Game.Rulesets.UI;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.UI
|
|
|
|
{
|
2022-06-02 13:39:57 +08:00
|
|
|
internal partial class DrumSamplePlayer : CompositeDrawable, IKeyBindingHandler<TaikoAction>
|
2022-03-11 19:36:03 +08:00
|
|
|
{
|
2022-06-02 13:36:07 +08:00
|
|
|
private readonly DrumSampleTriggerSource leftRimSampleTriggerSource;
|
|
|
|
private readonly DrumSampleTriggerSource leftCentreSampleTriggerSource;
|
|
|
|
private readonly DrumSampleTriggerSource rightCentreSampleTriggerSource;
|
|
|
|
private readonly DrumSampleTriggerSource rightRimSampleTriggerSource;
|
2022-03-10 21:09:07 +08:00
|
|
|
|
2022-03-11 19:36:03 +08:00
|
|
|
public DrumSamplePlayer(HitObjectContainer hitObjectContainer)
|
|
|
|
{
|
2022-06-02 13:39:57 +08:00
|
|
|
InternalChildren = new Drawable[]
|
2022-03-10 21:09:07 +08:00
|
|
|
{
|
|
|
|
leftRimSampleTriggerSource = new DrumSampleTriggerSource(hitObjectContainer),
|
|
|
|
leftCentreSampleTriggerSource = new DrumSampleTriggerSource(hitObjectContainer),
|
|
|
|
rightCentreSampleTriggerSource = new DrumSampleTriggerSource(hitObjectContainer),
|
|
|
|
rightRimSampleTriggerSource = new DrumSampleTriggerSource(hitObjectContainer),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool OnPressed(KeyBindingPressEvent<TaikoAction> e)
|
|
|
|
{
|
2022-03-11 19:33:03 +08:00
|
|
|
switch (e.Action)
|
2022-03-10 21:09:07 +08:00
|
|
|
{
|
2022-03-11 19:33:03 +08:00
|
|
|
case TaikoAction.LeftRim:
|
|
|
|
leftRimSampleTriggerSource.Play(HitType.Rim);
|
|
|
|
break;
|
2022-06-02 13:36:07 +08:00
|
|
|
|
2022-03-11 19:33:03 +08:00
|
|
|
case TaikoAction.LeftCentre:
|
|
|
|
leftCentreSampleTriggerSource.Play(HitType.Centre);
|
|
|
|
break;
|
2022-06-02 13:36:07 +08:00
|
|
|
|
2022-03-11 19:33:03 +08:00
|
|
|
case TaikoAction.RightCentre:
|
|
|
|
rightCentreSampleTriggerSource.Play(HitType.Centre);
|
|
|
|
break;
|
2022-06-02 13:36:07 +08:00
|
|
|
|
2022-03-11 19:33:03 +08:00
|
|
|
case TaikoAction.RightRim:
|
|
|
|
rightRimSampleTriggerSource.Play(HitType.Rim);
|
|
|
|
break;
|
2022-03-10 21:09:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void OnReleased(KeyBindingReleaseEvent<TaikoAction> e)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|