适配配音与 npc 结点

This commit is contained in:
cakipaul 2025-01-10 17:53:12 +08:00
parent be6b57dd07
commit c5cbf263ee
29 changed files with 282 additions and 97 deletions

View File

@ -6,7 +6,7 @@
: “......” [ID:dialog_dots]
=> END
~ c01_s01_oldman
~ c01_s01_老人
(一个老人正在喂食笼子里的老鼠) [ID:c01_老人喂食]
老人: “这么多年......还是找不到......” [ID:c01_老人喂食_1]
老人: “它们说......等它们吃饱了......” [ID:c01_老人喂食_2]
@ -15,12 +15,12 @@
: “......” [ID:dialog_dots]
=> END
~ c01_s03_feature
~ c01_s03_恶鬼
“在这儿吗......” [ID:c01_在这儿吗]
=> END
~ c01_s04_begin
~ c01_s04_车夫对话1
吕萍: “又是这个梦” [ID:c01_吕萍与车夫_01]
吕萍: “这个星期已经第三次了” [ID:c01_吕萍与车夫_02]
吕萍: “我到底是怎么了” [ID:c01_吕萍与车夫_03]
@ -35,19 +35,19 @@
车夫: “哈哈,小姐你坐好了,跑了“ [ID:c01_吕萍与车夫_12]
=> END
~ c01_s04_animation1
~ c01_s04_车夫对话2
车夫: “小姐,你这是回家过年是哇?” [ID:c01_吕萍与车夫_13]
=> END
~ c01_s04_animation2
~ c01_s04_车夫对话3
吕萍: “哦,不是的......” [ID:c01_吕萍与车夫_14]
=> END
~ c01_s04_animation3
~ c01_s04_车夫对话4
车夫: “啊?不会是工作吧” [ID:c01_吕萍与车夫_15]
=> END
~ c01_s04_animation4
~ c01_s04_车夫对话5
车夫: “这不行的,你这小年夜还要安排工作啊” [ID:c01_吕萍与车夫_16]
车夫: “你看我,拉完你这一趟,我也要准备收工了” [ID:c01_吕萍与车夫_17]
车夫: “工作什么的,今天肯定要统统结束掉的,你说对哇” [ID:c01_吕萍与车夫_18]
@ -56,19 +56,19 @@
车夫: “时间也差不多” [ID:c01_吕萍与车夫_21]
=> END
~ c01_s04_animation5
~ c01_s04_车夫对话6
吕萍: “......” [ID:c01_吕萍与车夫_22]
=> END
~ c01_s04_animation6
~ c01_s04_车夫对话7
吕萍: “是到了吗,师傅” [ID:c01_吕萍与车夫_23]
=> END
~ c01_s04_animation7
~ c01_s04_车夫对话8
车夫: “到了芦昌路26弄3号就是这里” [ID:c01_吕萍与车夫_24]
=> END
~ c01_s04_animation8
~ c01_s04_车夫对话9
车夫: “嗯,钱正好,那么我先跑了” [ID:c01_吕萍与车夫_25]
吕萍: “好的,谢谢师傅” [ID:c01_吕萍与车夫_26]
车夫: “哎哟,谢什么” [ID:c01_吕萍与车夫_27]

View File

@ -37,7 +37,7 @@ c02_张胖子_招呼吕萍1,“老方,小朋友又不懂,和她讲这些干
c02_张胖子_招呼吕萍2,“小蝶啊,回头记得带妈妈来叔叔这儿买肉啊”,,张胖子,,[#anonymous]
c02_张胖子_招呼吕萍3,“外面没的买,叔叔这里多的是”,,张胖子,,[#anonymous]
c02_张胖子_招呼吕萍4,“这些人是在跟我说话吗”,,吕萍,,
c02_张胖子_招呼吕萍5,“来来来,过来,过来”,,张胖子,,[#anonymous]
c02_张胖子_招呼吕萍5,“来来来,过来,过来”,"""come on, come on""",张胖子,,[#anonymous]
c02_张胖子_招呼吕萍6,“悄悄和你讲,让你妈妈来我这里买肉,给你们家便宜点”,,张胖子,,[#anonymous]
c02_张胖子_招呼吕萍7,“不行到时候我给你们把肉送到家里去,好哇”,,张胖子,,[#anonymous]
c02_张胖子_招呼吕萍8,“呃,不用......不用了......”,,吕萍,,

1 keys zh_Hans en _character _notes _tags
37 c02_张胖子_招呼吕萍2 “小蝶啊,回头记得带妈妈来叔叔这儿买肉啊” 张胖子 [#anonymous]
38 c02_张胖子_招呼吕萍3 “外面没的买,叔叔这里多的是” 张胖子 [#anonymous]
39 c02_张胖子_招呼吕萍4 “这些人是在跟我说话吗” 吕萍
40 c02_张胖子_招呼吕萍5 “来来来,过来,过来” "come on, come on" 张胖子 [#anonymous]
41 c02_张胖子_招呼吕萍6 “悄悄和你讲,让你妈妈来我这里买肉,给你们家便宜点” 张胖子 [#anonymous]
42 c02_张胖子_招呼吕萍7 “不行到时候我给你们把肉送到家里去,好哇” 张胖子 [#anonymous]
43 c02_张胖子_招呼吕萍8 “呃,不用......不用了......” 吕萍

View File

@ -1,5 +1,5 @@
#场景一
~ c02_s01_menpai
~ c02_s01_门口
##孤寂的氛围 [#wave] [#shake]
芦昌路26弄3号 [ID:c02_芦昌路26]
“这是梦里的那栋楼” [ID:c02_吕萍_01_梦楼]
@ -20,46 +20,46 @@
#=> END
#场景二
~ c02_s02_tianqi
~ c02_s02_天冷
吕萍: “冷飕飕的,早知道多穿一件出来了” [ID:c02_吕萍_天冷]
=> END
#场景三
~ c02_s03_tianqi
~ c02_s03_天暗
吕萍: “天色变暗了” [ID:c02_吕萍_天暗]
=> END
~ c02_s03_mimi
~ c02_s03_井旁咪咪1
吕萍: “这么冷的天,怎么这树的叶子还这么茂盛” [ID:c02_吕萍_井旁01]
...[#wait=2] [ID:c02_吕萍_井旁音效]
吕萍: “咪咪?” [ID:c02_吕萍_井旁02]
吕萍: “好多老鼠” [ID:c02_吕萍_井旁03]
=> END
~ c02_s03_shushu
~ c02_s03_去去
吕萍: “去,去” [ID:c02_吕萍_去去]
=> END
~ c02_s03_mimi2
~ c02_s03_咪咪2
吕萍: “你好乖啊” [ID:c02_吕萍_好乖]
(咕噜咕噜) [ID:c02_咕噜]
=> END
~ c02_s03_mimi2_2
~ c02_s03_咪咪3
吕萍: “诶?怎么走了” [ID:c02_吕萍_怎么走了]
=> END
~ c02_s03_xiaomaotou
~ c02_s03_小猫头1
吕萍: “这是什么东西?” [ID:c02_吕萍_这是什么]
=> END
~ c02_s03_xiaomaotou_2
~ c02_s03_小猫头2
吕萍: “嘶......我的头又开始痛了” [ID:c02_吕萍_头痛]
=> END
#场景四
~ c02_s04_fartherandgirl
~ c02_s04_小蝶与陆仁
小蝶: “爸爸,我昨晚听到有大老鼠在床边叫” [#anonymous] [ID:c02_小蝶与陆仁_01]
陆仁: “囡囡不怕哦,你把妈妈给你做的娃娃放在床边” [#anonymous] [ID:c02_小蝶与陆仁_02]
陆仁: “老鼠就不敢过来了” [#anonymous] [ID:c02_小蝶与陆仁_03]
@ -71,7 +71,7 @@
=> END
~ c02_s04_lvping_02
~ c02_s04_眼花了
吕萍: “我刚才眼花了吗” [ID:c02_吕萍_眼花了1]
吕萍: “这些人从哪儿来的” [ID:c02_吕萍_眼花了2]
吕萍: “......” [ID:c02_吕萍_眼花了3]
@ -79,52 +79,48 @@
=> END
~ c02_s04_lishi_01
~ c02_s04_吕萍问李氏
吕萍: “你好,请问陆先生住在这里吗” [ID:c02_吕萍问李氏_1]
李氏: “啊?你爸妈忙的又没空管你啦” [#anonymous] [ID:c02_吕萍问李氏_2]
李氏: “死了滚,生意都被你家抢没了” [#anonymous] [ID:c02_吕萍问李氏_3]
吕萍: “她在说什么......” [ID:c02_吕萍问李氏_4]
=> END
~ c02_s04_lishi_02
~ c02_s04_李氏吐槽
李氏: “册那,都趁早死死掉算了” [#anonymous] [ID:c02_李氏_吐槽]
=> END
~ c02_s04_xiazi
~ c02_s04_吕萍问方瞎子
吕萍: “呃......你好,请问......” [ID:c02_吕萍问方瞎子_1]
方瞎子: “祸福在己,当自求;兴衰有数,莫强留” [#anonymous] [ID:c02_吕萍问方瞎子_2]
吕萍: “......” [ID:c02_dialog_dots]
=> END!
~ c02_s04_pangzi_01
~ c02_s04_张胖子方瞎子
张胖子: “老方,小朋友又不懂,和她讲这些干嘛” [#anonymous] [ID:c02_张胖子_招呼吕萍1]
张胖子: “小蝶啊,回头记得带妈妈来叔叔这儿买肉啊” [#anonymous] [ID:c02_张胖子_招呼吕萍2]
张胖子: “外面没的买,叔叔这里多的是” [#anonymous] [ID:c02_张胖子_招呼吕萍3]
吕萍: “这些人是在跟我说话吗” [ID:c02_张胖子_招呼吕萍4]
=> END!
~ c02_s04_pangzi_02
张胖子: “来来来,过来,过来” [#anonymous] [ID:c02_张胖子_招呼吕萍5]
=> END
~ c02_s04_pangzi_03
~ c02_s04_张胖子卖肉
张胖子: “悄悄和你讲,让你妈妈来我这里买肉,给你们家便宜点” [#anonymous] [ID:c02_张胖子_招呼吕萍6]
张胖子: “不行到时候我给你们把肉送到家里去,好哇” [#anonymous] [ID:c02_张胖子_招呼吕萍7]
吕萍: “呃,不用......不用了......” [ID:c02_张胖子_招呼吕萍8]
=> END
~ c02_s04_boy
~ c02_s04_小男孩与猫和绳子
小男孩: “喂,那只成天跟着你的小猫去哪里啦” [ID:c02_小男孩_问猫1]
小男孩: “好可爱的,也抱来给我们摸摸呗” [ID:c02_小男孩_问猫2]
吕萍: “猫?你说的是那只黑色的猫吗?” [ID:c02_小男孩_问猫3]
小男孩: “对啊对啊,哦对了,你有绳子嘛” [ID:c02_小男孩_问猫4]
=> END
~ c02_s04_boy01
~ c02_s04_小男孩要绳子
小男孩: “对了,你有绳子嘛” [ID:c02_小男孩_绳子]
=> END
~ c02_s04_boy02
~ c02_s04_小男孩要玩
小男孩: “嘿嘿,一会儿我们要在常年青下玩游戏,这次就叫上你吧” [ID:c02_小男孩_玩游戏]
=> END
@ -164,61 +160,61 @@
=> END
~ c02_s08_fangjian1
~ c02_s08_房间没尽头1
吕萍: “房间怎么还没有到头” [ID:c02_吕萍_房间没尽头]
=> END
~ c02_s08_zhitiao2
~ c02_s08_房间没尽头_头痛
吕萍: “头好痛” [ID:c02_吕萍_头好痛]
=> END
~ c02_s08_fangjian2
~ c02_s08_房间没尽头2
吕萍: “......” [ID:c02_dialog_dots]
吕萍: “这......到底是怎么回事” [ID:c02_吕萍_做梦吗1]
吕萍: “我是在......做梦吗?” [ID:c02_吕萍_做梦吗2]
=> END
~ c02_s08_xiaodie01
~ c02_s08_小蝶1
## 复用: c02_小蝶与陆仁_04
小蝶: “爸爸,什么时候让妈妈教我唱歌呀” [#anonymous] [ID:c02_小蝶陆仁_教唱歌1]
陆仁: “妈妈嗓子坏了,爸爸教你唱吧” [#anonymous] [ID:c02_小蝶陆仁_教唱歌2]
陆仁: “走吧,去把药喝了” [#anonymous] [ID:c02_小蝶陆仁_教唱歌3]
=> END
~ c02_s08_xiaodie02
~ c02_s08_小蝶2
## tfd98f18577
小蝶: “妈妈,爸爸什么时候能让我出去玩呀” [#anonymous] [ID:c02_小蝶_出去玩]
=> END
~ c02_s08_xiaodie03
~ c02_s08_小蝶3
## 复用: c02_小蝶与陆仁_01
小蝶: “妈妈,我房间里好像有一只大老鼠” [#anonymous] [ID:c02_小蝶_大老鼠1]
## t56894aa36d
小蝶: “妈妈,我怕” [#anonymous] [ID:c02_小蝶_大老鼠2]
=> END
~ c02_s08_jiewei01
~ c02_s08_小蝉喊醒醒1
小蝉: “小蝶” [#anonymous] [ID:c02_小蝉_呼唤1]
=> END
~ c02_s08_jiewei02
~ c02_s08_小蝉喊醒醒2
小蝉: “醒醒” [#anonymous] [ID:c02_小蝉_呼唤2]
=> END
~ c02_s08_jiewei03
~ c02_s08_不要吵1
吕萍: “太吵了,不要吵了” [ID:c02_吕萍_不要吵1]
=> END
~ c02_s08_jiewei04
~ c02_s08_不要吵2
吕萍: “不要再说了!” [ID:c02_吕萍_不要吵2]
=> END
~ c02_s08_jiewei05
~ c02_s08_不要吵3
吕萍: “不要!” [ID:c02_吕萍_不要吵3]
=> END
# 场景十
~ c02_s10_boy01
~ c02_s08_吕萍对话小弟弟1
吕萍: “你是刚刚门口那个小弟弟” [ID:c02_吕萍男孩_对话01]
男孩: “小蝶,你终于还是回来了” [ID:c02_吕萍男孩_对话02]
吕萍: “我们认识吗?” [ID:c02_吕萍男孩_对话03]
@ -239,31 +235,30 @@
男孩: “你现在在这里一定要小心” [ID:c02_吕萍男孩_对话18]
=> END
~ c02_s10_boy02
~ c02_s08_吕萍对话小弟弟2
吕萍: “诶?等一下” [ID:c02_吕萍男孩_对话19]
=> END
~ c02_s10_boy03
~ c02_s08_吕萍对话小弟弟3
男孩: “去1014” [ID:c02_吕萍男孩_对话20]
=> END
~ c02_s10_cat
~ c02_s08_吕萍又见咪咪
吕萍: “咪咪?又是你” [ID:c02_吕萍_又是咪咪]
=> END
~ c02_s10_men
~ c02_s08_吕萍见墙
吕萍: “这是......一面墙?” [ID:c02_吕萍_一面墙]
=> END
# 场景十二
~ c02_s12_kaitou
~ c02_s08_吕萍见地道
吕萍: “这是......通到什么地方去的” [ID:c02_吕萍_地道]
=> END
~ c02_s13_fartherandmother
~ c02_s13_陆仁通话
陆仁: “你也不要太担心了,柜子我上了把锁” [ID:c02_陆仁_对话1]
陆仁: “回头我再去问问看,说不定就是楼里的人偷的” [#wait=2] [ID:c02_陆仁_对话2]
陆仁: “你不要管他们怎么说,病确实是治好了,我们自己心里知道就可以了” [ID:c02_陆仁_对话3]
@ -279,6 +274,6 @@
#=> END
~ c02_s15_boy
~ c02_s15_男孩说回来了
男孩: “你终于还是回来了” [ID:c02_男孩_终于回来了]
=> END

Binary file not shown.

View File

@ -3,14 +3,13 @@ extends Node2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
print(tr("获得"))
print("loaded_locales:", TranslationServer.get_loaded_locales())
print("locale:", TranslationServer.get_locale())
print(tr("“时辰将至,锁魂障眼,自欺欺人” #tag1 #tag2", "t86c8af3834"))
print(tr("老人", "c01_吕萍_001_喃喃自语"))
print(tr("c01_吕萍_001_喃喃自语"))
print(tr("阅读"))
print(tr("阅读"))
print(tr("c02_张胖子_招呼吕萍5"))
TranslationServer.set_locale("en")
print("locale:", TranslationServer.get_locale())
print(tr("老人", "c01_吕萍_001_喃喃自语"))
print(tr("c01_吕萍_001_喃喃自语"))
print(tr("“时辰将至,锁魂障眼,自欺欺人” #tag1 #tag2", "t86c8af3834"))
print(tr("ui_阅读"))
print(tr("c02_张胖子_招呼吕萍5"))

View File

@ -1,5 +1,5 @@
keys,zh_Hans,_character,_notes,_tags
t344c97cf2c,据闻奉贤县分水墩又有七人染受鼠疫,病状可怖,闻医官药治无用,免职。,,,
tdb119a3714,有地方人称鼠疫为妖邪作祟,甚为惊骇,一时人心惶惶,竟有聚众滋闹之事,政府以防疫事宜关系紧要,拟赴分水墩一带调查防疫事宜云。,,,
ta750647b12,《申报》,,,
t736cca4563,民国五年一月十三日,,,
keys,zh_Hans,_character,_notes,_tags,en
t344c97cf2c,据闻奉贤县分水墩又有七人染受鼠疫,病状可怖,闻医官药治无用,免职。,,,,
tdb119a3714,有地方人称鼠疫为妖邪作祟,甚为惊骇,一时人心惶惶,竟有聚众滋闹之事,政府以防疫事宜关系紧要,拟赴分水墩一带调查防疫事宜云。,,,,
ta750647b12,《申报》,,,,
t736cca4563,民国五年一月十三日,,,,

1 keys zh_Hans _character _notes _tags en
2 t344c97cf2c 据闻奉贤县分水墩又有七人染受鼠疫,病状可怖,闻医官药治无用,免职。
3 tdb119a3714 有地方人称鼠疫为妖邪作祟,甚为惊骇,一时人心惶惶,竟有聚众滋闹之事,政府以防疫事宜关系紧要,拟赴分水墩一带调查防疫事宜云。
4 ta750647b12 《申报》
5 t736cca4563 民国五年一月十三日

Binary file not shown.

View File

@ -3,7 +3,7 @@
退出 [ID:ui_退出]
阅读 [ID:ui_阅读]
收起 [ID:ui_收起]
=> END!
=> END
~ Prop
小猫玩具的脑袋 [ID:prop_小猫玩具的脑袋]

Binary file not shown.

3
asset/dialogue/npc.csv Normal file
View File

@ -0,0 +1,3 @@
keys,zh_Hans,_character,_notes,_tags,en
c02_张胖子_招呼吕萍5,“来来来,过来,过来”,张胖子,,[#anonymous],
c02_吕萍问方瞎子_2,“祸福在己,当自求;兴衰有数,莫强留”,方瞎子,,[#anonymous],
1 keys zh_Hans _character _notes _tags en
2 c02_张胖子_招呼吕萍5 “来来来,过来,过来” 张胖子 [#anonymous]
3 c02_吕萍问方瞎子_2 “祸福在己,当自求;兴衰有数,莫强留” 方瞎子 [#anonymous]

View File

@ -0,0 +1,15 @@
~ 张胖子_01_匿名
张胖子: “来来来,过来,过来” [#anonymous] [ID:c02_张胖子_招呼吕萍5]
=> END
~ 张胖子_01
张胖子: “来来来,过来,过来” [ID:c02_张胖子_招呼吕萍5]
=> END
~ 方瞎子_01_匿名
方瞎子: “祸福在己,当自求;兴衰有数,莫强留” [#anonymous] [ID:c02_吕萍问方瞎子_2]
=> END
~ 方瞎子_01
方瞎子: “祸福在己,当自求;兴衰有数,莫强留” [ID:c02_吕萍问方瞎子_2]
=> END

Binary file not shown.

Binary file not shown.

View File

@ -12,10 +12,15 @@ class_name AssembledArchive extends Resource
@export var created_time := "2024-12-24 00:00:00"
@export var ambush_data := {}
# true 为匿名false 非匿名
@export var npc_anonymous_states := {
}
@export var prop_inventory: PropInventory
@export_group("八音盒","bayinhe")
@export_group("八音盒", "bayinhe")
@export var bayinhe_current_answer := [0, 0, 0, 0, 0, 0, 0, 0, 0]
@export_enum("closed", "opened", "playing", "finished") var bayinhe_mode := "closed"

View File

@ -145,8 +145,8 @@ toggle_journal={
[internationalization]
locale/translations=PackedStringArray("res://asset/dialogue/c01.en.translation", "res://asset/dialogue/c01.zh_Hans.translation", "res://asset/dialogue/c02.en.translation", "res://asset/dialogue/c02.zh_Hans.translation", "res://asset/dialogue/item_description.en.translation", "res://asset/dialogue/item_description.zh_Hans.translation", "res://asset/dialogue/names.en.translation", "res://asset/dialogue/names.zh_Hans.translation")
locale/translations_pot_files=PackedStringArray("res://asset/dialogue/item_description.dialogue", "res://asset/dialogue/c01.dialogue", "res://asset/dialogue/c02.dialogue", "res://asset/dialogue/inspect_content.dialogue")
locale/translations=PackedStringArray("res://asset/dialogue/c01.en.translation", "res://asset/dialogue/c01.zh_Hans.translation", "res://asset/dialogue/c02.en.translation", "res://asset/dialogue/c02.zh_Hans.translation", "res://asset/dialogue/item_description.en.translation", "res://asset/dialogue/item_description.zh_Hans.translation", "res://asset/dialogue/names.en.translation", "res://asset/dialogue/names.zh_Hans.translation", "res://asset/dialogue/inspect_content.en.translation", "res://asset/dialogue/inspect_content.zh_Hans.translation", "res://asset/dialogue/npc.en.translation", "res://asset/dialogue/npc.zh_Hans.translation")
locale/translations_pot_files=PackedStringArray("res://asset/dialogue/item_description.dialogue", "res://asset/dialogue/c01.dialogue", "res://asset/dialogue/c02.dialogue", "res://asset/dialogue/inspect_content.dialogue", "res://asset/dialogue/npc.dialogue")
locale/test="zh-Hans"
locale/fallback="zh"

View File

@ -59,7 +59,6 @@ Panel/styles/panel = SubResource("StyleBoxEmpty_jydvi")
[node name="Balloon" type="CanvasLayer"]
layer = 100
script = ExtResource("1_36de5")
force_locale = "zh"
metadata/_edit_vertical_guides_ = [-78.0]
metadata/_edit_horizontal_guides_ = [276.0]

View File

@ -1,25 +1,120 @@
@tool
extends Node2D
@export var one_shot := true
@export var hook_cg = ""
@export var freeze_time := 5.0
@export var hook_animation = ""
@export var lock_player_on_playing_dialogue = true
@export_enum("c01", "c02") var hook_dialogue_res = "c01":
set(val):
hook_dialogue_res = val
match val:
"c01":
dialogue_res = dialogue_c01
"c02":
dialogue_res = dialogue_c02
if is_node_ready():
notify_property_list_changed()
var hook_dialogue_title = ""
var played := false
var dialogue_c01 = preload("res://asset/dialogue/c01.dialogue")
var dialogue_c02 = preload("res://asset/dialogue/c02.dialogue")
var dialogue_res = dialogue_c01
var played_time := 0.0
var played := false:
set(val):
played = val
_save_archive()
@onready var area2d = %Area2D as Area2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
if Engine.is_editor_hint():
return
_load_archive()
if one_shot and played:
if GlobalConfig.DEBUG:
print("Ambush already played, key=", _get_key())
return
area2d.body_entered.connect(_entered)
func _get_key() -> String:
var ground_loader = get_node_or_null("../../..") as GroundLoader
if ground_loader:
return ground_loader.current_scene + "_" + name
return name
func _save_archive():
if Engine.is_editor_hint():
return
ArchiveManager.archive.ambush_data[_get_key()] = {"played": played}
func _load_archive():
if Engine.is_editor_hint():
return
var key = _get_key()
if ArchiveManager.archive.ambush_data.has(key):
var data = ArchiveManager.archive.ambush_data[key]
if data.has("played"):
played = data.played
func _entered(_body):
print("ambush body_entered!")
if one_shot and played:
queue_free()
if not one_shot:
var time = Time.get_ticks_msec()
var time_left = freeze_time - (time - played_time) * 0.001
if time_left > 0:
if GlobalConfig.DEBUG:
print("Ambush freeze time not reached, time left=", time_left)
return
# hook_cg
if hook_cg != "":
CgManager.play_cg(hook_cg)
played_time = time
# hook_animation
if hook_animation:
$AnimationPlayer.play(hook_animation)
# hook_dialogue
if hook_dialogue_title:
if lock_player_on_playing_dialogue:
SceneManager.freeze_player(0.0, "")
DialogueManager.show_dialogue_balloon(dialogue_res, hook_dialogue_title)
DialogueManager.dialogue_ended.connect(_on_dialogue_ended, CONNECT_ONE_SHOT)
if one_shot:
queue_free()
played = true
return
func _on_dialogue_ended(_res):
if GlobalConfig.DEBUG:
print("Ambush dialogue ended")
if lock_player_on_playing_dialogue:
SceneManager.release_player()
func _get(property: StringName) -> Variant:
if property == "hook_dialogue_title":
return hook_dialogue_title
return null
func _set(property: StringName, value: Variant) -> bool:
if property == "hook_dialogue_title":
hook_dialogue_title = value
return true
return false
func _get_property_list() -> Array[Dictionary]:
return [
{
"name": "hook_dialogue_title",
"type": TYPE_STRING,
"hint": PROPERTY_HINT_ENUM_SUGGESTION,
"hint_string": ",".join(dialogue_res.titles.keys())
}
]

View File

@ -8,9 +8,12 @@ size = Vector2(40, 70)
[node name="Ambush" type="Node2D"]
script = ExtResource("1_rxgbr")
hook_dialogue_title = ""
[node name="Area2D" type="Area2D" parent="."]
unique_name_in_owner = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("RectangleShape2D_iwrfx")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]

View File

@ -146,7 +146,7 @@ func _get_property_list() -> Array[Dictionary]: # only show notes_ properties in
{
"name": "note_key",
"type": TYPE_STRING,
"hint": PROPERTY_HINT_ENUM,
"hint": PROPERTY_HINT_ENUM_SUGGESTION,
"hint_string": ",".join(filted_titles)
}
]

View File

@ -1,17 +1,34 @@
@tool
extends AnimatedSprite2D
@export var dialogs := []
@export var anonymous_title_suffix := "_匿名"
@export var character_name := ""
@export var anonymous := true:
set(val):
anonymous = val
if is_node_ready() and not Engine.is_editor_hint():
ArchiveManager.archive.npc_anonymous_states[character_name] = val
@onready var speaking_animation = %SpeakingAnimationPlayer
@onready var speaking_sign = %SpeakingSign2D as Node2D
@onready var sign_mark = %Sign as Sign
@onready var area2d = %Area2D as Area2D
var dialog_played := false
var dialogue_title := ""
var dialogue_res = preload("res://asset/dialogue/npc.dialogue")
func _init() -> void:
if Engine.is_editor_hint():
return
if character_name and ArchiveManager.archive.npc_anonymous_states.has(character_name):
anonymous = ArchiveManager.archive.npc_anonymous_states[character_name]
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
if animation:
play()
area2d.body_entered.connect(_reset)
area2d.body_exited.connect(_on_cancel)
sign_mark.interacted.connect(_on_interacted)
@ -19,8 +36,18 @@ func _ready() -> void:
func _on_interacted() -> void:
%Sfx.play()
print("npc interacted")
# %Sfx.play()
speaking_animation.play("speaking")
# play dialogue
if dialogue_title:
# 适配匿名效果
if anonymous and not dialogue_title.ends_with(anonymous_title_suffix):
dialogue_title += anonymous_title_suffix
elif not anonymous and dialogue_title.ends_with(anonymous_title_suffix):
dialogue_title = dialogue_title.substr(
0, dialogue_title.length() - anonymous_title_suffix.length()
)
DialogueManager.show_dialogue_balloon(dialogue_res, dialogue_title)
func _on_cancel(_body = null):
@ -29,3 +56,27 @@ func _on_cancel(_body = null):
func _reset(_body = null):
speaking_animation.play("speaking")
func _get(property: StringName) -> Variant:
if property == "dialogue_title":
return dialogue_title
return null
func _set(property: StringName, value: Variant) -> bool:
if property == "dialogue_title":
dialogue_title = value
return true
return false
func _get_property_list() -> Array[Dictionary]:
return [
{
"name": "dialogue_title",
"type": TYPE_STRING,
"hint": PROPERTY_HINT_ENUM_SUGGESTION,
"hint_string": ",".join(dialogue_res.titles.keys())
}
]

View File

@ -78,15 +78,19 @@ size = Vector2(61, 112.75)
[node name="Npc" type="AnimatedSprite2D"]
sprite_frames = ExtResource("3_1e8sl")
animation = &"c02_张胖子_idle"
frame_progress = 0.311606
script = ExtResource("1_jegr2")
dialogue_title = ""
[node name="Sfx" parent="." instance=ExtResource("3_4d53s")]
unique_name_in_owner = true
[node name="Sign" parent="." instance=ExtResource("4_nokx4")]
unique_name_in_owner = true
modulate = Color(1, 1, 1, 0)
offset_top = -60.0
offset_bottom = -60.0
show_sign = false
[node name="SpeakingAnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true

View File

@ -43,6 +43,10 @@ note_key = "c02_s01_menpai"
[node name="Ambush" parent="Ground/DeployLayer" index="4" instance=ExtResource("6_vgxa0")]
position = Vector2(135, 56)
hook_animation = null
lock_player_on_playing_dialogue = null
hook_dialogue_res = null
hook_dialogue_title = ""
[node name="FGSprite2D" parent="Ground/ParallaxForeground/FGParallaxLayer" index="0"]
texture = null

View File

@ -45,7 +45,6 @@ target_portal = "left"
[node name="几张卫生宣传画" parent="Ground/DeployLayer" index="2" instance=ExtResource("3_fy0o1")]
position = Vector2(275, -30)
dialogue = null
editor_filter = "c01"
[node name="鼠疫海报" parent="Ground/DeployLayer" index="3" instance=ExtResource("12_0fckv")]
@ -67,7 +66,11 @@ shape = SubResource("RectangleShape2D_0xrg2")
[node name="Ambush" parent="Ground/DeployLayer" index="5" instance=ExtResource("6_70vqn")]
position = Vector2(502, 56)
hook_cg = "c02_胖子说话"
one_shot = null
freeze_time = null
hook_animation = null
lock_player_on_playing_dialogue = null
hook_dialogue_res = null
[node name="HdEntity" parent="Ground/DeployLayer" index="6" node_paths=PackedStringArray("sprite_ref") instance=ExtResource("10_3c313")]
position = Vector2(147, 75)

View File

@ -6,7 +6,6 @@
[ext_resource type="PackedScene" uid="uid://jr1yd46wm5je" path="res://scene/entity/note.tscn" id="3_6x7xl"]
[ext_resource type="Texture2D" uid="uid://bb3f72fla7mvs" path="res://asset/art/scene/c02/s03_院子切换/bg_院子1楼(黄昏无人).png" id="3_78bcp"]
[ext_resource type="Texture2D" uid="uid://dqsl8rcues8hs" path="res://asset/art/scene/c02/s03_院子切换/n_院子1楼(黄昏无人).png" id="4_nef6w"]
[ext_resource type="PackedScene" uid="uid://wyj4qdjyn4ql" path="res://scene/entity/old/inspectable.tscn" id="5_0xh53"]
[ext_resource type="PackedScene" uid="uid://bnf3lkcbpx1ar" path="res://scene/entity/ambush.tscn" id="6_gg4jv"]
[ext_resource type="Texture2D" uid="uid://0yip10ue5r4x" path="res://asset/art/scene/c02/s04_院子现实版/fg_楼梯.png" id="7_icddm"]
[ext_resource type="PackedScene" uid="uid://cw3q5pvciumil" path="res://scene/entity/interactable.tscn" id="8_vdelk"]
@ -25,6 +24,10 @@ bgm = ""
diffuse_texture = ExtResource("3_78bcp")
normal_texture = ExtResource("4_nef6w")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ec3g1"]
resource_local_to_scene = true
size = Vector2(40, 70)
[node name="S03" type="Node2D"]
[node name="Ground" parent="." instance=ExtResource("1_lheeb")]
@ -42,18 +45,23 @@ visible = false
[node name="Npc" parent="Ground/DeployLayer" index="2" instance=ExtResource("2_r5smg")]
position = Vector2(465, 23)
frame_progress = 0.94813
character_name = "张胖子"
dialogue_title = "张胖子_01"
[node name="Note" parent="Ground/DeployLayer" index="3" instance=ExtResource("3_6x7xl")]
position = Vector2(268, -36)
[node name="Inspectable" parent="Ground/DeployLayer" index="4" instance=ExtResource("5_0xh53")]
position = Vector2(376, 36)
[node name="Ambush" parent="Ground/DeployLayer" index="4" instance=ExtResource("6_gg4jv")]
position = Vector2(343, 33)
freeze_time = 15.0
hook_dialogue_res = "c02"
hook_dialogue_title = "c02_s04_张胖子卖肉"
[node name="Ambush" parent="Ground/DeployLayer" index="5" instance=ExtResource("6_gg4jv")]
position = Vector2(567, 28)
hook_cg = "c02_胖子说话"
[node name="CollisionShape2D" parent="Ground/DeployLayer/Ambush/Area2D" index="0"]
shape = SubResource("RectangleShape2D_ec3g1")
[node name="Interactable" parent="Ground/DeployLayer" index="6" instance=ExtResource("8_vdelk")]
[node name="Interactable" parent="Ground/DeployLayer" index="5" instance=ExtResource("8_vdelk")]
position = Vector2(1072, 22)
collision_mask = 1
@ -81,3 +89,4 @@ scale = Vector2(1.08, 1.08)
color = Color(0.368627, 0.447059, 0.882353, 1)
[editable path="Ground"]
[editable path="Ground/DeployLayer/Ambush"]

View File

@ -12,3 +12,4 @@ func _ready() -> void:
$UILayer.layer = GlobalConfig.CANVAS_LAYER_UI
%ColorRectTop.visible = true
%ColorRectBottom.visible = true

View File

@ -74,7 +74,6 @@ metadata/_edit_use_anchors_ = true
[node name="PropHUD" parent="UILayer" instance=ExtResource("4_t7gb2")]
scale = Vector2(0.24, 0.24)
item_key = null
metadata/_edit_use_anchors_ = true
[node name="Journal" parent="." instance=ExtResource("10_durpa")]