mirror of
https://github.com/ppy/osu
synced 2025-01-21 13:23:13 +00:00
Use nullable doubule to better represent initial playback case
This commit is contained in:
parent
8f52a83b29
commit
11801d61c1
@ -16,7 +16,7 @@ namespace osu.Game.Configuration
|
|||||||
{
|
{
|
||||||
Set(Static.LoginOverlayDisplayed, false);
|
Set(Static.LoginOverlayDisplayed, false);
|
||||||
Set(Static.MutedAudioNotificationShownOnce, false);
|
Set(Static.MutedAudioNotificationShownOnce, false);
|
||||||
Set(Static.LastHoverSoundPlaybackTime, 0.0);
|
Set(Static.LastHoverSoundPlaybackTime, (double?)0.0);
|
||||||
Set<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null);
|
Set<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected readonly HoverSampleSet SampleSet;
|
protected readonly HoverSampleSet SampleSet;
|
||||||
|
|
||||||
private Bindable<double> lastPlaybackTime;
|
private Bindable<double?> lastPlaybackTime;
|
||||||
|
|
||||||
public HoverSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal)
|
public HoverSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal)
|
||||||
{
|
{
|
||||||
@ -40,7 +40,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, SessionStatics statics)
|
private void load(AudioManager audio, SessionStatics statics)
|
||||||
{
|
{
|
||||||
lastPlaybackTime = statics.GetBindable<double>(Static.LastHoverSoundPlaybackTime);
|
lastPlaybackTime = statics.GetBindable<double?>(Static.LastHoverSoundPlaybackTime);
|
||||||
|
|
||||||
sampleHover = audio.Samples.Get($@"UI/generic-hover{SampleSet.GetDescription()}");
|
sampleHover = audio.Samples.Get($@"UI/generic-hover{SampleSet.GetDescription()}");
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
bool requiresDebounce = HoverDebounceTime <= 0;
|
bool requiresDebounce = HoverDebounceTime <= 0;
|
||||||
bool enoughTimePassedSinceLastPlayback = lastPlaybackTime.Value == 0 || Time.Current - lastPlaybackTime.Value > HoverDebounceTime;
|
bool enoughTimePassedSinceLastPlayback = !lastPlaybackTime.Value.HasValue || Time.Current - lastPlaybackTime.Value >= HoverDebounceTime;
|
||||||
|
|
||||||
if (!requiresDebounce || enoughTimePassedSinceLastPlayback)
|
if (!requiresDebounce || enoughTimePassedSinceLastPlayback)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user