1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:52:54 +08:00

Merge pull request #13459 from peppy/fix-wave-overlay-sound-on-switch

This commit is contained in:
Bartłomiej Dach 2021-06-11 22:41:23 +02:00 committed by GitHub
commit c644e11e5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,10 +107,10 @@ namespace osu.Game.Graphics.Containers
{ {
} }
private bool playedPopInSound;
protected override void UpdateState(ValueChangedEvent<Visibility> state) protected override void UpdateState(ValueChangedEvent<Visibility> state)
{ {
bool didChange = state.NewValue != state.OldValue;
switch (state.NewValue) switch (state.NewValue)
{ {
case Visibility.Visible: case Visibility.Visible:
@ -121,18 +121,15 @@ namespace osu.Game.Graphics.Containers
return; return;
} }
samplePopIn?.Play(); if (didChange)
playedPopInSound = true; samplePopIn?.Play();
if (BlockScreenWideMouse && DimMainContent) game?.AddBlockingOverlay(this); if (BlockScreenWideMouse && DimMainContent) game?.AddBlockingOverlay(this);
break; break;
case Visibility.Hidden: case Visibility.Hidden:
if (playedPopInSound) if (didChange)
{
samplePopOut?.Play(); samplePopOut?.Play();
playedPopInSound = false;
}
if (BlockScreenWideMouse) game?.RemoveBlockingOverlay(this); if (BlockScreenWideMouse) game?.RemoveBlockingOverlay(this);
break; break;