From a854a1862a30632e49520f6e1e11333d5c8ff241 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Wed, 27 Nov 2024 14:36:20 +0100 Subject: next commit --- UI/Start.gd | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'UI/Start.gd') diff --git a/UI/Start.gd b/UI/Start.gd index b078d65..85a7946 100644 --- a/UI/Start.gd +++ b/UI/Start.gd @@ -22,7 +22,7 @@ func get_ip() -> String: func get_port() -> int: - var port := 1234 + var port: int = Client.get_config().get_value("general", "host_default_port") if %Port.text: port = int(%Port.text) @@ -38,17 +38,12 @@ func _on_peer_disconnected(id): func _on_host_pressed() -> void: Client.player.username = %Username.text - var response = await Client.request( - "%s" % [Client.game_lobby_url], - [], - HTTPClient.METHOD_POST, - JSON.stringify({"host": true, "port": get_port(), "name" : %GameName.text}) - ) - + var response = await GameLobby.request_post("/host", {"port": get_port(), "name" : %GameName.text}) if response.result_code == HTTPRequest.RESULT_SUCCESS: var result = response.parse_json() if result["success"]: - Client.current_game_id = result["data"] + GameLobby.current_game_id = result["data"]["id"] + GameLobby.current_secret = result["data"]["secret"] Network.host_game(get_port()) get_tree().change_scene_to_file("res://UI/PlayerLobby/Lobby.tscn") -- cgit v1.2.3