mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 16:32:54 +08:00
Merge pull request #2849 from peppy/fix-dialog-overlay-sounds
Fix dialog overlay playing double samples on show/hide
This commit is contained in:
commit
9bf906df80
@ -18,6 +18,8 @@ namespace osu.Game.Graphics.Containers
|
||||
private SampleChannel samplePopIn;
|
||||
private SampleChannel samplePopOut;
|
||||
|
||||
protected virtual bool PlaySamplesOnStateChange => true;
|
||||
|
||||
private PreviewTrackManager previewTrackManager;
|
||||
|
||||
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
|
||||
@ -69,12 +71,14 @@ namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
case Visibility.Visible:
|
||||
if (OverlayActivationMode != OverlayActivation.Disabled)
|
||||
samplePopIn?.Play();
|
||||
{
|
||||
if (PlaySamplesOnStateChange) samplePopIn?.Play();
|
||||
}
|
||||
else
|
||||
State = Visibility.Hidden;
|
||||
break;
|
||||
case Visibility.Hidden:
|
||||
samplePopOut?.Play();
|
||||
if (PlaySamplesOnStateChange) samplePopOut?.Play();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ namespace osu.Game.Overlays
|
||||
State = Visibility.Visible;
|
||||
}
|
||||
|
||||
protected override bool PlaySamplesOnStateChange => false;
|
||||
|
||||
private void onDialogOnStateChanged(VisibilityContainer dialog, Visibility v)
|
||||
{
|
||||
if (v != Visibility.Hidden) return;
|
||||
|
Loading…
Reference in New Issue
Block a user