diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-11-29 21:54:32 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-11-29 21:54:32 +0100 |
commit | 313afffce7a823c30acf4853b083f9ca5132e879 (patch) | |
tree | 5a7370392ebd39314612166b35e6f53e67441c0b /login.gd | |
parent | e8aa9f50886b66d525307a58d71036e6fd3d4aa1 (diff) |
next commit
Diffstat (limited to 'login.gd')
-rw-r--r-- | login.gd | 42 |
1 files changed, 23 insertions, 19 deletions
@@ -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 :) |