From 974134d142e54f650cfa3c8e46e0d58542a39fb1 Mon Sep 17 00:00:00 2001 From: F1F7Y <64418963+F1F7Y@users.noreply.github.com> Date: Sun, 9 Jan 2022 15:45:58 +0100 Subject: Improve server browser backend; fix error (#58) Improves sort backend Fixes crash when TAB is pressed while console is open Improves MouseDelta handler logic Increases doubleclick from 0.2 to 0.3 Fixes issue Pasting does not work for server passwords #91 Fix issue #91 --- .../vscripts/ui/menu_ns_connect_password.nut | 42 +++++++++++++++++----- 1 file changed, 34 insertions(+), 8 deletions(-) (limited to 'Northstar.Client/mod/scripts/vscripts/ui/menu_ns_connect_password.nut') 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 e1ed8991d..56db0cccf 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 @@ -1,5 +1,13 @@ global function AddNorthstarConnectWithPasswordMenu +struct +{ + var menu + var enterPasswordBox + var enterPasswordDummy + var connectButton +} file + void function AddNorthstarConnectWithPasswordMenu() { AddMenu( "ConnectWithPasswordMenu", $"resource/ui/menus/connect_password.menu", InitConnectWithPasswordMenu, "#MENU_CONNECT" ) @@ -7,24 +15,42 @@ void function AddNorthstarConnectWithPasswordMenu() void function InitConnectWithPasswordMenu() { - AddMenuEventHandler( GetMenu( "ConnectWithPasswordMenu" ), eUIEvent.MENU_OPEN, OnConnectWithPasswordMenuOpened ) - AddMenuFooterOption( GetMenu( "ConnectWithPasswordMenu" ), BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) + file.menu = GetMenu( "ConnectWithPasswordMenu" ) + + file.enterPasswordBox = Hud_GetChild( file.menu, "EnterPasswordBox") + file.enterPasswordDummy = Hud_GetChild( file.menu, "EnterPasswordBoxDummy") + file.connectButton = Hud_GetChild( file.menu, "ConnectButton") + + AddMenuEventHandler( file.menu, eUIEvent.MENU_OPEN, OnConnectWithPasswordMenuOpened ) + AddMenuFooterOption( file.menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) + + AddButtonEventHandler( file.connectButton, UIE_CLICK, ConnectWithPassword ) + + AddButtonEventHandler( file.enterPasswordBox, UIE_CHANGE, UpdatePasswordLabel ) - AddButtonEventHandler( Hud_GetChild( GetMenu( "ConnectWithPasswordMenu" ), "ConnectButton" ), UIE_CLICK, ConnectWithPassword ) RegisterButtonPressedCallback( KEY_ENTER, ConnectWithPassword ) } +void function UpdatePasswordLabel( var n ) +{ + string hiddenPSWD + for ( int i = 0; i < Hud_GetUTF8Text( file.enterPasswordBox ).len(); i++) + hiddenPSWD += "*" + Hud_SetText( file.enterPasswordDummy, hiddenPSWD ) +} + void function OnConnectWithPasswordMenuOpened() { UI_SetPresentationType( ePresentationType.KNOWLEDGEBASE_SUB ) - Hud_SetText( Hud_GetChild( GetMenu( "ConnectWithPasswordMenu" ), "Title" ), "#MENU_TITLE_CONNECT_PASSWORD" ) - Hud_SetText( Hud_GetChild( GetMenu( "ConnectWithPasswordMenu" ), "ConnectButton" ), "#MENU_CONNECT_MENU_CONNECT" ) - Hud_SetText( Hud_GetChild( GetMenu( "ConnectWithPasswordMenu" ), "EnterPasswordBox" ), "" ) + Hud_SetText( Hud_GetChild( file.menu, "Title" ), "#MENU_TITLE_CONNECT_PASSWORD" ) + Hud_SetText( file.connectButton, "#MENU_CONNECT_MENU_CONNECT" ) + Hud_SetText( file.enterPasswordBox, "" ) + Hud_SetText( file.enterPasswordDummy, "" ) } void function ConnectWithPassword( var button ) { - if ( GetTopNonDialogMenu() == GetMenu( "ConnectWithPasswordMenu" ) ) - thread ThreadedAuthAndConnectToServer( Hud_GetUTF8Text( Hud_GetChild( GetMenu( "ConnectWithPasswordMenu" ), "EnterPasswordBox" ) ) ) + if ( GetTopNonDialogMenu() == file.menu ) + thread ThreadedAuthAndConnectToServer( Hud_GetUTF8Text( Hud_GetChild( file.menu, "EnterPasswordBox" ) ) ) } \ No newline at end of file -- cgit v1.2.3