diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-12-30 15:15:01 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-12-30 15:15:01 +0100 |
commit | e08a29e73ea4f7e6d78e8e7f5a6e7033dbc1f542 (patch) | |
tree | 966b95a7cdad16f7658d2e10cec6e549f3b98c17 /ui/login.gd | |
parent | 6e2deea3d1b2fb4d79dac02a0d4310936c7f317c (diff) |
next commit
Diffstat (limited to 'ui/login.gd')
-rw-r--r-- | ui/login.gd | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/ui/login.gd b/ui/login.gd index 3180024..8cabec8 100644 --- a/ui/login.gd +++ b/ui/login.gd @@ -88,23 +88,20 @@ func _on_character_server_login_pressed(character_server_info: CharacterServerIn var character_list: CharacterServerLoginSuccessCharacterListPacket = await Network.character_server.logged_in_character_list - for node in %CharacterList.get_children(): - node.queue_free() - - for slot_idx in character_list.character_information.size(): - var info: CharacterInformation = character_list.character_information[slot_idx] - var character = preload("res://ui/login/character_selection_item.tscn").instantiate() - character.initialize_with_info(info) - character.selected.connect(func(): - current_character_slot_idx = slot_idx - current_character_information = info - %CharacterSelectionStatus.set_info(info) - ) - %CharacterList.add_child(character) + var login_character_list := LoginCharacterList.from_character_list_packet(character_list) + %CharacterSelectionList.login_character_list = login_character_list + %CharacterSelectionList.selected.connect(func(slot_idx: int): + current_character_slot_idx = slot_idx + %CharacterSelectionSlotLabel.text = "%s/%s" % [str(slot_idx + 1), login_character_list.slot_count] - # pre-select first character - if slot_idx == 0: - character.selected.emit() + if slot_idx < character_list.character_information.size(): + current_character_information = character_list.character_information[slot_idx] + else: + current_character_information = null + ) + + # pre-select first character + %CharacterSelectionList.select(0) switch_screen(%CharacterSelection) |