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/menu.gd | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'client/menu/menu.gd') 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