aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_connect_password.nut
diff options
context:
space:
mode:
Diffstat (limited to 'Northstar.Client/mod/scripts/vscripts/ui/menu_ns_connect_password.nut')
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_ns_connect_password.nut42
1 files changed, 34 insertions, 8 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 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