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:
commit
9bf906df80
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user