From 76cadb3d882851f7de1aa4b0aac03ace08d06df2 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 1 Jul 2024 20:02:42 +0200 Subject: re-add menu ui_cancel --- client/menu/game.gd | 1 + client/menu/ingame.gd | 4 ---- client/menu/menu.gd | 13 ++++++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client/menu/game.gd b/client/menu/game.gd index ae44957a..ee8743f4 100644 --- a/client/menu/game.gd +++ b/client/menu/game.gd @@ -5,4 +5,5 @@ func _ready(): func _input(_event): if Input.is_action_just_pressed("pause"): + Sound.play_click() submenu("res://menu/ingame.tscn") diff --git a/client/menu/ingame.gd b/client/menu/ingame.gd index fb108c70..f8d4d144 100644 --- a/client/menu/ingame.gd +++ b/client/menu/ingame.gd @@ -32,7 +32,3 @@ func _on_reconnect_pressed(): func _on_quit_pressed(): quit() - -func _input(event): - if Time.get_ticks_msec() - opened < 100: return # TODO: Prevent close from same action as open - if Input.is_action_just_pressed("pause"): exit() diff --git a/client/menu/menu.gd b/client/menu/menu.gd index 2c539bd9..c0d0fce6 100644 --- a/client/menu/menu.gd +++ b/client/menu/menu.gd @@ -59,7 +59,9 @@ func replace_menu(path: String): print("Replace menu: ", path) if popup != null: await popup.exit() await menu_anim_exit() - get_parent().add_child(load(path).instantiate()) + var new_popup = load(path).instantiate() + get_parent().add_child(new_popup) + if parent_menu != null: parent_menu.popup = new_popup queue_free() var focus_auto_changed := false @@ -86,7 +88,8 @@ func update_parent_menu(node: Node): if node is Menu: parent_menu = node elif node.get_parent() != null: update_parent_menu(node.get_parent()) -#func _input(_event): - #if Input.is_action_just_pressed("ui_cancel"): - #Sound.play_click() - #exit() +func _input(_event): + if popup != null: return + if Input.is_action_just_pressed("ui_cancel"): + Sound.play_click() + exit() -- cgit v1.2.3-70-g09d2