From 7ecde5676ffa61d8bfe5959f9c5b1a2ed3638358 Mon Sep 17 00:00:00 2001 From: Gordon MacPherson Date: Sat, 3 Aug 2024 04:36:41 +0100 Subject: [PATCH] Add virtual keyboard (#230) --- mirror-godot-app/ui/login/login_code_ui.gd | 8 ++++++++ mirror-godot-app/ui/login/login_code_ui.tscn | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mirror-godot-app/ui/login/login_code_ui.gd b/mirror-godot-app/ui/login/login_code_ui.gd index a7c0f85b..5574201d 100644 --- a/mirror-godot-app/ui/login/login_code_ui.gd +++ b/mirror-godot-app/ui/login/login_code_ui.gd @@ -3,6 +3,7 @@ extends Control @onready var login_code = $VBoxContainer/SignInMenu/MarginContainer/LoginContainer/LoginCode func _on_sign_in_pressed() -> void: + DisplayServer.virtual_keyboard_hide() if login_code.text.is_empty(): return var session_promise = Net.mirror_auth_client.check_login_code(login_code.text) @@ -17,6 +18,13 @@ func _on_sign_in_pressed() -> void: print("login code data: ", data) await LoginService.login_as_user_deeplink("", data.refreshToken, data.spaceId, get_tree() ) + +func _gui_input_for_login_code(event: InputEvent): + if event is InputEventMouseButton: + if event.button_index == MOUSE_BUTTON_LEFT and event.pressed: + DisplayServer.virtual_keyboard_show(login_code.text) + + func _ready(): var login_code: bool = ProjectSettings.get_setting("feature_flags/force_enable_login_code", false) if login_code: diff --git a/mirror-godot-app/ui/login/login_code_ui.tscn b/mirror-godot-app/ui/login/login_code_ui.tscn index 1bed9ac7..31955b90 100644 --- a/mirror-godot-app/ui/login/login_code_ui.tscn +++ b/mirror-godot-app/ui/login/login_code_ui.tscn @@ -39,7 +39,6 @@ color = Color(1, 1, 1, 0.2) base_font = ExtResource("11_eftmn") [node name="LoginUIVR" type="Control"] -visible = false layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 @@ -176,4 +175,5 @@ text = "Sign In" [node name="ButtonSound" parent="." instance=ExtResource("19_rxcc2")] [connection signal="pressed" from="VBoxContainer/SignInMenu/MarginContainer/LoginContainer/SignUpHereContainer/SignUpHere" to="." method="_on_sign_up_here_pressed"] +[connection signal="gui_input" from="VBoxContainer/SignInMenu/MarginContainer/LoginContainer/LoginCode" to="." method="_gui_input_for_login_code"] [connection signal="pressed" from="VBoxContainer/SignInMenu/MarginContainer/LoginContainer/SignIn" to="." method="_on_sign_in_pressed"]