From 911699e9563a8791d72173b46fd8860ce15bb91a Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Thu, 10 Oct 2024 13:16:33 +0200 Subject: intermediate commit --- UI/Lobby.gd | 4 ++-- UI/players_list.gd | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'UI') diff --git a/UI/Lobby.gd b/UI/Lobby.gd index 68d843c..ba76ecc 100644 --- a/UI/Lobby.gd +++ b/UI/Lobby.gd @@ -24,12 +24,12 @@ func get_port(): return port func _on_host_pressed() -> void: - Client.player.name = %Name.text + Client.player.username = %Name.text Network.host_game(get_port()) get_tree().change_scene_to_file("res://Stages/world.tscn") func _on_join_pressed() -> void: - Client.player.name = %Name.text + Client.player.username = %Name.text Network.join_game(get_ip(), get_port()) get_tree().change_scene_to_file("res://Stages/world.tscn") diff --git a/UI/players_list.gd b/UI/players_list.gd index 04bfe6b..6cfd26c 100644 --- a/UI/players_list.gd +++ b/UI/players_list.gd @@ -6,6 +6,7 @@ extends PanelContainer func _ready() -> void: #players_list_container.visible = false + Client.player.score_changed.connect(update_players) Network.players_changed.connect(update_players) update_players() @@ -13,8 +14,8 @@ func _ready() -> void: func update_players(): - for id in Network.players.keys(): - var player: Player = Network.players[id] + for id in Network.get_ordered_player_ids(): + var player: Player = Network.get_player(id) var control: Control = list.get_node_or_null(str(id)) if not control: @@ -24,9 +25,9 @@ func update_players(): control.get_node("%Indicator").visible = id == multiplayer.get_unique_id() list.add_child(control) - control.get_node("%ID").text = str(player.name) + control.get_node("%ID").text = str(player.username) control.get_node("%Score").text = str(player.score) - list.move_child(control, Network.get_ordered_player_ids().find(id) + 1) + #list.move_child(control, Network.get_ordered_player_ids().find(id) + 1) func remove_player(id): -- cgit v1.2.3