1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 16:53:20 +08:00

Move blocking show logic to UpdateState

This commit is contained in:
Joehu 2021-03-13 00:05:26 -08:00
parent 5999e4ba33
commit 0ba5312a40
3 changed files with 11 additions and 6 deletions

View File

@ -983,7 +983,7 @@ namespace osu.Game
if (newOsuScreen.HideOverlaysOnEnter) if (newOsuScreen.HideOverlaysOnEnter)
CloseAllOverlays(); CloseAllOverlays();
else if (!Toolbar.HiddenByUser) else
Toolbar.Show(); Toolbar.Show();
if (newOsuScreen.AllowBackButton) if (newOsuScreen.AllowBackButton)

View File

@ -26,7 +26,9 @@ namespace osu.Game.Overlays.Toolbar
/// <summary> /// <summary>
/// Whether the user hid this <see cref="Toolbar"/> with <see cref="GlobalAction.ToggleToolbar"/>. /// Whether the user hid this <see cref="Toolbar"/> with <see cref="GlobalAction.ToggleToolbar"/>.
/// </summary> /// </summary>
public bool HiddenByUser; private bool hiddenByUser;
private bool userToggled;
public Action OnHome; public Action OnHome;
@ -149,7 +151,9 @@ namespace osu.Game.Overlays.Toolbar
protected override void UpdateState(ValueChangedEvent<Visibility> state) protected override void UpdateState(ValueChangedEvent<Visibility> state)
{ {
if (state.NewValue == Visibility.Visible && OverlayActivationMode.Value == OverlayActivation.Disabled) var blockShow = !userToggled && hiddenByUser;
if (state.NewValue == Visibility.Visible && (OverlayActivationMode.Value == OverlayActivation.Disabled || blockShow))
{ {
State.Value = Visibility.Hidden; State.Value = Visibility.Hidden;
return; return;
@ -180,8 +184,10 @@ namespace osu.Game.Overlays.Toolbar
switch (action) switch (action)
{ {
case GlobalAction.ToggleToolbar: case GlobalAction.ToggleToolbar:
userToggled = true;
ToggleVisibility(); ToggleVisibility();
HiddenByUser = State.Value == Visibility.Hidden; hiddenByUser = State.Value == Visibility.Hidden;
userToggled = false;
return true; return true;
} }

View File

@ -352,8 +352,7 @@ namespace osu.Game.Screens.Menu
if (impact) if (impact)
logo.Impact(); logo.Impact();
if (game?.Toolbar.HiddenByUser == false) game?.Toolbar.Show();
game.Toolbar.Show();
}, 200); }, 200);
break; break;