39 lines
1.2 KiB
GDScript
39 lines
1.2 KiB
GDScript
extends CanvasLayer
|
|
|
|
# 继续 笔记 设置 返回主菜单 退出游戏
|
|
@onready var continue_btn = %"继续" as Button
|
|
@onready var note_btn = %"笔记" as Button
|
|
@onready var settings_btn = %"设置" as Button
|
|
@onready var main_menu_btn = %"返回主菜单" as Button
|
|
@onready var quit_btn = %"退出游戏" as Button
|
|
|
|
|
|
func _ready() -> void:
|
|
$SfxOpen.play()
|
|
layer = GlobalConfig.CANVAS_LAYER_UX_PANEL
|
|
SceneManager.toggle_pause_counter(true)
|
|
continue_btn.pressed.connect(quit)
|
|
note_btn.pressed.connect(SceneManager.show_note)
|
|
settings_btn.pressed.connect(SceneManager.show_settings)
|
|
main_menu_btn.pressed.connect(SceneManager.checkout_index_page)
|
|
quit_btn.pressed.connect(_quit_game)
|
|
|
|
func _quit_game() -> void:
|
|
# 从 ArchiveManager 处理退出信号
|
|
ArchiveManager.notification(NOTIFICATION_WM_CLOSE_REQUEST)
|
|
# 退出游戏过程隐藏界面
|
|
# 隐藏 panel
|
|
quit()
|
|
|
|
func quit():
|
|
$SfxOpen.global_play()
|
|
SceneManager.toggle_pause_counter(false)
|
|
queue_free()
|
|
|
|
|
|
func _unhandled_input(event: InputEvent) -> void:
|
|
# panel 界面接受所有输入事件
|
|
get_viewport().set_input_as_handled()
|
|
if event.is_action_pressed("cancel") or event.is_action_pressed("escape"):
|
|
quit()
|