45 lines
1.3 KiB
GDScript
45 lines
1.3 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(_continue)
|
|
note_btn.pressed.connect(SceneManager.show_note)
|
|
settings_btn.pressed.connect(SceneManager.show_settings)
|
|
main_menu_btn.pressed.connect(_index_menu)
|
|
quit_btn.pressed.connect(_quit_game)
|
|
|
|
func _quit_game() -> void:
|
|
# 从 ArchiveManager 处理退出信号
|
|
ArchiveManager.notification(NOTIFICATION_WM_CLOSE_REQUEST)
|
|
# 退出游戏过程隐藏界面
|
|
# 隐藏 panel
|
|
_continue()
|
|
|
|
func _continue():
|
|
$SfxClose.global_play()
|
|
SceneManager.toggle_pause_counter(false)
|
|
queue_free()
|
|
|
|
|
|
func _index_menu():
|
|
SceneManager.checkout_index_page()
|
|
# 允许 ground loader 运行 transition
|
|
_continue()
|
|
|
|
|
|
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"):
|
|
_continue()
|