From 313afffce7a823c30acf4853b083f9ca5132e879 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Fri, 29 Nov 2024 21:54:32 +0100 Subject: next commit --- login.gd | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'login.gd') diff --git a/login.gd b/login.gd index 97daf51..3e69981 100644 --- a/login.gd +++ b/login.gd @@ -19,7 +19,9 @@ func switch_screen(screen: Node): func _on_login_pressed() -> void: - account_information = Network.login_server.login(%Username.text, %Password.text) + Network.login_server.login(%Username.text, %Password.text) + + account_information = await Network.login_server.logged_in character_server_information = account_information.character_server_information for node in %CharacterServerList.get_children(): @@ -28,9 +30,7 @@ func _on_login_pressed() -> void: for info: CharacterServerInformation in character_server_information: var select_character_server = Button.new() select_character_server.text = info.server_name - select_character_server.pressed.connect(func(): - _on_character_server_login_pressed(info) - ) + select_character_server.pressed.connect(_on_character_server_login_pressed.bind(info)) %CharacterServerList.add_child(select_character_server) switch_screen(%CharacterServer) @@ -42,15 +42,16 @@ func _on_character_server_login_pressed(character_server_info: CharacterServerIn character_server_info.server_port ) - var _response = Network.character_server.login( + Network.character_server.login( account_information.account_id, account_information.login_id1, account_information.login_id2, account_information.gender ) - print(inst_to_dict(_response)) + var _response = await Network.character_server.logged_in - var response = Network.character_server.request_character_list() + Network.character_server.request_character_list() + var response: RequestCharacterListSuccessPacket = await Network.character_server.requested_character_list for slot_idx in response.character_information.size(): var info: CharacterInformation = response.character_information[slot_idx] @@ -66,18 +67,21 @@ func _on_character_server_login_pressed(character_server_info: CharacterServerIn func _on_character_selected_pressed(slot_idx: int): - var success = Network.character_server.select_character(slot_idx) + Network.character_server.select_character(slot_idx) - Network.map_server = MapServer.new( - success.get_map_server_ip(), - success.map_server_port - ) - - var _response = Network.map_server.login( - account_information.account_id, - current_character_information.character_id, - account_information.login_id1, - account_information.gender - ) + var packet = await Network.character_server.selected_character + if packet is CharacterSelectionSuccessPacket: + Network.map_server = MapServer.new( + packet.get_map_server_ip(), + packet.map_server_port + ) + + Network.map_server.login( + account_information.account_id, + current_character_information.character_id, + account_information.login_id1, + account_information.gender + ) + var _response = await Network.map_server.logged_in # TODO: switch to game :) -- cgit v1.2.3