1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 18:47:27 +08:00

Remove unnecessary second variable

This commit is contained in:
Dean Herbert 2021-03-13 23:29:01 +09:00
parent 0ba5312a40
commit e70ba2d005

View File

@ -28,8 +28,6 @@ namespace osu.Game.Overlays.Toolbar
/// </summary> /// </summary>
private bool hiddenByUser; private bool hiddenByUser;
private bool userToggled;
public Action OnHome; public Action OnHome;
private ToolbarUserButton userButton; private ToolbarUserButton userButton;
@ -151,9 +149,9 @@ namespace osu.Game.Overlays.Toolbar
protected override void UpdateState(ValueChangedEvent<Visibility> state) protected override void UpdateState(ValueChangedEvent<Visibility> state)
{ {
var blockShow = !userToggled && hiddenByUser; bool blockShow = hiddenByUser || OverlayActivationMode.Value == OverlayActivation.Disabled;
if (state.NewValue == Visibility.Visible && (OverlayActivationMode.Value == OverlayActivation.Disabled || blockShow)) if (state.NewValue == Visibility.Visible && blockShow)
{ {
State.Value = Visibility.Hidden; State.Value = Visibility.Hidden;
return; return;
@ -184,10 +182,8 @@ namespace osu.Game.Overlays.Toolbar
switch (action) switch (action)
{ {
case GlobalAction.ToggleToolbar: case GlobalAction.ToggleToolbar:
userToggled = true; hiddenByUser = State.Value == Visibility.Visible; // set before toggling to allow the operation to always succeed.
ToggleVisibility(); ToggleVisibility();
hiddenByUser = State.Value == Visibility.Hidden;
userToggled = false;
return true; return true;
} }