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

View File

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