From 5b35174ffab42f0331f1a6527ef6bbab7a3dbdcb Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sat, 21 Dec 2024 14:15:11 +0100 Subject: next commit --- UI/GameLobby/game_lobby.gd | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'UI/GameLobby/game_lobby.gd') diff --git a/UI/GameLobby/game_lobby.gd b/UI/GameLobby/game_lobby.gd index 85a8a91..f80015b 100644 --- a/UI/GameLobby/game_lobby.gd +++ b/UI/GameLobby/game_lobby.gd @@ -11,6 +11,8 @@ var refresh_interval := 15.0 func _ready() -> void: %GamesList.get_child(0).queue_free() + %ServerUrl.text = GameLobby.server_base_url + if await check_game_lobby_available(): get_server_list() $RefreshTimer.wait_time = refresh_interval @@ -36,11 +38,16 @@ func get_server_list(): for node in %GamesList.get_children(): node.queue_free() - for game in result["data"]: - var lobby_game = lobby_game_scene.instantiate() - lobby_game.game_id = game["id"] - lobby_game.game_name = game["name"] - %GamesList.add_child(lobby_game) + if result["data"].size() > 0: + %NoGamesFound.visible = false + + for game in result["data"]: + var lobby_game = lobby_game_scene.instantiate() + lobby_game.game_id = game["id"] + lobby_game.game_name = game["name"] + %GamesList.add_child(lobby_game) + else: + %NoGamesFound.visible = true func _on_back_button_pressed() -> void: @@ -55,3 +62,15 @@ func _on_refresh_pressed() -> void: func _on_refresh_timer_timeout() -> void: get_server_list() + + +func _on_set_server_pressed() -> void: + var config = Client.get_config() + config.set_value( + "general", + "game_lobby_server_base_url", + %ServerUrl.text + ) + config.save("user://config") + + GameLobby.server_base_url = %ServerUrl.text -- cgit v1.2.3