diff options
Diffstat (limited to 'client/menu/menu.gd')
-rw-r--r-- | client/menu/menu.gd | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/client/menu/menu.gd b/client/menu/menu.gd index 6dd48fca..30a9ca7d 100644 --- a/client/menu/menu.gd +++ b/client/menu/menu.gd @@ -38,31 +38,34 @@ func _ready(): connect_button_sounds(self) update_parent_menu(self.get_parent()) if support_anim: anim_setup() - if auto_anim: menu_anim_open() + if auto_anim: _menu_open() func anim_setup(): transition = transition_scene.instantiate() add_child(transition) -func menu_anim_open(): +func _menu_open(): if transition != null: await transition.fade_in() -func menu_anim_exit(): +func _menu_exit(): if transition != null: await transition.fade_out() -func menu_anim_cover(_state: bool): +func _menu_cover(_state: bool): pass var popup: Menu = null +var covered := false func submenu(path: String, data_ = null): var prev_focus = Global.focused_node if popup != null: return _disable_recursive(self, true) - await menu_anim_cover(true) + covered = true + await _menu_cover(true) popup = load(path).instantiate() popup.data = data_ add_child(popup) print("Submenu opened ", path) await submenu_close print("Submenu closed ", path) - await menu_anim_cover(false) + await _menu_cover(false) + covered = false _disable_recursive(self, false) if prev_focus != null: prev_focus.grab_focus() @@ -74,7 +77,7 @@ func _disable_recursive(node: Node, state: bool): for c in node.get_children(): _disable_recursive(c, state) func exit(): - await self.menu_anim_exit() + await self._menu_exit() get_parent().submenu_close.emit() queue_free() @@ -86,7 +89,7 @@ func replace_menu(path: String): print("Replace menu: ", path) if popup != null: await popup.exit() _disable_recursive(self, true) - await menu_anim_exit() + await _menu_exit() var new_popup = load(path).instantiate() get_parent().add_child(new_popup) if parent_menu != null: parent_menu.popup = new_popup |