mirror of
https://github.com/ppy/osu.git
synced 2025-02-05 06:32:55 +08:00
Move DrumSampleTriggerSource
into its own class to avoid nested references
This commit is contained in:
parent
f078a9d2bf
commit
90e81a595d
@ -112,7 +112,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
|||||||
public readonly Sprite Centre;
|
public readonly Sprite Centre;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private InputDrum.DrumSampleTriggerSource sampleTriggerSource { get; set; }
|
private DrumSampleTriggerSource sampleTriggerSource { get; set; }
|
||||||
|
|
||||||
public LegacyHalfDrum(bool flipped)
|
public LegacyHalfDrum(bool flipped)
|
||||||
{
|
{
|
||||||
|
30
osu.Game.Rulesets.Taiko/UI/DrumSampleTriggerSource.cs
Normal file
30
osu.Game.Rulesets.Taiko/UI/DrumSampleTriggerSource.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// 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
|
||||||
|
{
|
||||||
|
public class DrumSampleTriggerSource : GameplaySampleTriggerSource
|
||||||
|
{
|
||||||
|
public DrumSampleTriggerSource(HitObjectContainer hitObjectContainer)
|
||||||
|
: base(hitObjectContainer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Play(HitType hitType)
|
||||||
|
{
|
||||||
|
var hitObject = GetMostValidObject();
|
||||||
|
|
||||||
|
if (hitObject == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
PlaySamples(new ISampleInfo[] { hitObject.SampleControlPoint.GetSampleInfo(hitType == HitType.Rim ? HitSampleInfo.HIT_CLAP : HitSampleInfo.HIT_NORMAL) });
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Play() => throw new InvalidOperationException(@"Use override with HitType parameter instead");
|
||||||
|
}
|
||||||
|
}
|
@ -8,7 +8,6 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Audio;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
@ -201,24 +200,5 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DrumSampleTriggerSource : GameplaySampleTriggerSource
|
|
||||||
{
|
|
||||||
public DrumSampleTriggerSource(HitObjectContainer hitObjectContainer)
|
|
||||||
: base(hitObjectContainer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Play(HitType hitType)
|
|
||||||
{
|
|
||||||
var hitObject = GetMostValidObject();
|
|
||||||
|
|
||||||
if (hitObject == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
PlaySamples(new ISampleInfo[] { hitObject.SampleControlPoint.GetSampleInfo(hitType == HitType.Rim ? HitSampleInfo.HIT_CLAP : HitSampleInfo.HIT_NORMAL) });
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Play() => throw new InvalidOperationException(@"Use override with HitType parameter instead");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user