diff options
Diffstat (limited to 'client/menu/play.gd')
-rw-r--r-- | client/menu/play.gd | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/client/menu/play.gd b/client/menu/play.gd index b117d6a4..44cd3eb0 100644 --- a/client/menu/play.gd +++ b/client/menu/play.gd @@ -37,21 +37,23 @@ func _ready(): ServerList.update_loading.connect(update_server_list_loading) update_server_list(ServerList.current_list) update_server_list_loading(ServerList.loading) - + + ServerList.start() super() -func update_server_list(json: Array): +func update_server_list(lists: Array[Array]): for c in server_list.get_children(): c.queue_free() - for i in json: - var b := Button.new() - b.text_overrun_behavior = TextServer.OVERRUN_TRIM_WORD_ELLIPSIS - b.text = "%s (%d players)" % [i.name, i.players_online] - # TODO: Implement fallback address correctly - if i.version[0] != Multiplayer.VERSION_MAJOR or i.version[1] > Multiplayer.VERSION_MINOR: - b.disabled = true - b.pressed.connect(connect_to.bind(i.address[0])) - server_list.add_child(b) + for l in lists: + for i in l: + var b := Button.new() + b.text_overrun_behavior = TextServer.OVERRUN_TRIM_WORD_ELLIPSIS + b.text = "%s (%d players)" % [i.name, i.players_online] + # TODO: Implement fallback address correctly + if i.version[0] != Multiplayer.VERSION_MAJOR or i.version[1] > Multiplayer.VERSION_MINOR: + b.disabled = true + b.pressed.connect(connect_to.bind(i.address[0])) + server_list.add_child(b) func update_server_list_loading(status: bool): server_list_loading.visible = status @@ -127,3 +129,7 @@ func _on_uri_text_changed(new_text): func _on_back_pressed(): exit() + +func _menu_exit(): + ServerList.stop() + super() |