mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 22:22:56 +08:00
Add tick sample.
This commit is contained in:
parent
19eb58e724
commit
2640c2ac43
@ -2,9 +2,13 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Game.Beatmaps.Samples;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
@ -48,6 +52,22 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
};
|
||||
}
|
||||
|
||||
private AudioSample sample;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
string sampleSet = (HitObject.Sample?.Set ?? SampleSet.Normal).ToString().ToLower();
|
||||
|
||||
sample = audio.Sample.Get($@"Gameplay/{sampleSet}-slidertick");
|
||||
}
|
||||
|
||||
protected override void PlaySample()
|
||||
{
|
||||
sample?.Play();
|
||||
}
|
||||
|
||||
|
||||
protected override void CheckJudgement(bool userTriggered)
|
||||
{
|
||||
if (Judgement.TimeOffset >= 0)
|
||||
|
@ -66,7 +66,7 @@ namespace osu.Game.Modes.Objects.Drawables
|
||||
sample = audio.Sample.Get($@"Gameplay/{sampleSet}-hit{hitType}");
|
||||
}
|
||||
|
||||
protected void PlaySample()
|
||||
protected virtual void PlaySample()
|
||||
{
|
||||
sample?.Play();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user