diff options
Diffstat (limited to 'login.gd')
-rw-r--r-- | login.gd | 48 |
1 files changed, 27 insertions, 21 deletions
@@ -9,12 +9,9 @@ var current_character_information: CharacterInformation func _ready() -> void: switch_screen(%Login) - #$BackgroundMusic.play() + $BackgroundMusic.play() - # TODO: check why TextureRect doesn't work - #get_tree().root.size_changed.connect(func(): - #$Background.scale = get_viewport_rect().size / $Background.get_rect().size - #) + %ChatWindow.visible = false func switch_screen(screen: Node): @@ -92,25 +89,34 @@ func _on_character_selected_pressed(slot_idx: int): Network.character_server.select_character(slot_idx) var selected_character = await Network.character_server.selected_character - if selected_character is CharacterSelectionSuccessPacket: - Network.map_server = MapServer.new( - selected_character.get_map_server_ip(), - selected_character.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 - - Client.character.name = current_character_information.name + + if selected_character is CharacterSelectionFailedPacket: + # TODO: show error + return + + Client.character.name = current_character_information.name + + Network.map_server = MapServer.new( + selected_character.get_map_server_ip(), + selected_character.map_server_port + ) + + Network.map_server.login( + account_information.account_id, + current_character_information.character_id, + account_information.login_id1, + account_information.gender + ) + var _logged_in = await Network.map_server.logged_in # TODO: switch to game :) - # TODO: check next packages to sent to server, most probably to map server + + %ChatWindow.visible = true Network.map_server.received_packet.connect(func(packet: Packet): if packet is ServerMessagePacket: %ChatWindow.add_message(packet.message) ) + + # TODO: load map + var map_loaded_packet := MapLoadedPacket.new() + Network.map_server.send(map_loaded_packet) |