完成ui与道具的多语言配置

This commit is contained in:
cakipaul 2025-01-10 15:43:55 +08:00
parent fcbf1f0feb
commit be6b57dd07
33 changed files with 415 additions and 181 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

View File

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

Binary file not shown.

View File

@ -1,5 +1,11 @@
keys,zh_Hans,en,_character,_notes,_tags
notes_纸条,(纸条),,,, [#item]
ui_退出,退出,Exit,,,
ui_阅读,阅读,Read,,,
ui_收起,收起,Hold,,,
prop_小猫玩具的脑袋,小猫玩具的脑袋,Catty's Head,,,
prop_绳子,绳子,Rope,,,
prop_1012钥匙,1012钥匙,1012 Key,,,
notes_纸条,(纸条),,,,
notes_锁住了,(锁住了),,,,
notes_打不开,(打不开),,,,
notes_干掉的血迹,(干掉的血迹),,,,
@ -8,15 +14,14 @@ notes_无法触碰,(无法触碰),,,,
notes_挂画,(挂画),,,,
notes_相框,(相框),,,,
notes_寻人启事,(寻人启事),,,,
c01_在这儿吗,“在这儿吗......”,,,,
c01_纸包钥匙,(一张纸条包着钥匙),,,,
c02_绳子剪刀,(绳子和剪刀),,,,
c02_似乎是寻人启事,(似乎是一张寻人启事),,,,
c02_寻人启,(脸的部分被撕掉了,看不清),,,,
c02_寻人启事1,(似乎是一张寻人启事),,,,
c02_寻人启事2,(脸的部分被撕掉了,看不清),,,,
c02_玩具缺脑袋,(这个玩具缺了个脑袋),,,,
c02_卫生宣传画,(几张卫生宣传画),,,,
(一个老鼠洞),(一个老鼠洞),,,,
c02_老鼠洞,(在这种楼里挺常见的),,,,
c02_老鼠洞1,(一个老鼠洞),,,,
c02_老鼠洞2,(在这种楼里挺常见的),,,,
c02_十几年前的报纸,(十几年前的报纸),,,,
c02_又是寻人启示,(又是那张寻人启示),,,,
c02_墙上的海报被撕掉了,(墙上的海报被撕掉了),,,,
@ -50,6 +55,7 @@ c02_锁开了,(锁开了),,,,
c02_口袋里有东西,(口袋里有东西),,,,
c02_雾太大,(雾太大了,看不清路),,,,
c02_八音盒,(是个八音盒),,,,
=>en,=>en,,,,
c02_祝女儿早日康复,(祝女儿早日康复),,,,
c02_图案一样,(这图案和我手臂上的一摸一样),,,,
c01_获得令牌,令牌,,获得,,[#item]

1 keys zh_Hans en _character _notes _tags
2 notes_纸条 ui_退出 (纸条) 退出 Exit [#item]
3 ui_阅读 阅读 Read
4 ui_收起 收起 Hold
5 prop_小猫玩具的脑袋 小猫玩具的脑袋 Catty's Head
6 prop_绳子 绳子 Rope
7 prop_1012钥匙 1012钥匙 1012 Key
8 notes_纸条 (纸条)
9 notes_锁住了 (锁住了)
10 notes_打不开 (打不开)
11 notes_干掉的血迹 (干掉的血迹)
14 notes_挂画 (挂画)
15 notes_相框 (相框)
16 notes_寻人启事 (寻人启事)
c01_在这儿吗 “在这儿吗......”
17 c01_纸包钥匙 (一张纸条包着钥匙)
18 c02_绳子剪刀 (绳子和剪刀)
19 c02_似乎是寻人启事 c02_寻人启事1 (似乎是一张寻人启事)
20 c02_寻人启示 c02_寻人启事2 (脸的部分被撕掉了,看不清)
21 c02_玩具缺脑袋 (这个玩具缺了个脑袋)
22 c02_卫生宣传画 (几张卫生宣传画)
23 (一个老鼠洞) c02_老鼠洞1 (一个老鼠洞)
24 c02_老鼠洞 c02_老鼠洞2 (在这种楼里挺常见的)
25 c02_十几年前的报纸 (十几年前的报纸)
26 c02_又是寻人启示 (又是那张寻人启示)
27 c02_墙上的海报被撕掉了 (墙上的海报被撕掉了)
55 c02_口袋里有东西 (口袋里有东西)
56 c02_雾太大 (雾太大了,看不清路)
57 c02_八音盒 (是个八音盒)
58 =>en =>en
59 c02_祝女儿早日康复 (祝女儿早日康复)
60 c02_图案一样 (这图案和我手臂上的一摸一样)
61 c01_获得令牌 令牌 获得 [#item]

View File

@ -1,62 +1,221 @@
~ notes_文本
# notes
# UI
~ UI
退出 [ID:ui_退出]
阅读 [ID:ui_阅读]
收起 [ID:ui_收起]
=> END!
~ Prop
小猫玩具的脑袋 [ID:prop_小猫玩具的脑袋]
绳子 [ID:prop_绳子]
1012钥匙 [ID:prop_1012钥匙]
=> END!
# notes 通用
~ notes_纸条
(纸条) [ID:notes_纸条]
(锁住了) [ID:notes_锁住了]
(打不开) [ID:notes_打不开]
=> END
~ notes_锁住了
(锁住了)[ID:notes_锁住了]
=> END
~ notes_打不开
(打不开)[ID:notes_打不开]
=> END
~ notes_干掉的血迹
(干掉的血迹) [ID:notes_干掉的血迹]
=> END
~ notes_有什么东西
(有什么东西) [ID:notes_有什么东西]
=> END
~ notes_无法触碰
(无法触碰) [ID:notes_无法触碰]
=> END
~ notes_挂画
(挂画) [ID:notes_挂画]
=> END
~ notes_相框
(相框) [ID:notes_相框]
=> END
~ notes_寻人启事
(寻人启事) [ID:notes_寻人启事]
=> END
# c01
“在这儿吗......” [ID:c01_在这儿吗]
~ c01_纸包钥匙
(一张纸条包着钥匙) [ID:c01_纸包钥匙]
=> END
# c02
~ c02_绳子剪刀
(绳子和剪刀) [ID:c02_绳子剪刀]
(似乎是一张寻人启事) [ID:c02_似乎是寻人启事]
(脸的部分被撕掉了,看不清) [ID:c02_寻人启示]
=> END
~ c02_寻人启事
(似乎是一张寻人启事) [ID:c02_寻人启事1]
(脸的部分被撕掉了,看不清) [ID:c02_寻人启事2]
=> END
~ c02_玩具缺脑袋
(这个玩具缺了个脑袋) [ID:c02_玩具缺脑袋]
=> END
~ c02_卫生宣传画
(几张卫生宣传画) [ID:c02_卫生宣传画]
(一个老鼠洞)
(在这种楼里挺常见的) [ID:c02_老鼠洞]
=> END
~ c02_老鼠洞
(一个老鼠洞)[ID:c02_老鼠洞1]
(在这种楼里挺常见的) [ID:c02_老鼠洞2]
=> END
~ c02_十几年前的报纸
(十几年前的报纸) [ID:c02_十几年前的报纸]
=> END
~ c02_又是寻人启示
(又是那张寻人启示) [ID:c02_又是寻人启示]
=> END
~ c02_墙上的海报被撕掉了
(墙上的海报被撕掉了) [ID:c02_墙上的海报被撕掉了]
=> END
~ c02_井臭
(井里有一股臭味) [ID:c02_井臭]
=> END
~ c02_中药材
(车上放了一些中药材) [ID:c02_中药材]
=> END
~ c02_排队
(排队的人堵住了上楼的路) [ID:c02_排队]
=> END
~ c02_不要出去
(最好还是先不要出去) [ID:c02_不要出去]
=> END
~ c02_太阳
(太阳快落山了) [ID:c02_太阳]
=> END
~ c02_民国六年1015
(民国六年十月十五日) [ID:c02_民国六年1015]
=> END
~ c02_一个洞
(一个洞,里面好像还有空间) [ID:c02_一个洞]
=> END
~ c02_工具箱
(工具箱) [ID:c02_工具箱]
=> END
~ c02_找到有用的东西
(应该能找到有用的东西) [ID:c02_找到有用的东西]
=> END
~ c02_公寓告示
(公寓告示) [ID:c02_公寓告示]
=> END
~ c02_通往里间的门
(通往里间的门) [ID:c02_通往里间的门]
=> END
~ c02_花名册
(花名册) [ID:c02_花名册]
=> END
~ c02_罪
(罪) [ID:c02_罪]
=> END
~ c02_门上有什么东西
(门上有什么东西) [ID:c02_门上有什么东西]
=> END
~ c02_奠
(奠) [ID:c02_奠]
=> END
~ c02_寻夏小蝉
(失踪的小孩名叫夏小蝉) [ID:c02_寻夏小蝉]
=> END
~ c02_小猫干尸
(小猫的尸体已经干了) [ID:c02_小猫干尸]
=> END
~ c02_几块大洋
(几块大洋) [ID:c02_几块大洋]
=> END
~ c02_死老鼠
(死掉的老鼠) [ID:c02_死老鼠]
=> END
~ c02_石缝开花
(石缝里开了几束花) [ID:c02_石缝开花]
=> END
~ c02_石壁空间
(石壁另一头好像还有空间) [ID:c02_石壁空间]
=> END
~ c02_民国六年1221
(民国六年十二月二十一日) [ID:c02_民国六年1221]
=> END
~ c02_患者感谢信
(一些患者的感谢信) [ID:c02_患者感谢信]
=> END
~ c02_被撕掉的书
(一本被撕掉的书) [ID:c02_被撕掉的书]
=> END
~ c02_里面有什么东西
(里面有什么东西) [ID:c02_里面有什么东西]
=> END
~ c02_戏台上的诗
(戏台上面刻了一首诗) [ID:c02_戏台上的诗]
=> END
~ c02_锁开了
(锁开了) [ID:c02_锁开了]
=> END
~ c02_口袋里有东西
(口袋里有东西) [ID:c02_口袋里有东西]
=> END
~ c02_雾太大
(雾太大了,看不清路) [ID:c02_雾太大]
=> END
~ c02_八音盒
(是个八音盒) [ID:c02_八音盒]
=>en
~ c02_祝女儿早日康复
(祝女儿早日康复) [ID:c02_祝女儿早日康复]
=> END
~ c02_图案一样
(这图案和我手臂上的一摸一样) [ID:c02_图案一样]
# c03
=> END
=> END
# 获得道具
~ c01_获得令牌

Binary file not shown.

View File

@ -7,6 +7,7 @@ const DEBUG = true
const RES_FILE_FORMAT = ".tres"
## layers
const CANVAS_LAYER_DIALOG = 13
const CANVAS_LAYER_UI = 12
const CANVAS_LAYER_PROP_INSPECTOR = 11
const CANVAS_LAYER_SHADING = 10

View File

@ -28,6 +28,12 @@ func freeze_player(lock_time: float, animation := ""):
else:
printerr("Player node not found")
func release_player():
var player = get_player()
if player:
player.release_player()
else:
printerr("Player node not found")
func set_camera_boundary(rect: Rect2) -> void:
var camera_marker = CameraFocusMarker
@ -71,12 +77,12 @@ func pop_dialog(
printerr("Dialog node not found")
func pop_note(note: String, note_color := "white", duration := 2.5) -> void:
var dialog_node = get_node_or_null("/root/Main/UILayer/Dialog")
if dialog_node:
dialog_node.append_note(note, note_color, duration)
else:
printerr("Dialog node not found")
# func pop_note(note: String, note_color := "white", duration := 2.5) -> void:
# var dialog_node = get_node_or_null("/root/Main/UILayer/Dialog")
# if dialog_node:
# dialog_node.append_note(note, note_color, duration)
# else:
# printerr("Dialog node not found")
func get_inspector() -> PropInspector:

View File

@ -146,7 +146,7 @@ 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")
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/test="zh-Hans"
locale/fallback="zh"

View File

@ -125,6 +125,7 @@ var dialogue_line: DialogueLine:
# await get_tree().create_timer(time).timeout
func _ready() -> void:
layer = GlobalConfig.CANVAS_LAYER_DIALOG
balloon.hide()
Engine.get_singleton("DialogueManager").mutated.connect(_on_mutated)

View File

@ -1,3 +1,4 @@
@tool
extends Sprite2D
# @export var entity_config: EntityConfig:
@ -7,9 +8,13 @@ extends Sprite2D
enum { STATUS_NORAML, STATUS_INSPECTING_COVER, STATUS_INSPECTING_NOTES }
@export var entity_name: String = ""
@export var entity_title: String = ""
@export var texture_cover: Texture2D
@export_multiline var inspection_note: String = ""
@export_enum("none", "c01", "c02", "c03", "c04", "c05", "c06") var editor_filter := "none":
set(val):
editor_filter = val
if is_node_ready():
notify_property_list_changed()
var content_key: String = ""
@onready var sprite2d = %AnimatedSoundSprite2D as AnimatedSoundSprite2D
@onready var sign_mark = %Sign as Sign
@ -20,8 +25,19 @@ enum { STATUS_NORAML, STATUS_INSPECTING_COVER, STATUS_INSPECTING_NOTES }
@onready var content_label = %ContentLabel as Label
@onready var tip_label = %TipLabel as Label
var tip_cover = "Q: 退出 E: 阅读"
var tip_notes = "Q: 退出 E: 收起"
var tip_cover = "Q: " + tr("ui_退出") + " " + "E: " + tr("ui_阅读")
var tip_notes = "Q: " + tr("ui_退出") + " " + "E: " + tr("ui_收起")
static var content_dialogue = (
preload("res://asset/dialogue/inspect_content.dialogue") as DialogueResource
)
static var content_titles = ""
static func _static_init() -> void:
# preload all titles from content_dialogue
content_titles = ",".join(content_dialogue.titles.keys())
var status := STATUS_NORAML
var blinking_tween: Tween
@ -33,7 +49,7 @@ func _ready() -> void:
sign_mark.interacted.connect(_on_interacted)
sign_mark.cancel.connect(_on_cancel)
content_label.text = inspection_note
content_label.text = _get_tr_content()
content_label.modulate.a = 0.0
tip_label.text = tip_cover
tip_label.modulate.a = 0.0
@ -41,6 +57,20 @@ func _ready() -> void:
cover_rect.texture = texture_cover
func _get_tr_content():
if content_key == "":
return ""
var inspection_note = ""
# get note content
var line_id = content_dialogue.titles.get(content_key)
while line_id and line_id != "end":
var line = content_dialogue.lines[line_id]
if line.has("text"):
inspection_note += tr(line.get("text")) + "\n"
line_id = line.get("next_id")
return inspection_note
func _on_interacted() -> void:
# 1s 内锁定交互,留给镜头复位时间
if Time.get_ticks_msec() - inspected_time < 1500:
@ -91,7 +121,43 @@ func _on_cancel(_body = null):
blinking_tween.kill()
tween.parallel().tween_property(tip_label, "modulate:a", 0.0, 0.15)
SceneManager.focus_player_and_reset_zoom(1.0)
var player = SceneManager.get_player()
if player:
player.release_player()
SceneManager.release_player()
sign_mark.show_sign = true
func _set(property: StringName, value: Variant) -> bool:
if property == "content_key":
content_key = value
content_label.text = _get_tr_content()
return true
return false
func _get(property: StringName) -> Variant:
if property == "content_key":
return content_key
return null
func _get_property_list() -> Array[Dictionary]: # only show notes_ properties in editor
if Engine.is_editor_hint() and editor_filter and editor_filter != "none":
var filted_titles = content_dialogue.titles.keys().filter(_filter_property)
return [
{
"name": "note_key",
"type": TYPE_STRING,
"hint": PROPERTY_HINT_ENUM,
"hint_string": ",".join(filted_titles)
}
]
return [
{
"name": "content_key",
"type": TYPE_STRING,
"hint": PROPERTY_HINT_ENUM_SUGGESTION,
"hint_string": content_titles
}
]
func _filter_property(property: StringName) -> bool:
return property.find(editor_filter) >= 0

View File

@ -1,14 +1,35 @@
@tool
extends Sprite2D
# @export var title := ""
@export var notes := [] as Array[String]
@export var dialogs := [] as Array[String]
@export_enum("items", "c01", "c02", "c03", "c04", "c05", "c06") var dialogue := "items":
set(val):
dialogue = val
match dialogue:
"items":
dialogue_res = dialogue_items
"c01":
dialogue_res = dialogue_c01
"c02":
dialogue_res = dialogue_c02
if is_node_ready():
notify_property_list_changed()
var note_key := ""
@export_enum("none", "notes", "c01", "c02", "c03", "c04", "c05", "c06") var editor_filter := "notes":
set(val):
editor_filter = val
if is_node_ready():
notify_property_list_changed()
@onready var sign_mark = %Sign as Sign
@onready var area2d = %Area2D as Area2D
var played_time = 0
var dialogue_items = preload("res://asset/dialogue/item_description.dialogue")
var dialogue_c01 = preload("res://asset/dialogue/c01.dialogue")
var dialogue_c02 = preload("res://asset/dialogue/c02.dialogue")
var dialogue_res = dialogue_items
var interacting = false
var mutex = Mutex.new()
@ -20,32 +41,69 @@ func _ready() -> void:
func _on_interacted() -> void:
if notes.is_empty():
if interacting:
return
var note_time = notes.size() * 2.0
# 0.5s 内锁定播放
mutex.lock()
if Time.get_ticks_msec() - played_time < note_time * 1000 + 500:
mutex.unlock()
if not note_key:
printerr("Note key is not set")
return
# show note
played_time = Time.get_ticks_msec()
mutex.unlock()
%Sfx.play()
SceneManager.focus_node(self)
CameraFocusMarker.tween_zoom(1.1, 1.5)
for note in notes:
SceneManager.pop_note(note, "white", 2.0)
DialogueManager.show_dialogue_balloon(dialogue_res, note_key)
# TODO note viewing animation
SceneManager.freeze_player(note_time, "")
get_tree().create_timer(note_time - 0.5).timeout.connect(
SceneManager.focus_player_and_reset_zoom
)
SceneManager.freeze_player(0, "")
interacting = true
DialogueManager.dialogue_ended.connect(_on_dialogue_ended, CONNECT_ONE_SHOT)
# for note in notes:
# SceneManager.pop_note(note, "white", 2.0)
func _set(property: StringName, value: Variant) -> bool:
if property == "note_key":
note_key = value
return true
return false
func _get(property: StringName) -> Variant:
if property == "note_key":
return note_key
elif property == "dialogue_res":
return dialogue_res
return null
func _get_property_list() -> Array[Dictionary]:
# only show notes_ properties in editor
var titles = ""
if Engine.is_editor_hint() and editor_filter and editor_filter != "none":
var filted_titles = dialogue_res.titles.keys().filter(_filter_property)
titles = ",".join(filted_titles)
else:
titles = ",".join(dialogue_res.titles.keys())
return [
{
"name": "note_key",
"type": TYPE_STRING,
"hint": PROPERTY_HINT_ENUM_SUGGESTION,
"hint_string": titles
}
]
func _filter_property(property: StringName) -> bool:
return property.find(editor_filter) >= 0
func _on_dialogue_ended(_res):
interacting = false
SceneManager.release_player()
SceneManager.focus_player_and_reset_zoom()
func _on_cancel(_body = null):
pass
interacting = false
func _reset(_body):
pass
interacting = false

View File

@ -12,7 +12,8 @@ size = Vector2(40, 60)
[node name="Note" type="Sprite2D"]
script = ExtResource("1_3igk8")
notes = Array[String]([])
editor_filter = "notes_"
note_key = ""
[node name="Sfx" parent="." instance=ExtResource("2_qocmg")]
unique_name_in_owner = true

View File

@ -5,15 +5,15 @@ extends Sprite2D
# entity_config = value
@export var entity_name: String = ""
@export var entity_title: String = ""
@export var note_key: String = ""
@export var texture_cover: Texture2D
@export var texture_note: Texture2D
@export_multiline var inspection_note: String = ""
@onready var sprite2d = %AnimatedSoundSprite2D as AnimatedSoundSprite2D
@onready var sign_mark = %Sign as Sign
@onready var area2d = %Area2D as Area2D
var content_res = preload("res://asset/dialogue/inspect_content.dialogue") as DialogueResource
var inspecting = false
@ -41,10 +41,21 @@ func _on_interacted() -> void:
inspector.quit.connect(_on_quit_inspector)
if not texture_note:
texture_note = texture_cover
var inspection_note = _get_tr_content()
inspector.pop_inspection(texture_cover, texture_note, inspection_note)
inspecting = true
sign_mark.show_sign = false
func _get_tr_content():
var inspection_note = ""
# get note content
var line_id = content_res.titles.get(note_key)
while line_id and line_id != "end":
var line = content_res.lines[line_id]
if line.has("text"):
inspection_note += tr(line.get("text")) + "\n"
line_id = line.get("next_id")
return inspection_note
func _on_quit_inspector():
var inspector = SceneManager.get_inspector()

View File

@ -1,51 +0,0 @@
[gd_scene load_steps=10 format=3 uid="uid://e381spnutx62"]
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_klnwh"]
[ext_resource type="Script" path="res://config/deploy/scene_config.gd" id="2_kijni"]
[ext_resource type="PackedScene" uid="uid://0sofmhrl358m" path="res://scene/entity/npc.tscn" id="2_upqk5"]
[ext_resource type="PackedScene" uid="uid://jr1yd46wm5je" path="res://scene/entity/note.tscn" id="3_heu4h"]
[ext_resource type="PackedScene" uid="uid://wyj4qdjyn4ql" path="res://scene/entity/old/inspectable.tscn" id="5_pirce"]
[ext_resource type="PackedScene" uid="uid://bnf3lkcbpx1ar" path="res://scene/entity/ambush.tscn" id="6_fiskb"]
[ext_resource type="PackedScene" uid="uid://bj4ufua0b0k34" path="res://scene/entity/hd_entity.tscn" id="7_l4pco"]
[ext_resource type="Texture2D" uid="uid://b0gti8fx40hph" path="res://asset/art/scene/c01/s04_旧版序章/e_树.png" id="8_6dlbe"]
[sub_resource type="Resource" id="Resource_dcaa4"]
resource_local_to_scene = true
script = ExtResource("2_kijni")
player_y_fixed = true
player_y = 45
footstep_type = "concrete"
bgm = ""
[node name="S00" type="Node2D"]
[node name="Ground" parent="." instance=ExtResource("1_klnwh")]
scene_config = SubResource("Resource_dcaa4")
[node name="Npc" parent="Ground/DeployLayer" index="0" instance=ExtResource("2_upqk5")]
position = Vector2(465, 23)
[node name="Note" parent="Ground/DeployLayer" index="1" instance=ExtResource("3_heu4h")]
position = Vector2(268, -36)
notes = Array[String](["(门牌号: 1012)", "(似乎是用血来写的)"])
[node name="Inspectable" parent="Ground/DeployLayer" index="2" instance=ExtResource("5_pirce")]
position = Vector2(376, 36)
[node name="Ambush" parent="Ground/DeployLayer" index="3" instance=ExtResource("6_fiskb")]
position = Vector2(567, 28)
hook_cg = "c02_胖子说话"
[node name="HdEntity" parent="Ground/DeployLayer" index="4" node_paths=PackedStringArray("sprite_ref") instance=ExtResource("7_l4pco")]
position = Vector2(259, 52)
sprite_name = "tree"
texture = ExtResource("8_6dlbe")
sprite_ref = NodePath("../../SubViewportContainer/SubViewport/HdLayer/tree")
[node name="PortalLeft" parent="Ground/DeployLayer" index="5"]
target_portal = "right"
[node name="PortalRight" parent="Ground/DeployLayer" index="6"]
target_portal = "left"
[editable path="Ground"]

View File

@ -1,10 +1,9 @@
[gd_scene load_steps=8 format=3 uid="uid://bbs7yy5aofw1v"]
[gd_scene load_steps=7 format=3 uid="uid://bbs7yy5aofw1v"]
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_gdcov"]
[ext_resource type="Script" path="res://config/deploy/scene_config.gd" id="2_j6mie"]
[ext_resource type="Texture2D" uid="uid://kc4726andgy2" path="res://asset/art/scene/c02/s01_街道/bg_公寓入口.png" id="2_ni1a4"]
[ext_resource type="PackedScene" uid="uid://jr1yd46wm5je" path="res://scene/entity/note.tscn" id="3_6lnxd"]
[ext_resource type="PackedScene" uid="uid://wyj4qdjyn4ql" path="res://scene/entity/old/inspectable.tscn" id="5_g5fsn"]
[ext_resource type="PackedScene" uid="uid://bnf3lkcbpx1ar" path="res://scene/entity/ambush.tscn" id="6_vgxa0"]
[sub_resource type="Resource" id="Resource_p1xa1"]
@ -33,10 +32,14 @@ target_portal = "left"
[node name="Note" parent="Ground/DeployLayer" index="2" instance=ExtResource("3_6lnxd")]
position = Vector2(250, -22)
notes = Array[String](["(似乎是一张寻人启示)", "(脸的部分被撕掉了,打不开)"])
editor_filter = "c02"
note_key = "c02_寻人启事"
[node name="Inspectable" parent="Ground/DeployLayer" index="3" instance=ExtResource("5_g5fsn")]
position = Vector2(311, -7)
[node name="Note门口" parent="Ground/DeployLayer" index="3" instance=ExtResource("3_6lnxd")]
position = Vector2(311, -27)
dialogue = "c02"
editor_filter = "c02"
note_key = "c02_s01_menpai"
[node name="Ambush" parent="Ground/DeployLayer" index="4" instance=ExtResource("6_vgxa0")]
position = Vector2(135, 56)

View File

@ -1,11 +1,10 @@
[gd_scene load_steps=16 format=3 uid="uid://brck77w81fhvc"]
[gd_scene load_steps=15 format=3 uid="uid://brck77w81fhvc"]
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_wrr6r"]
[ext_resource type="Script" path="res://config/deploy/scene_config.gd" id="2_757mj"]
[ext_resource type="Texture2D" uid="uid://c4647gof464ws" path="res://asset/art/scene/c02/s02_走道/bg_过道.png" id="2_cn1s8"]
[ext_resource type="PackedScene" uid="uid://jr1yd46wm5je" path="res://scene/entity/note.tscn" id="3_fy0o1"]
[ext_resource type="PackedScene" uid="uid://wyj4qdjyn4ql" path="res://scene/entity/old/inspectable.tscn" id="5_nhtbp"]
[ext_resource type="Texture2D" uid="uid://do8quqgkrwahj" path="res://asset/art/scene/c02/s02_走道/ux_进门鼠疫海报wz.png" id="6_4pcq0"]
[ext_resource type="PackedScene" uid="uid://bnf3lkcbpx1ar" path="res://scene/entity/ambush.tscn" id="6_70vqn"]
[ext_resource type="Texture2D" uid="uid://ds4yw1wqelhm1" path="res://asset/art/scene/c02/s02_走道/ux_进门鼠疫海报yz.png" id="7_wdwbi"]
[ext_resource type="Texture2D" uid="uid://dd0sn5e4hwq5m" path="res://asset/art/scene/c02/s02_走道/e_纸人.png" id="7_xsghn"]
@ -46,31 +45,15 @@ target_portal = "left"
[node name="几张卫生宣传画" parent="Ground/DeployLayer" index="2" instance=ExtResource("3_fy0o1")]
position = Vector2(275, -30)
notes = Array[String](["(几张卫生宣传画)"])
dialogue = null
editor_filter = "c01"
[node name="鼠疫海报" parent="Ground/DeployLayer" index="3" instance=ExtResource("5_nhtbp")]
position = Vector2(441, -20)
flip_h = true
entity_title = "(鼠疫海报)"
texture_cover = ExtResource("6_4pcq0")
texture_note = ExtResource("7_wdwbi")
inspection_note = "据闻奉贤县分水墩又有七人染受鼠疫,病状可怖,闻医官药治无用,免职。
有地方人称鼠疫为妖邪作祟,甚为惊骇,一时人心惶惶,竟有聚众滋闹之事,政府以防疫事宜关系紧要,拟赴分水墩一带调查防疫事宜云。
《申报》
民国五年一月十三日"
[node name="鼠疫海报local" parent="Ground/DeployLayer" index="4" instance=ExtResource("12_0fckv")]
position = Vector2(387, -25)
entity_title = "鼠疫海报"
[node name="鼠疫海报" parent="Ground/DeployLayer" index="3" instance=ExtResource("12_0fckv")]
position = Vector2(440, -21)
texture_cover = ExtResource("7_wdwbi")
inspection_note = "据闻奉贤县分水墩又有七人染受鼠疫,病状可怖,闻医官药治无用,免职。
有地方人称鼠疫为妖邪作祟,甚为惊骇,一时人心惶惶,竟有聚众滋闹之事,政府以防疫事宜关系紧要,拟赴分水墩一带调查防疫事宜云。
content_key = "c02_鼠疫海报"
《申报》
民国五年一月十三日"
[node name="纸人" parent="Ground/DeployLayer" index="5" instance=ExtResource("5_nhtbp")]
[node name="纸人" parent="Ground/DeployLayer" index="4" instance=ExtResource("5_nhtbp")]
position = Vector2(601, 44)
texture = ExtResource("7_xsghn")
flip_h = true
@ -82,11 +65,11 @@ collision_mask = 0
[node name="CollisionShape2D" type="CollisionShape2D" parent="Ground/DeployLayer/纸人/StaticBody2D"]
shape = SubResource("RectangleShape2D_0xrg2")
[node name="Ambush" parent="Ground/DeployLayer" index="6" instance=ExtResource("6_70vqn")]
[node name="Ambush" parent="Ground/DeployLayer" index="5" instance=ExtResource("6_70vqn")]
position = Vector2(502, 56)
hook_cg = "c02_胖子说话"
[node name="HdEntity" parent="Ground/DeployLayer" index="7" node_paths=PackedStringArray("sprite_ref") instance=ExtResource("10_3c313")]
[node name="HdEntity" parent="Ground/DeployLayer" index="6" node_paths=PackedStringArray("sprite_ref") instance=ExtResource("10_3c313")]
position = Vector2(147, 75)
sprite_name = "car"
texture = ExtResource("11_x0h3x")

View File

@ -45,7 +45,6 @@ position = Vector2(465, 23)
[node name="Note" parent="Ground/DeployLayer" index="3" instance=ExtResource("3_6x7xl")]
position = Vector2(268, -36)
notes = Array[String](["(门牌号: 1012)", "(似乎是用血来写的)"])
[node name="Inspectable" parent="Ground/DeployLayer" index="4" instance=ExtResource("5_0xh53")]
position = Vector2(376, 36)

View File

@ -6,9 +6,8 @@ class_name PropHud extends Control
set(value):
if value:
add_item = false
add_prop_item(item_name, item_title, item_texture)
@export var item_name: String
@export var item_title: String
add_prop_item(item_key, item_texture)
@export var item_key: String
@export_file("*.png") var item_texture: String
@export_group("Inventory")
@export var inventory: PropInventory
@ -81,8 +80,8 @@ func _load_texture_cache() -> void:
return
cached_inventory_textures.clear()
for i in inventory.items:
if i and i.name and i.texture_path:
cached_inventory_textures[i.name] = load(i.texture_path)
if i and i.key and i.texture_path:
cached_inventory_textures[i.key] = load(i.texture_path)
func _update_prop_display_with_texture():
@ -96,11 +95,11 @@ func _update_prop_display_with_texture():
prop.texture = null
push_error("PropItem is null! index=" + str(inventory.current_index))
return
if item.name in cached_inventory_textures:
prop.texture = cached_inventory_textures[item.name]
if item.key in cached_inventory_textures:
prop.texture = cached_inventory_textures[item.key]
else:
prop.texture = null
title_label.text = item.title
title_label.text = tr(item.key)
func on_left_pressed() -> void:
@ -163,6 +162,7 @@ func _unhandled_input(event: InputEvent) -> void:
on_right_pressed()
get_viewport().set_input_as_handled()
func _input(event: InputEvent) -> void:
if locked:
return
@ -202,9 +202,9 @@ func _toggle_btn_ability(v: bool) -> void:
right_btn.disabled = !v
func add_prop_item(prop_name: String, prop_title: String, texture_path: String) -> void:
if not inventory or not prop_name or not texture_path:
func add_prop_item(prop_key: String, texture_path: String) -> void:
if not inventory or not prop_key or not texture_path:
return
inventory.add_item(prop_name, prop_title, texture_path)
inventory.add_item(prop_key, texture_path)
_load_texture_cache()
_update_prop_display_with_texture()

View File

@ -4,10 +4,9 @@ class_name PropInventory extends Resource
@export var current_index := 0
func add_item(name: String, prop_title: String, texture_path: String) -> void:
func add_item(prop_key: String, texture_path: String) -> void:
var item = PropItem.new()
item.name = name
item.title = prop_title
item.key = prop_key
item.texture_path = texture_path
items.push_back(item)
emit_changed()

View File

@ -1,6 +1,5 @@
class_name PropItem extends Resource
# unique name
@export var name := ""
@export var title := ""
@export var key := ""
@export_file("*.png") var texture_path := ""

View File

@ -1,9 +1,9 @@
extends Node2D
@export var scene_config: SceneConfig:
@export var locale := "":
set(val):
scene_config = val
_load_scene_config()
TranslationServer.set_locale(val)
locale = val
func _ready() -> void:
@ -12,12 +12,3 @@ func _ready() -> void:
$UILayer.layer = GlobalConfig.CANVAS_LAYER_UI
%ColorRectTop.visible = true
%ColorRectBottom.visible = true
_load_scene_config()
DialogueManager.show_dialogue_balloon(
preload("res://asset/dialogue/c01.dialogue"), "c01_s01_heiwu"
)
func _load_scene_config() -> void:
if !scene_config:
return

View File

@ -1,8 +1,7 @@
[gd_scene load_steps=11 format=3 uid="uid://dygvcmykn02n8"]
[gd_scene load_steps=10 format=3 uid="uid://dygvcmykn02n8"]
[ext_resource type="Script" path="res://scene/main.gd" id="1_pks84"]
[ext_resource type="PackedScene" uid="uid://3gk1gxwanw24" path="res://scene/shading/shading_layer.tscn" id="2_d1re1"]
[ext_resource type="PackedScene" uid="uid://dmkt1roqc4he7" path="res://scene/dialog/dialog.tscn" id="3_prpss"]
[ext_resource type="PackedScene" uid="uid://dc778gsjfr3ky" path="res://scene/hud/prop_hud.tscn" id="4_t7gb2"]
[ext_resource type="PackedScene" uid="uid://5g07x6q7wwr1" path="res://scene/notification/notification.tscn" id="5_3gg5t"]
[ext_resource type="PackedScene" uid="uid://cekhj65axie0p" path="res://scene/popup/prop_inspector.tscn" id="5_ux0rw"]
@ -13,14 +12,13 @@
[node name="Main" type="Node2D"]
script = ExtResource("1_pks84")
locale = "en"
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = ExtResource("9_jsof5")
[node name="GroundLoader" parent="." instance=ExtResource("10_8rc5n")]
position = Vector2(1, 0)
ignore_archive = true
current_scene = "c02_s02"
[node name="MainPlayer" parent="." instance=ExtResource("6_6geb0")]
unique_name_in_owner = true
@ -67,12 +65,6 @@ grow_vertical = 0
mouse_filter = 2
color = Color(0, 0, 0, 1)
[node name="Dialog" parent="UILayer" instance=ExtResource("3_prpss")]
offset_left = -230.0
offset_top = -70.0
offset_right = 230.0
metadata/_edit_use_anchors_ = true
[node name="Notification" parent="UILayer" instance=ExtResource("5_3gg5t")]
offset_left = -12.0
offset_top = -2.0
@ -82,6 +74,7 @@ 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")]

View File

@ -38,9 +38,7 @@ func _hide():
blinking_tween.stop()
tween.parallel().tween_property(tip_label, "modulate:a", 0.0, 0.15)
tween.tween_callback(_post_hide)
var player = SceneManager.get_player()
if player:
player.release_player()
SceneManager.release_player()
func _post_hide():