diff options
Diffstat (limited to 'UI/GameLobby/game_lobby.gd')
-rw-r--r-- | UI/GameLobby/game_lobby.gd | 29 |
1 files changed, 24 insertions, 5 deletions
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 |