diff options
Diffstat (limited to 'client/menu')
-rw-r--r-- | client/menu/book/book.gd | 4 | ||||
-rw-r--r-- | client/menu/game.gd | 4 | ||||
-rw-r--r-- | client/menu/ingame.gd | 6 | ||||
-rw-r--r-- | client/menu/main.gd | 2 | ||||
-rw-r--r-- | client/menu/menu.gd | 19 |
5 files changed, 20 insertions, 15 deletions
diff --git a/client/menu/book/book.gd b/client/menu/book/book.gd index 43df3ebe..ab244fcb 100644 --- a/client/menu/book/book.gd +++ b/client/menu/book/book.gd @@ -25,5 +25,5 @@ func _ready(): texture.custom_minimum_size = get_viewport_rect().size $ScrollContainer/VBoxContainer.add_child(texture) -func menu_anim_open(): pass -func menu_anim_exit(): pass +func _menu_open(): pass +func _menu_exit(): pass diff --git a/client/menu/game.gd b/client/menu/game.gd index bef4a5df..16e1dfa9 100644 --- a/client/menu/game.gd +++ b/client/menu/game.gd @@ -15,6 +15,7 @@ # along with this program. If not, see <https://www.gnu.org/licenses/>. # extends Menu +class_name GameMenu @onready var game: Game = $Game @onready var debug_label: RichTextLabel = $Debug @@ -30,6 +31,9 @@ func _input(_event): if Input.is_action_just_pressed("ui_menu"): open_ingame_menu() +func _menu_cover(state): + game.camera.disable_input = state + func _process(_delta): if Global.get_setting("debug_info"): debug_label.show() diff --git a/client/menu/ingame.gd b/client/menu/ingame.gd index 9ca80f2c..4e8eac0c 100644 --- a/client/menu/ingame.gd +++ b/client/menu/ingame.gd @@ -33,14 +33,12 @@ func _ready(): super() func anim_setup(): pass -func menu_anim_open(): +func _menu_open(): print("ingame open") - game.player_set_input_enabled.emit(false) anim.play("activate") await anim.animation_finished -func menu_anim_exit(): +func _menu_exit(): print("ingame exit") - game.player_set_input_enabled.emit(true) anim.play_backwards("activate") await anim.animation_finished diff --git a/client/menu/main.gd b/client/menu/main.gd index e2c89798..ac1c66bc 100644 --- a/client/menu/main.gd +++ b/client/menu/main.gd @@ -32,7 +32,7 @@ func _ready(): server.hide() connect_uri.text = Global.get_profile("last_server_url") -func menu_anim_cover(covered): +func _menu_cover(covered): $side.visible = not covered func _on_quit_pressed(): 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 |