Skip to content

Commit 10bc144

Browse files
committed
close menu when joining room
1 parent efce026 commit 10bc144

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Defold/scripts/menu.script

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,24 @@ function on_input(self, action_id, action)
4444

4545
if self.show then
4646
menu('disable')
47-
self.show = false
4847
else
4948
menu('enable')
50-
self.show = true
5149
end
5250

5351
end
5452

5553
if self.show then
5654
if action_id == hash("1") then
5755
msg.post(game_controller, "room_id", {room_id = '1'});
56+
menu('disable')
5857

5958
elseif action_id == hash("2") then
6059
msg.post(game_controller, "room_id", {room_id = '2'});
60+
menu('disable')
6161

6262
elseif action_id == hash("3") then
6363
msg.post(game_controller, "room_id", {room_id = '3'});
64+
menu('disable')
6465

6566
end
6667
end
@@ -74,6 +75,7 @@ function menu(mode)
7475
for k,v in pairs(menu_objects) do
7576
msg.post("#" .. v, mode) --visible = false
7677
end
78+
self.show = mode == 'enable'
7779
end
7880

7981
function on_reload(self)

0 commit comments

Comments
 (0)