From 35b0f811f23f029110373798b19d9d0895d907f0 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 5 Jan 2025 16:54:36 +0100 Subject: next commit --- ui/login.gd | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'ui/login.gd') diff --git a/ui/login.gd b/ui/login.gd index 8cabec8..fb3c80b 100644 --- a/ui/login.gd +++ b/ui/login.gd @@ -15,8 +15,6 @@ var current_character_information: CharacterInformation func _ready() -> void: switch_screen(%Login) #$BackgroundMusic.play() - - %ChatWindow.visible = false func switch_screen(screen: Node): @@ -94,11 +92,15 @@ func _on_character_server_login_pressed(character_server_info: CharacterServerIn current_character_slot_idx = slot_idx %CharacterSelectionSlotLabel.text = "%s/%s" % [str(slot_idx + 1), login_character_list.slot_count] - if slot_idx < character_list.character_information.size(): - current_character_information = character_list.character_information[slot_idx] + var info = login_character_list.get_info_for_slot(slot_idx) + if info: + current_character_information = info else: current_character_information = null ) + %CharacterSelectionList.requested_login.connect(func(slot_idx: int): + _on_character_selected_pressed(slot_idx) + ) # pre-select first character %CharacterSelectionList.select(0) @@ -117,6 +119,7 @@ func _on_character_selected_pressed(slot_idx: int): return Client.character.name = current_character_information.name + Client.character.info = current_character_information Network.map_server = MapServer.new( selected_character.get_map_server_ip(), @@ -131,16 +134,9 @@ func _on_character_selected_pressed(slot_idx: int): ) var _logged_in = await Network.map_server.logged_in - # TODO: switch to game :) - - %ChatWindow.visible = true - %ChatWindow.initialize() - - # TODO: load map - var map_loaded_packet := MapLoadedPacket.new() - Network.map_server.send(map_loaded_packet) - - # TODO: check which map server packets to send next + get_tree().change_scene_to_file( + "res://client_data/data/%s.tscn" % current_character_information.get_map_name() + ) func _on_character_server_back_button_pressed() -> void: -- cgit v1.2.3