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 #--------------------------------------------------------------------------------------------------#