1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 10:47:28 +08:00

Merge pull request #655 from peppy/general-fixes

Don't play sliderbar samples more than once when value has not changed.
This commit is contained in:
Dan Balasescu 2017-04-20 18:00:49 +09:00 committed by GitHub
commit 84a8d8f00a
2 changed files with 9 additions and 2 deletions

View File

@ -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;

View File

@ -86,7 +86,7 @@ namespace osu.Game.Online.Chat.Drawables
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Font = @"Exo2.0-SemiBold", Font = @"Exo2.0-SemiBold",
Text = $@"{Message.Timestamp.LocalDateTime:hh:mm:ss}", Text = $@"{Message.Timestamp.LocalDateTime:HH:mm:ss}",
FixedWidth = true, FixedWidth = true,
TextSize = text_size * 0.75f, TextSize = text_size * 0.75f,
Alpha = 0.4f, Alpha = 0.4f,