diff options
author | nokoe <nokoe@mailbox.org> | 2024-07-08 18:47:11 +0200 |
---|---|---|
committer | nokoe <nokoe@mailbox.org> | 2024-07-08 18:47:11 +0200 |
commit | fbf9286b3b4c7791a49d8546204ea5bf28e1b4db (patch) | |
tree | 06a1737240499d4dc0db80b9c778e47f93d81b3c /client/menu/lobby.gd | |
parent | f4a5f9bf0b61a8884fe24aa3b7c3a00da815b78d (diff) | |
download | hurrycurry-fbf9286b3b4c7791a49d8546204ea5bf28e1b4db.tar hurrycurry-fbf9286b3b4c7791a49d8546204ea5bf28e1b4db.tar.bz2 hurrycurry-fbf9286b3b4c7791a49d8546204ea5bf28e1b4db.tar.zst |
add join/leave button to ingame menu
Diffstat (limited to 'client/menu/lobby.gd')
-rw-r--r-- | client/menu/lobby.gd | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/client/menu/lobby.gd b/client/menu/lobby.gd index 6e315a19..a31b38e9 100644 --- a/client/menu/lobby.gd +++ b/client/menu/lobby.gd @@ -20,8 +20,6 @@ const PLAYER = preload("res://menu/lobby/player.tscn") var selected_map := 0 var selected_map_name: String -var joined := false -var join_sent := false @onready var game: Game = $"../Game" @onready var map_count = game.map_names.size() @@ -38,6 +36,7 @@ func _ready(): initialize() game.data_updated.connect(initialize) game.joined.connect(_on_game_joined) + game.left.connect(_on_game_left) func initialize(): map_count = game.map_names.size() @@ -60,7 +59,7 @@ func update_players(player_list: Dictionary): player_container.add_child(p) p.setup(player_list[i].username) -func _input(event): +func _input(_event): if not visible: return @@ -73,7 +72,10 @@ func _on_game_joined(): map_selector.show() start_button.text = tr("Start Game") start_button.disabled = false - joined = true + +func _on_game_left(): + map_selector.hide() + start_button.text = tr("Join Game") func _on_left_pressed(): selected_map = (selected_map - 1) % map_count @@ -84,10 +86,9 @@ func _on_right_pressed(): select_map(selected_map) func _on_controller_button_pressed(): - if joined: + if game.is_joined: if selected_map_name != null: game.mp.send_chat("/start %s" % selected_map_name) - elif not join_sent: - join_sent = true + elif not game.join_sent: start_button.disabled = true game.join() |