From 2257bc4a9f2dd477885575d4b23d072ab2809b85 Mon Sep 17 00:00:00 2001 From: no_name_user_7718 Date: Sat, 11 May 2024 11:27:14 +0300 Subject: [PATCH] feat: added filedb --- data/scenes/Player/Player.gd | 4 +++- data/scenes/main_menu/main_menu.gd | 7 ++++++- data/scripts/objects/GateWay.gd | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/data/scenes/Player/Player.gd b/data/scenes/Player/Player.gd index 3ad2287..6cabdfd 100644 --- a/data/scenes/Player/Player.gd +++ b/data/scenes/Player/Player.gd @@ -18,10 +18,12 @@ func _init(): #--------------------------------------------------------------------------------------------------# # RPC Client @rpc("authority", "reliable", "call_remote", 1) -func authorizated(_token, _isAuthorized): +func authorizated(_name, _token, _isAuthorized): if _isAuthorized: if GATEWAY.debug: print("Client token: " + _token) token = _token + playerName = _name + GATEWAY.emit_signal("authorizated") else: GATEWAY.emit_signal("unauthorizated") diff --git a/data/scenes/main_menu/main_menu.gd b/data/scenes/main_menu/main_menu.gd index 79f8e14..c0a05de 100644 --- a/data/scenes/main_menu/main_menu.gd +++ b/data/scenes/main_menu/main_menu.gd @@ -12,6 +12,7 @@ func _ready(): multiplayer.server_disconnected.connect(_on_server_disconnected) multiplayer.connection_failed.connect(_on_connected_fail) GATEWAY.unauthorizated.connect(_on_authorization_fail) + GATEWAY.authorizated.connect(_on_authorization_ok) #--------------------------------------------------------------------------------------------------# @@ -29,7 +30,7 @@ func _on_login_btn_button_down(): if response != Error.OK: InfoText.text = "Error connect to %s on port %s. ERROR: %s" % [GATEWAY.settings.Ip, GATEWAY.settings.Port, error_string(response)] else: - response = GATEWAY.rpc_id(1, 'authorization', LoginInput.text, PasswordInput.text) + response = GATEWAY.rpc_id(1, 'authorization', LoginInput.text, PasswordInput.text.md5_text()) func _on_connected_ok(): @@ -56,3 +57,7 @@ func _on_authorization_fail(): LoginBtn.disabled = false LoginInput.editable = true PasswordInput.editable = true + + +func _on_authorization_ok(): + pass diff --git a/data/scripts/objects/GateWay.gd b/data/scripts/objects/GateWay.gd index 04615f5..0854e2b 100644 --- a/data/scripts/objects/GateWay.gd +++ b/data/scripts/objects/GateWay.gd @@ -13,6 +13,7 @@ var clientId : int # Signals signal unauthorizated +signal authorizated #--------------------------------------------------------------------------------------------------#