2022-12-20 12:16:37 -07:00
|
|
|
extends Control
|
|
|
|
|
|
|
|
var is_paused = false setget set_is_paused
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
visible = false
|
|
|
|
|
|
|
|
func _unhandled_input(event):
|
|
|
|
if event.is_action_pressed("pause"):
|
|
|
|
self.is_paused = !is_paused
|
|
|
|
|
|
|
|
func set_is_paused(value):
|
|
|
|
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
|
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
|
|
|
is_paused = value
|
|
|
|
get_tree().paused = is_paused
|
|
|
|
visible = is_paused
|
|
|
|
if is_paused:
|
|
|
|
$CenterContainer/VBoxContainer/ResumeButton.grab_focus()
|
|
|
|
|
|
|
|
func _on_QuitButton_pressed():
|
|
|
|
get_tree().quit()
|
|
|
|
|
|
|
|
func _on_ResumeButton_pressed():
|
|
|
|
get_tree().paused = false
|
|
|
|
visible = false
|
|
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
|
|
|
|
|
|
|
func _on_MainMenuButton_pressed():
|
|
|
|
get_tree().paused = false
|
2022-12-20 14:50:01 -07:00
|
|
|
var _a = get_tree().change_scene("res://screens/TitleScreen.tscn")
|
2022-12-20 12:16:37 -07:00
|
|
|
|
|
|
|
func _on_ControlsButton_pressed():
|
|
|
|
var dialog = Dialogic.start("controls")
|
|
|
|
add_child(dialog)
|
|
|
|
dialog.connect("tree_exiting", self, "controls_done")
|
|
|
|
|
|
|
|
func controls_done():
|
|
|
|
$CenterContainer/VBoxContainer/ControlsButton.grab_focus()
|