lots of tutorial fixed
This commit is contained in:
@@ -11,6 +11,8 @@ extends Control
|
||||
process_mode = PROCESS_MODE_INHERIT
|
||||
@export var makes_mouse_visible : bool = true
|
||||
|
||||
signal menu_closing
|
||||
|
||||
var _initial_pause_state : bool = false
|
||||
var _initial_focus_mode : FocusMode = FOCUS_ALL
|
||||
var _initial_mouse_mode : Input.MouseMode
|
||||
@@ -18,6 +20,7 @@ var _initial_focus_control
|
||||
var _scene_tree : SceneTree
|
||||
|
||||
func close() -> void:
|
||||
menu_closing.emit()
|
||||
_scene_tree.paused = _initial_pause_state
|
||||
Input.set_mouse_mode(_initial_mouse_mode)
|
||||
if is_instance_valid(_initial_focus_control) and _initial_focus_control.is_inside_tree():
|
||||
|
||||
@@ -4,6 +4,7 @@ extends Node
|
||||
## Node for opening a pause menu when detecting a 'ui_cancel' event.
|
||||
@export var pause_menu_packed : PackedScene
|
||||
@export var focused_viewport : Viewport
|
||||
@export var player : CharacterBody3D
|
||||
|
||||
@export_group("Inputs")
|
||||
@export var base_mode:GUIDEMappingContext
|
||||
@@ -19,6 +20,9 @@ func on_input_pause():
|
||||
focused_viewport = get_viewport()
|
||||
var _initial_focus_control = focused_viewport.gui_get_focus_owner()
|
||||
var current_menu = pause_menu_packed.instantiate()
|
||||
|
||||
current_menu.menu_closing.connect(player.LoadSettings)
|
||||
|
||||
get_tree().current_scene.call_deferred("add_child", current_menu)
|
||||
await current_menu.tree_exited
|
||||
if is_inside_tree() and _initial_focus_control:
|
||||
|
||||
Reference in New Issue
Block a user