diff options
Diffstat (limited to 'client/menu')
-rw-r--r-- | client/menu/main.gd | 2 | ||||
-rw-r--r-- | client/menu/play.gd | 28 | ||||
-rw-r--r-- | client/menu/rating/rating.tscn | 2 |
3 files changed, 19 insertions, 13 deletions
diff --git a/client/menu/main.gd b/client/menu/main.gd index 997653c9..5aa3fbaa 100644 --- a/client/menu/main.gd +++ b/client/menu/main.gd @@ -24,7 +24,7 @@ func _ready(): if OS.has_feature("web"): quit_button.hide() Sound.play_music("MainMenu") - ServerList.fetch_server_list() + ServerList.one_shot() func _menu_cover(state): $side.visible = not state 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() diff --git a/client/menu/rating/rating.tscn b/client/menu/rating/rating.tscn index b12d1470..69edba88 100644 --- a/client/menu/rating/rating.tscn +++ b/client/menu/rating/rating.tscn @@ -120,7 +120,7 @@ alignment = 1 [node name="Close" type="Button" parent="MarginContainer/PanelContainer/VBoxContainer/HBoxContainer"] layout_mode = 2 -text = "Accept" +text = "c.menu.rating.accept" [node name="StarTimer" type="Timer" parent="."] wait_time = 0.5 |