diff options
Diffstat (limited to 'Northstar.Client/mod/scripts/vscripts/ui')
-rw-r--r-- | Northstar.Client/mod/scripts/vscripts/ui/menu_ns_connect_password.nut | 2 | ||||
-rw-r--r-- | Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut | 50 |
2 files changed, 50 insertions, 2 deletions
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_connect_password.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_connect_password.nut index 56db0ccc..b5a2e9b6 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_connect_password.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_connect_password.nut @@ -47,6 +47,8 @@ void function OnConnectWithPasswordMenuOpened() Hud_SetText( file.connectButton, "#MENU_CONNECT_MENU_CONNECT" ) Hud_SetText( file.enterPasswordBox, "" ) Hud_SetText( file.enterPasswordDummy, "" ) + Hud_SetFocused( file.enterPasswordBox ) + } void function ConnectWithPassword( var button ) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut index bd263f2b..6bffe8bb 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut @@ -399,6 +399,8 @@ void function OnCloseServerBrowserMenu() DeregisterButtonPressedCallback(MOUSE_WHEEL_UP , OnScrollUp) DeregisterButtonPressedCallback(MOUSE_WHEEL_DOWN , OnScrollDown) DeregisterButtonPressedCallback(KEY_TAB , OnKeyTabPressed) + DeregisterButtonPressedCallback(KEY_ENTER, OnEnterPressed) + DeregisterButtonPressedCallback(KEY_R, OnKeyRPressed) } catch ( ex ) {} } @@ -425,6 +427,8 @@ void function OnServerBrowserMenuOpened() RegisterButtonPressedCallback(MOUSE_WHEEL_UP , OnScrollUp) RegisterButtonPressedCallback(MOUSE_WHEEL_DOWN , OnScrollDown) RegisterButtonPressedCallback(KEY_TAB , OnKeyTabPressed) + RegisterButtonPressedCallback(KEY_ENTER, OnEnterPressed) + RegisterButtonPressedCallback(KEY_R, OnKeyRPressed) } //////////////////////////// @@ -448,11 +452,9 @@ void function OnKeyTabPressed(var button) { { // toggle focus between server list and filter panel if (IsFilterPanelElementFocused()) { - // print("Switching focus from filter panel to server list") Hud_SetFocused(Hud_GetChild(file.menu, "BtnServer1")) } else { - // print("Switching focus from server list to filter panel") Hud_SetFocused(Hud_GetChild(file.menu, "BtnServerSearch")) HideServerInfo() } @@ -482,6 +484,7 @@ void function OnHitDummyBottom(var button) { // was at bottom already file.scrollOffset = file.serversArrayFiltered.len() - BUTTONS_PER_PAGE Hud_SetFocused(Hud_GetChild(file.menu, "BtnServerSearch")) + HideServerInfo() } else { // only update if list position changed UpdateShownPage() @@ -518,6 +521,46 @@ void function OnUpArrowSelected( var button ) UpdateListSliderPosition( file.serversArrayFiltered.len() ) } +//////////////////////// +// Key Callbacks +//////////////////////// +void function OnEnterPressed(arg) +{ + // only trigger if a server is focused + if (IsServerButtonFocused()) + { + OnServerSelected(0) + } +} + +void function OnKeyRPressed(arg) +{ + if (!IsSearchBarFocused()) + { + RefreshServers(0); + } +} + +bool function IsServerButtonFocused() +{ + var focusedElement = GetFocus(); + var name = Hud_GetHudName(focusedElement); + + foreach (element in GetElementsByClassname( file.menu, "ServerButton")) + { + if ( element == focusedElement ) + return true + } + + + return false; +} + +bool function IsSearchBarFocused() +{ + return Hud_GetChild( file.menu, "BtnServerSearch") == GetFocus() +} + //////////////////////////// // Unused @@ -577,6 +620,7 @@ void function FilterAndUpdateList( var n ) file.scrollOffset = 0 UpdateListSliderPosition( file.serversArrayFiltered.len() ) + HideServerInfo() FilterServerList() @@ -985,6 +1029,8 @@ void function ThreadedAuthAndConnectToServer( string password = "" ) if (file.cancelConnection) { file.cancelConnection = false + // re-focus server list + Hud_SetFocused( Hud_GetChild( file.menu, "BtnServer" + (file.serverButtonFocusedID + 1)) ) return } |