1
Fork 0
mirror of https://github.com/Steffo99/nanogolf.git synced 2024-11-22 08:04:21 +00:00
algodist-steffo-nanogolf/scenes/players_list.gd

30 lines
994 B
GDScript3
Raw Normal View History

2024-02-28 05:30:45 +00:00
extends PanelContainer
class_name PlayersList
@onready var layout = $"Scrollable/Layout"
2024-03-10 04:51:36 +00:00
const label_scene: PackedScene = preload("res://scenes/player_label.tscn")
2024-02-28 05:30:45 +00:00
2024-03-10 04:51:36 +00:00
var labels_by_playernode: Dictionary = {}
func _on_playernode_created(playernode: PlayerNode) -> void:
var label_instance = label_scene.instantiate()
labels_by_playernode[playernode] = label_instance
layout.add_child(label_instance)
func _on_playernode_destroyed(playernode: PlayerNode) -> void:
labels_by_playernode[playernode].queue_free()
labels_by_playernode.erase(playernode)
func _on_playernode_name_changed(_old: String, new: String, playernode: PlayerNode) -> void:
labels_by_playernode[playernode].set_player_name(new)
func _on_playernode_color_changed(_old: Color, new: Color, playernode: PlayerNode) -> void:
labels_by_playernode[playernode].set_player_color(new)
func _on_playernode_possessed(_old: int, new: int, playernode: PlayerNode) -> void:
labels_by_playernode[playernode].set_possessed(new)
2024-02-28 05:30:45 +00:00