diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-10-10 13:16:33 +0200 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-10-10 13:16:33 +0200 |
commit | 911699e9563a8791d72173b46fd8860ce15bb91a (patch) | |
tree | 0f62aa539c5662a9cf3a432e83e571631fd3f586 /UI | |
parent | 1aac583cee47d232ef22d8c5df97b888f689ab96 (diff) |
intermediate commit
Diffstat (limited to 'UI')
-rw-r--r-- | UI/Lobby.gd | 4 | ||||
-rw-r--r-- | UI/players_list.gd | 9 |
2 files changed, 7 insertions, 6 deletions
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): |