diff options
Diffstat (limited to 'UI/GameLobby/lobby_game.gd')
-rw-r--r-- | UI/GameLobby/lobby_game.gd | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/UI/GameLobby/lobby_game.gd b/UI/GameLobby/lobby_game.gd index 4736d44..2433dfd 100644 --- a/UI/GameLobby/lobby_game.gd +++ b/UI/GameLobby/lobby_game.gd @@ -11,9 +11,12 @@ func set_game_name(value): func _on_join_pressed() -> void: - var response = await Network.request("%s/?join=%s" % [Client.game_lobby_url, game_id]) - var result = response.parse_json() - var game_data = result["data"] - - Network.join_game(game_data["ip"], game_data["port"]) - get_tree().change_scene_to_file("res://UI/PlayerLobby/Lobby.tscn") + var response = await GameLobby.request_get("/join?id=%s" % [game_id]) + if response.response_code == 200: + var result = response.parse_json() + var game_data = result["data"] + + Network.join_game(game_data["ip"], game_data["port"]) + get_tree().change_scene_to_file("res://UI/PlayerLobby/Lobby.tscn") + else: + print(response.response_code) |