xiandie/scene/index/启动入口.gd

34 lines
937 B
GDScript3
Raw Normal View History

extends VBoxContainer
func _ready() -> void:
if not GlobalConfig.DEBUG:
queue_free()
return
2025-07-10 19:16:22 +00:00
$DebugMode.pressed.connect(_exit_debug_mode)
$Chapter1.pressed.connect(_start_game.bind(1))
2025-07-10 19:16:22 +00:00
$Chapter2.pressed.connect(_start_game.bind(2))
$Chapter3.pressed.connect(_start_game.bind(3))
func _exit_debug_mode() -> void:
GlobalConfig.DEBUG = false
print_rich("[color=orange]Debug mode disabled[/color]")
queue_free()
func _start_game(chapter: int) -> void:
$"../SfxClick".global_play()
2025-07-10 19:16:22 +00:00
var archive_res: AssembledArchive
if chapter == 1:
archive_res = load("uid://x2yr8b2ul5al")
elif chapter == 2:
archive_res = load("uid://b45y2iffjdieg")
archive_res = archive_res.duplicate(true)
ArchiveManager.create_and_use_new_archive(1)
archive_res.take_over_path(ArchiveManager.archive.resource_path)
ArchiveManager.archive = archive_res
# new game 时音量渐隐
$"../BgmControl".stop(0.5)
SceneManager.enter_main_scene()