summaryrefslogtreecommitdiff
path: root/UI/GameLobby
diff options
context:
space:
mode:
Diffstat (limited to 'UI/GameLobby')
-rw-r--r--UI/GameLobby/game_lobby.gd6
-rw-r--r--UI/GameLobby/lobby_game.gd15
2 files changed, 12 insertions, 9 deletions
diff --git a/UI/GameLobby/game_lobby.gd b/UI/GameLobby/game_lobby.gd
index 9f13882..85a8a91 100644
--- a/UI/GameLobby/game_lobby.gd
+++ b/UI/GameLobby/game_lobby.gd
@@ -16,11 +16,11 @@ func _ready() -> void:
$RefreshTimer.wait_time = refresh_interval
$RefreshTimer.start()
else:
- %ServerNotReachable.text = %ServerNotReachable.text.replace("%SERVER%", Client.game_lobby_url)
+ %ServerNotReachable.text = %ServerNotReachable.text.replace("%SERVER%", GameLobby.server_base_url)
func check_game_lobby_available():
- var is_available = await Client.check_game_lobby_available()
+ var is_available = await GameLobby.check_available()
%ServerNotReachable.visible = !is_available
@@ -28,7 +28,7 @@ func check_game_lobby_available():
func get_server_list():
- var response = await Client.request("%s/?get-list" % [Client.game_lobby_url], [], HTTPClient.METHOD_GET)
+ var response = await GameLobby.request_get("/get-list")
var result = response.parse_json()
print(result)
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)