From b5750689fb01b148675d1c54c40c55cf41ccfbda Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Thu, 16 Jan 2025 17:39:14 +0300 Subject: [PATCH] Fix main menu doesn't hide in-game (#943) Fix after changes in eabe17251a0d3b1915c8b3eb794a233f0322dfba --- src/xrGame/ui/UIMMShniaga.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/xrGame/ui/UIMMShniaga.cpp b/src/xrGame/ui/UIMMShniaga.cpp index dcc0a38d70f..f74b7342fc2 100644 --- a/src/xrGame/ui/UIMMShniaga.cpp +++ b/src/xrGame/ui/UIMMShniaga.cpp @@ -390,14 +390,14 @@ void CUIMMShniaga::OnBtnClick() bool CUIMMShniaga::OnKeyboardAction(int dik, EUIMessages keyboard_action) { - if (IsBinded(kQUIT, dik)) - { - if (m_page != epi_main) - ShowMain(); + if (CUIWindow::OnKeyboardAction(dik, keyboard_action)) return true; - } - const auto action = GetBindedAction(dik, EKeyContext::UI); + EGameActions action; + if (IsBinded(kQUIT, dik)) + action = kUI_BACK; + else + action = GetBindedAction(dik, EKeyContext::UI); // Check here only for key press to fix too fast clicks if (WINDOW_KEY_PRESSED == keyboard_action) @@ -410,9 +410,11 @@ bool CUIMMShniaga::OnKeyboardAction(int dik, EUIMessages keyboard_action) case kUI_BACK: if (m_page != epi_main) + { ShowMain(); - return true; - + return true; + } + break; case kUI_MOVE_UP: case kUI_MOVE_DOWN: // CInput sends both 'key hold' and 'key press' during one frame for keyboard (not gamepad) @@ -447,7 +449,7 @@ bool CUIMMShniaga::OnKeyboardAction(int dik, EUIMessages keyboard_action) } // switch (GetBindedAction(dik)) } - return CUIWindow::OnKeyboardAction(dik, keyboard_action); + return false; } bool CUIMMShniaga::OnControllerAction(int axis, float x, float y, EUIMessages controller_action)