Multiplayer: Finalized matchmaking system.
This commit is contained in:
parent
09461d8167
commit
390db61bb6
7 changed files with 168 additions and 12 deletions
16
scripts/ui/lobby.gd
Normal file
16
scripts/ui/lobby.gd
Normal file
|
@ -0,0 +1,16 @@
|
|||
extends Control
|
||||
|
||||
var label: PackedScene = preload("res://scenes/ui/elements/name_label.tscn")
|
||||
|
||||
func _ready() -> void:
|
||||
if Networking.playerlist_changed.connect(_on_playerlist_changed) != OK:
|
||||
Log.error("FAILED to connect the playerlist_changed signal to _on_playerlist_changed!", "Internal Error: Failed to connect signal.")
|
||||
_on_playerlist_changed()
|
||||
|
||||
func _on_playerlist_changed() -> void:
|
||||
for child: Label in $NameContainer.get_children():
|
||||
child.free()
|
||||
for peer: String in Networking.peers:
|
||||
var instance: Label = label.instantiate()
|
||||
instance.text = peer
|
||||
$NameContainer.add_child(instance)
|
Loading…
Add table
Add a link
Reference in a new issue