xiandie/manager/scene/global_functor.gd

133 lines
4.3 KiB
GDScript3
Raw Normal View History

extends Node
2025-06-24 17:52:30 +00:00
var dialogue_c02 = preload("res://asset/dialogue/c02.dialogue")
func _ready() -> void:
process_mode = Node.PROCESS_MODE_PAUSABLE
# called from dialogue
# 传送进入隧道
func transfer_to_tunnel():
2025-07-04 16:14:08 +00:00
ArchiveManager.set_global_entry("c02_entered_the_splitted_space", true)
SceneManager.get_ground_loader().transition_to_scene("c02_s09", "right")
# called from Amush2D's global_method
# c02 盒子猫游戏,小猫交互门
var knocking = false
func c02_cat_play_with_door():
if knocking:
return
knocking = true
2025-06-20 17:51:36 +00:00
var knock_stream = preload("uid://6q5qi1qon35r")
AudioManager.play_sfx(knock_stream)
2025-06-28 01:14:15 +00:00
SceneManager.lock_player(1.5, 6, true)
2025-06-30 10:33:40 +00:00
await Util.wait(1.5)
knocking = false
var c02_fire_count_down_timer: Timer
2025-06-24 17:52:30 +00:00
# TODO 音效
# res://asset/audio/BGM/心跳背景音.ogg
2025-06-24 17:52:30 +00:00
var c02_fire_count_down_sfx = preload("uid://b3g7ubpcldrhe")
# 尝试燃烧倒计时(每次回到 s03 院子都会尝试一次)
func c02_fire_count_down_try_start():
if c02_fire_count_down_timer:
return
c02_fire_count_down_timer = Timer.new()
c02_fire_count_down_timer.autostart = true
if GlobalConfig.DEBUG:
2025-06-25 23:55:47 +00:00
SceneManager.pop_debug_dialog_info("debug", "当前为测试模式,倒计时 15s正式模式倒计时 60s")
c02_fire_count_down_timer.wait_time = 15
else:
c02_fire_count_down_timer.wait_time = 60
c02_fire_count_down_timer.one_shot = false
c02_fire_count_down_timer.timeout.connect(_on_c02_fire_count_down_timeout)
add_child(c02_fire_count_down_timer)
SceneManager.pop_debug_dialog_info("音效", "霸凌救小蝉倒计时")
2025-06-25 23:55:47 +00:00
AudioManager.loop_bgm_music("霸凌救小蝉倒计时", c02_fire_count_down_sfx, 5)
func _on_c02_fire_count_down_timeout():
2025-06-30 17:16:42 +00:00
SceneManager.lock_player()
SceneManager.pop_debug_dialog_info("音效", "【重开】霸凌救小蝉倒计时")
c02_fire_count_down_timer.stop()
AudioManager.stop_bgm_music("霸凌救小蝉倒计时")
DialogueManager.show_dialogue_balloon(
dialogue_c02, "c02_未完成拯救小蝉的游戏", [GlobalConfig.DIALOG_IGNORE_INPUT]
)
2025-06-30 10:33:40 +00:00
await Util.wait(1.0)
2025-06-23 09:01:43 +00:00
SceneManager.show_black_hand(true, 0.5)
2025-06-30 10:33:40 +00:00
await Util.wait(3)
SceneManager.unlock_player()
SceneManager.get_ground_loader().transition_to_scene("c02_s03", "4")
# TODO 音效
# res://asset/audio/BGM/心跳背景音.ogg
2025-06-30 10:33:40 +00:00
await Util.wait(3)
SceneManager.pop_debug_dialog_info("音效", "霸凌救小蝉倒计时")
2025-06-25 23:55:47 +00:00
AudioManager.loop_bgm_music("霸凌救小蝉倒计时", c02_fire_count_down_sfx, 5)
c02_fire_count_down_timer.start()
func c02_fire_count_down_stop():
if c02_fire_count_down_timer:
c02_fire_count_down_timer.stop()
2025-06-24 17:52:30 +00:00
# 停止音效
AudioManager.stop_bgm_music("霸凌救小蝉倒计时")
# 获得三张纸钱,在理发店癞子纸人身上获得两张,药车李氏纸人一张
func c03_get_paper_coin(_node = null) -> bool:
var stage = EventManager.next_stage("c03_paper_coin")
if stage == 1:
SceneManager.enable_prop_item("prop_纸铜钱1")
return true
elif stage == 2:
SceneManager.disable_prop_item("prop_纸铜钱1")
SceneManager.enable_prop_item("prop_2个纸铜钱")
return true
elif stage == 3:
SceneManager.disable_prop_item("prop_2个纸铜钱")
SceneManager.enable_prop_item("prop_3个纸铜钱")
return true
else:
2025-07-24 05:39:52 +00:00
SceneManager.enable_prop_item("prop_3个纸铜钱")
printerr("c03_get_paper_coin: stage should not be greater than 3, but got %d" % stage)
return false
# amb_玩家主动选择离开游戏 8.46s
var stream_exit_by_choice = preload("uid://dlvxxvcx7ga3w")
func c02_exit_from_corridor() -> void:
SceneManager.lock_player()
if not ArchiveManager.get_global_value("has_exited_by_player_choice"):
ArchiveManager.set_global_entry("has_exited_by_player_choice", true)
# 首次选择时,播放离开音效
SceneManager.black_transition(0.7, 10.0)
# amb_玩家主动选择离开游戏 8.46s
AudioManager.play_sfx(stream_exit_by_choice)
await Util.wait(8.5)
SceneManager.unlock_player()
SceneManager.checkout_index_page()
func c03_final_choose_exit() -> void:
EventManager.set_stage_if_greater("c03_well_show", 2)
ArchiveManager.set_global_entry("has_exited_by_player_choice", true)
# 黑屏播放结束音效后回到主菜单
# 如果出公寓做过选择,此处就不出现选择
SceneManager.lock_player()
SceneManager.black_transition(0.7, 10.0)
AudioManager.play_sfx(stream_exit_by_choice)
await Util.wait(8.5)
SceneManager.unlock_player()
SceneManager.checkout_index_page()