1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 22:22:55 +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:
Dan Balasescu 2018-06-29 18:59:46 +09:00 committed by GitHub
commit 9bf906df80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -18,6 +18,8 @@ namespace osu.Game.Graphics.Containers
private SampleChannel samplePopIn; private SampleChannel samplePopIn;
private SampleChannel samplePopOut; private SampleChannel samplePopOut;
protected virtual bool PlaySamplesOnStateChange => true;
private PreviewTrackManager previewTrackManager; private PreviewTrackManager previewTrackManager;
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All); protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
@ -69,12 +71,14 @@ namespace osu.Game.Graphics.Containers
{ {
case Visibility.Visible: case Visibility.Visible:
if (OverlayActivationMode != OverlayActivation.Disabled) if (OverlayActivationMode != OverlayActivation.Disabled)
samplePopIn?.Play(); {
if (PlaySamplesOnStateChange) samplePopIn?.Play();
}
else else
State = Visibility.Hidden; State = Visibility.Hidden;
break; break;
case Visibility.Hidden: case Visibility.Hidden:
samplePopOut?.Play(); if (PlaySamplesOnStateChange) samplePopOut?.Play();
break; break;
} }
} }

View File

@ -30,6 +30,8 @@ namespace osu.Game.Overlays
State = Visibility.Visible; State = Visibility.Visible;
} }
protected override bool PlaySamplesOnStateChange => false;
private void onDialogOnStateChanged(VisibilityContainer dialog, Visibility v) private void onDialogOnStateChanged(VisibilityContainer dialog, Visibility v)
{ {
if (v != Visibility.Hidden) return; if (v != Visibility.Hidden) return;