extends HBoxContainer class_name LobbyControl export(String) var uuid = "Some UUID" export(String) var display_name = "Lobby" setget set_display_name export(int) var max_players = 20 setget set_max_players export(int) var current_players = 1 setget set_current_players export(bool) var locked = false func _ready(): _update_text() func _update_text(): $Label.text = "%s (%d/%d players)" % [display_name, current_players, max_players] const keys = ["uuid", "display_name", "max_players", "current_players", "locked"] func set_with_dict(dict): if dict.has("name"): self.display_name = dict["name"] if dict.has("currentPlayers"): self.current_players = dict["currentPlayers"] if dict.has("maxPlayers"): self.max_players = dict["maxPlayers"] for k in keys: if dict.has(k): self[k] = dict[k] func set_display_name(t): display_name = t _update_text() func set_max_players(n): max_players = n _update_text() func set_current_players(n): current_players = n _update_text() func _on_join_pressed(): Global.client.join_lobby(uuid)