44 lines
1.0 KiB
GDScript
44 lines
1.0 KiB
GDScript
extends CanvasLayer
|
|
|
|
@onready var quit_debug_button: Button = %QuitDebugModeButton
|
|
|
|
|
|
func _ready() -> void:
|
|
AudioManager.process_mode = Node.PROCESS_MODE_PAUSABLE
|
|
SceneManager.toggle_pause_counter(true, "debugging")
|
|
layer = GlobalConfig.CANVAS_LAYER_SETTINGS
|
|
quit_debug_button.pressed.connect(_on_quit_debug_button_pressed)
|
|
|
|
# 恢复上次打开的 tab
|
|
var tab = ArchiveManager.get_global_value(&"debug_panel_tab", 0)
|
|
%TabContainer.current_tab = tab
|
|
|
|
|
|
func _input(event: InputEvent) -> void:
|
|
if (
|
|
event.is_action_pressed("debugging")
|
|
or event.is_action_pressed("cancel")
|
|
or event.is_action_pressed("escape")
|
|
):
|
|
get_viewport().set_input_as_handled()
|
|
quit()
|
|
|
|
|
|
func _on_quit_debug_button_pressed() -> void:
|
|
# 不写入配置
|
|
GlobalConfig.DEBUG = false
|
|
quit()
|
|
|
|
|
|
func _exit_tree() -> void:
|
|
AudioManager.process_mode = Node.PROCESS_MODE_ALWAYS
|
|
SceneManager.toggle_pause_counter(false, "debugging")
|
|
|
|
|
|
func quit() -> void:
|
|
queue_free()
|
|
|
|
|
|
func _on_tab_container_tab_changed(tab: int) -> void:
|
|
ArchiveManager.set_global_entry(&"debug_panel_tab", tab)
|