mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:33:30 +08:00
Move blocking show logic to UpdateState
This commit is contained in:
parent
5999e4ba33
commit
0ba5312a40
@ -983,7 +983,7 @@ namespace osu.Game
|
||||
|
||||
if (newOsuScreen.HideOverlaysOnEnter)
|
||||
CloseAllOverlays();
|
||||
else if (!Toolbar.HiddenByUser)
|
||||
else
|
||||
Toolbar.Show();
|
||||
|
||||
if (newOsuScreen.AllowBackButton)
|
||||
|
@ -26,7 +26,9 @@ namespace osu.Game.Overlays.Toolbar
|
||||
/// <summary>
|
||||
/// Whether the user hid this <see cref="Toolbar"/> with <see cref="GlobalAction.ToggleToolbar"/>.
|
||||
/// </summary>
|
||||
public bool HiddenByUser;
|
||||
private bool hiddenByUser;
|
||||
|
||||
private bool userToggled;
|
||||
|
||||
public Action OnHome;
|
||||
|
||||
@ -149,7 +151,9 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
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;
|
||||
return;
|
||||
@ -180,8 +184,10 @@ namespace osu.Game.Overlays.Toolbar
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.ToggleToolbar:
|
||||
userToggled = true;
|
||||
ToggleVisibility();
|
||||
HiddenByUser = State.Value == Visibility.Hidden;
|
||||
hiddenByUser = State.Value == Visibility.Hidden;
|
||||
userToggled = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -352,8 +352,7 @@ namespace osu.Game.Screens.Menu
|
||||
if (impact)
|
||||
logo.Impact();
|
||||
|
||||
if (game?.Toolbar.HiddenByUser == false)
|
||||
game.Toolbar.Show();
|
||||
game?.Toolbar.Show();
|
||||
}, 200);
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user