From ca4d1945598863d0ce297f4272317e5dd5797f88 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Fri, 13 Dec 2024 14:53:38 +0100 Subject: next commit --- login.gd | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) (limited to 'login.gd') diff --git a/login.gd b/login.gd index 231756f..1b7ccb7 100644 --- a/login.gd +++ b/login.gd @@ -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) -- cgit v1.2.3