From caa4b2fc11d8bad650267187a3ea84c74be72b30 Mon Sep 17 00:00:00 2001 From: "M. Sz" Date: Mon, 14 Dec 2020 19:01:27 +0100 Subject: [PATCH] escape menu hotkeys --- d2game/d2player/escape_menu.go | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/d2game/d2player/escape_menu.go b/d2game/d2player/escape_menu.go index 2609da1f..0625add1 100644 --- a/d2game/d2player/escape_menu.go +++ b/d2game/d2player/escape_menu.go @@ -398,25 +398,15 @@ func (m *EscapeMenu) OnLoad() { // OnEscKey is called when the escape key is pressed func (m *EscapeMenu) OnEscKey() { - // note: original D2 returns straight to the game from however deep in the menu we are - switch m.currentLayout { - case optionsLayoutID: - m.setLayout(mainLayoutID) - return - case soundOptionsLayoutID, - videoOptionsLayoutID, - automapOptionsLayoutID, - configureControlsLayoutID: + if m.currentLayout == configureControlsLayoutID { m.setLayout(optionsLayoutID) if err := m.keyBindingMenu.Close(); err != nil { m.Errorf("unable to close the configure controls menu: %v", err.Error()) } - - return + } else { + m.close() } - - m.close() } // SetOnCloseCb sets the callback that is run when close() is called