Lots of little tweaks and fixes
This commit is contained in:
+16
-11
@@ -1,5 +1,8 @@
|
||||
class_name PauseMenu extends Control
|
||||
|
||||
signal opened
|
||||
signal closed
|
||||
|
||||
@export var MAIN:PauseMain
|
||||
@export var settingsPanel:PauseSettings
|
||||
|
||||
@@ -7,8 +10,7 @@ func _ready() -> void:
|
||||
close()
|
||||
MAIN.resumeRequested.connect(close)
|
||||
MAIN.settingsRequested.connect(_openSettings)
|
||||
MAIN.mainMenuRequested.connect(_goToMainMenu)
|
||||
MAIN.quitRequested.connect(func(): get_tree().quit())
|
||||
UI.MAIN_MENU_DIALOG.confirmed.connect(_goToMainMenu)
|
||||
|
||||
func isOpen() -> bool:
|
||||
return visible
|
||||
@@ -17,12 +19,14 @@ func open() -> void:
|
||||
visible = true
|
||||
get_tree().paused = true
|
||||
MAIN.open()
|
||||
opened.emit()
|
||||
|
||||
func close() -> void:
|
||||
get_tree().paused = false
|
||||
visible = false
|
||||
MAIN.close()
|
||||
settingsPanel.close()
|
||||
closed.emit()
|
||||
|
||||
func _openSettings() -> void:
|
||||
MAIN.close()
|
||||
@@ -35,12 +39,13 @@ func _goToMainMenu() -> void:
|
||||
func _unhandled_input(event:InputEvent) -> void:
|
||||
if !visible:
|
||||
return
|
||||
if event.is_action_pressed("ui_cancel"):
|
||||
if MAIN.isConfirming():
|
||||
MAIN.cancelConfirm()
|
||||
elif settingsPanel.isOpen():
|
||||
settingsPanel.close()
|
||||
MAIN.open()
|
||||
else:
|
||||
close()
|
||||
get_viewport().set_input_as_handled()
|
||||
if !event.is_action_pressed("ui_cancel"):
|
||||
return
|
||||
if (UI.QUIT_DIALOG != null and UI.QUIT_DIALOG.isOpen) or (UI.MAIN_MENU_DIALOG != null and UI.MAIN_MENU_DIALOG.isOpen):
|
||||
return
|
||||
if settingsPanel.isOpen():
|
||||
settingsPanel.close()
|
||||
MAIN.open()
|
||||
else:
|
||||
close()
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
Reference in New Issue
Block a user