mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Don't play sliderbar samples more than once when value has not changed.
This commit is contained in:
@ -12,10 +12,11 @@ using osu.Framework.Input;
|
|||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
public class OsuSliderBar<U> : SliderBar<U> where U : struct
|
public class OsuSliderBar<T> : SliderBar<T> where T : struct
|
||||||
{
|
{
|
||||||
private SampleChannel sample;
|
private SampleChannel sample;
|
||||||
private double lastSampleTime;
|
private double lastSampleTime;
|
||||||
|
private T lastSampleValue;
|
||||||
|
|
||||||
private readonly Nub nub;
|
private readonly Nub nub;
|
||||||
private readonly Box leftBox;
|
private readonly Box leftBox;
|
||||||
@ -84,6 +85,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
if (Clock == null || Clock.CurrentTime - lastSampleTime <= 50)
|
if (Clock == null || Clock.CurrentTime - lastSampleTime <= 50)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (Current.Value.Equals(lastSampleValue))
|
||||||
|
return;
|
||||||
|
|
||||||
|
lastSampleValue = Current.Value;
|
||||||
|
|
||||||
lastSampleTime = Clock.CurrentTime;
|
lastSampleTime = Clock.CurrentTime;
|
||||||
sample.Frequency.Value = 1 + NormalizedValue * 0.2f;
|
sample.Frequency.Value = 1 + NormalizedValue * 0.2f;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user