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

Update OsuSliderBar to use new notch-tick sample and tweak pitch ramping

This commit is contained in:
Jamie Taylor 2021-07-01 20:45:29 +09:00
parent 68c5e6a431
commit dad28b2826
No known key found for this signature in database
GPG Key ID: 2ACFA8B6370B8C8C

View File

@ -15,6 +15,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Framework.Utils;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
@ -99,7 +100,7 @@ namespace osu.Game.Graphics.UserInterface
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio, OsuColour colours) private void load(AudioManager audio, OsuColour colours)
{ {
sample = audio.Samples.Get(@"UI/sliderbar-notch"); sample = audio.Samples.Get(@"UI/notch-tick");
AccentColour = colours.Pink; AccentColour = colours.Pink;
} }
@ -149,7 +150,7 @@ namespace osu.Game.Graphics.UserInterface
private void playSample(T value) private void playSample(T value)
{ {
if (Clock == null || Clock.CurrentTime - lastSampleTime <= 50) if (Clock == null || Clock.CurrentTime - lastSampleTime <= 30)
return; return;
if (value.Equals(lastSampleValue)) if (value.Equals(lastSampleValue))
@ -160,11 +161,11 @@ namespace osu.Game.Graphics.UserInterface
var channel = sample.Play(); var channel = sample.Play();
channel.Frequency.Value = 1 + NormalizedValue * 0.2f; channel.Frequency.Value = 1 + NormalizedValue * 0.2f + RNG.NextDouble(0.02f);
if (NormalizedValue == 0) if (NormalizedValue == 0)
channel.Frequency.Value -= 0.4f; channel.Frequency.Value -= 0.5f;
else if (NormalizedValue == 1) else if (NormalizedValue == 1)
channel.Frequency.Value += 0.4f; channel.Frequency.Value -= 0.5f;
} }
private void updateTooltipText(T value) private void updateTooltipText(T value)