Early return to avoid other potential fail cases

This commit is contained in:
Dean Herbert 2019-09-11 17:34:03 +09:00
parent f53410a42a
commit 825a34ecd3
1 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
@ -106,26 +106,26 @@ public virtual bool OnPressed(GlobalAction action)
protected override void UpdateState(ValueChangedEvent<Visibility> state)
{
base.UpdateState(state);
switch (state.NewValue)
{
case Visibility.Visible:
if (OverlayActivationMode.Value != OverlayActivation.Disabled)
if (OverlayActivationMode.Value == OverlayActivation.Disabled)
{
if (PlaySamplesOnStateChange) samplePopIn?.Play();
if (BlockScreenWideMouse && DimMainContent) osuGame?.AddBlockingOverlay(this);
State.Value = Visibility.Hidden;
return;
}
else
Hide();
if (PlaySamplesOnStateChange) samplePopIn?.Play();
if (BlockScreenWideMouse && DimMainContent) game?.AddBlockingOverlay(this);
break;
case Visibility.Hidden:
if (PlaySamplesOnStateChange) samplePopOut?.Play();
if (BlockScreenWideMouse) osuGame?.RemoveBlockingOverlay(this);
if (BlockScreenWideMouse) game?.RemoveBlockingOverlay(this);
break;
}
base.UpdateState(state);
}
protected override void PopOut()