summaryrefslogtreecommitdiff
path: root/UI/GameLobby/lobby_game.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-11-26 17:13:40 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-11-26 17:13:40 +0100
commitcb9bb9d1c757b53707c741a3c8c218b513ffb5ec (patch)
tree1e3741a70672504d71685db98b22f7fe61e0e6cb /UI/GameLobby/lobby_game.gd
parent72863ffa31e27f4c6be862d80472cfb897fccaea (diff)
next commit
Diffstat (limited to 'UI/GameLobby/lobby_game.gd')
-rw-r--r--UI/GameLobby/lobby_game.gd19
1 files changed, 19 insertions, 0 deletions
diff --git a/UI/GameLobby/lobby_game.gd b/UI/GameLobby/lobby_game.gd
new file mode 100644
index 0000000..4736d44
--- /dev/null
+++ b/UI/GameLobby/lobby_game.gd
@@ -0,0 +1,19 @@
+extends HBoxContainer
+
+@export var game_id := ""
+@export var game_name := "":
+ set = set_game_name
+
+
+func set_game_name(value):
+ game_name = value
+ %Name.text = 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")