diff --git a/asset/dialogue/item_description.csv b/asset/dialogue/item_description.csv index 1d4622c1..de2f698f 100644 --- a/asset/dialogue/item_description.csv +++ b/asset/dialogue/item_description.csv @@ -47,7 +47,7 @@ input_拼凑信件,点击选择信件碎片,方向键移动,E 旋转碎片 input_书架游戏,点击书本可选中或交换,Q 退出,,,,,"Click books to select or swap, Q to exit" ui_click_to_knock_door,鼠标点击可敲门,,,,,Click to knock the door. ui_click_to_knock_door_screen,点击可敲门,,,,,Click to knock the door. -ui_获得道具,获得道具,,,,,Item Obtained +ui_获得,获得,,,,,Obtained ui_退出,退出,,,,,Exit ui_阅读,阅读,,,,,Read ui_检阅,检阅,,,,,Examine @@ -119,8 +119,10 @@ prop_眼镜盒,眼镜盒,,,[#texture=c02/眼镜盒.png],,Glasses Case prop_眼镜盒_说明,这副眼镜对我很重要。{br}记得小时候在浦育院的日子,我经常会在半夜时听到奇怪的说话声,还时不时能看见其他小孩子看不见的东西。{br}院长不知从哪儿找来了这样一副眼镜,戴上它后那些怪事就很少发生。{br}随着年龄增长,我几乎已用不到这副眼镜。现在它对我来说似乎有了新的意义。,,,,,"These glasses are very important to me.{br}I remember during my childhood at Puyu Orphanage, I would often hear strange voices at midnight and sometimes see things other children couldn't see.{br}The director found these glasses somewhere. After wearing them, those strange occurrences rarely happened.{br}As I grew older, I hardly needed these glasses anymore. Now they seem to have taken on new meaning for me." prop_小蝉人偶,小蝉人偶,,,[#texture=c02/小蝉人偶.png],,Little Chan Doll prop_小蝉人偶_说明,小小的人儿,小小的鞋子,小小的友情啊——像蝶依偎着花。,,,,,"Little person, little shoes, little friendship—like a butterfly nestled against a flower." +prop_小蝉人偶_详情,skip,,,,, prop_单只小鞋子,一只小鞋子,,,[#texture=c02/小鞋子1.png],,A Single Small Shoe prop_单只小鞋子_说明,这只小鞋子曾经属于一个裹了小脚的女孩。{br}鞋不成双,祸事难防。,,,,,"This small shoe once belonged to a girl with bound feet.{br}When shoes don't come in pairs, misfortune is hard to prevent." +prop_单只小鞋子_详情,skip,,,,, c01_s05_检查院长房间,好像忘记了什么事情,再回去检查一遍吧。,,ID格式: prop_xx_说明,,,I feel like I've forgotten something. Let me go back and check again. c01_s07_需要报纸,书店还没开门。,,,,,The bookstore isn't open yet. c01_s08_书店工作,老板交代的工作还没做完,不能偷懒。,,,,,I haven't finished the work the boss assigned. I can't slack off. diff --git a/asset/dialogue/item_description.dialogue b/asset/dialogue/item_description.dialogue index 64207f2d..d5249492 100644 --- a/asset/dialogue/item_description.dialogue +++ b/asset/dialogue/item_description.dialogue @@ -58,7 +58,7 @@ 鼠标点击可敲门[ID:ui_click_to_knock_door] 点击可敲门[ID:ui_click_to_knock_door_screen] -获得道具[ID:ui_获得道具] +获得[ID:ui_获得] 退出[ID:ui_退出] 阅读[ID:ui_阅读] 检阅[ID:ui_检阅] @@ -157,8 +157,10 @@ 这副眼镜对我很重要。{br}记得小时候在浦育院的日子,我经常会在半夜时听到奇怪的说话声,还时不时能看见其他小孩子看不见的东西。{br}院长不知从哪儿找来了这样一副眼镜,戴上它后那些怪事就很少发生。{br}随着年龄增长,我几乎已用不到这副眼镜。现在它对我来说似乎有了新的意义。[ID:prop_眼镜盒_说明] 小蝉人偶[#texture=c02/小蝉人偶.png][ID:prop_小蝉人偶] 小小的人儿,小小的鞋子,小小的友情啊——像蝶依偎着花。[ID:prop_小蝉人偶_说明] +skip[ID:prop_小蝉人偶_详情] 一只小鞋子[#texture=c02/小鞋子1.png][ID:prop_单只小鞋子] 这只小鞋子曾经属于一个裹了小脚的女孩。{br}鞋不成双,祸事难防。[ID:prop_单只小鞋子_说明] +skip[ID:prop_单只小鞋子_详情] => END #~ prop说明 diff --git a/manager/archive_manager/archive_manager.gd b/manager/archive_manager/archive_manager.gd index 5780b5be..4db569a3 100644 --- a/manager/archive_manager/archive_manager.gd +++ b/manager/archive_manager/archive_manager.gd @@ -30,6 +30,8 @@ var archives_dict: Dictionary[int, AssembledArchive] = {} var archives_notes_dict: Dictionary[int, String] = {} var autosave_timer := Timer.new() +# 供运行时缓存跨场景数据 +var _runtime_global_dictionary: Dictionary[String, Variant] = {} func _ready() -> void: # 禁用默认退出行为,在 _notification 处理 NOTIFICATION_WM_CLOSE_REQUEST 时保存数据 @@ -369,3 +371,20 @@ func unlock_memory(id: int) -> void: return archive.mem_display_dict[id] = true SceneManager.pop_notification("ui_notify_mem_update") + + +# 供运行时缓存跨场景数据 +func runtime_set(key: String, value: Variant) -> void: + _runtime_global_dictionary[key] = value + + +func runtime_get(key: String, default_value: Variant = null) -> Variant: + return _runtime_global_dictionary.get(key, default_value) + + +func runtime_has(key: String) -> bool: + return _runtime_global_dictionary.has(key) + + +func runtime_remove(key: String) -> void: + _runtime_global_dictionary.erase(key) diff --git a/scene/entity/npc.tscn b/scene/entity/npc.tscn index 0643d8bb..340e688a 100644 --- a/scene/entity/npc.tscn +++ b/scene/entity/npc.tscn @@ -136,7 +136,7 @@ unique_name_in_owner = true modulate = Color(0.753984, 0.753984, 0.753984, 1) z_index = 100 position = Vector2(0, -60) -scale = Vector2(0.07, 0.07) +scale = Vector2(0.05, 0.05) [node name="Sprite2D" type="AnimatedSprite2D" parent="SpeakingSign2D"] light_mask = 16 diff --git a/scene/ground/scene/c01/s05_院长房间.gd b/scene/ground/scene/c01/s05_院长房间.gd index 31b643e4..115c6f61 100644 --- a/scene/ground/scene/c01/s05_院长房间.gd +++ b/scene/ground/scene/c01/s05_院长房间.gd @@ -189,6 +189,10 @@ var help_tween_paused := false func show_interact_help(): + const shown_key = "c02_s05_has_shown_tip" + if ArchiveManager.runtime_get(shown_key): + return + ArchiveManager.runtime_set(shown_key, true) tip.modulate.a = 0.0 tip.show() SceneManager.lock_player() diff --git a/scene/ux/prop_hud.gd b/scene/ux/prop_hud.gd index 8c733fe1..d59b126a 100644 --- a/scene/ux/prop_hud.gd +++ b/scene/ux/prop_hud.gd @@ -174,6 +174,15 @@ func get_item_description(prop_key: String) -> String: return tr(prop_key + "_说明").replace("{br}", "\n") +func get_bag_item_description(prop_key: String) -> String: + # 优先访问 _背包说明, if null then _说明 + var tr_key = prop_key + "_背包说明" + var content = tr(tr_key) + if content == tr_key: + return tr(prop_key + "_说明").replace("{br}", "\n") + return content.replace("{br}", "\n") + + func _reload_cache_and_realign_display() -> void: if ArchiveManager.archive: inventory = ArchiveManager.archive.prop_inventory @@ -592,13 +601,24 @@ func inspect_item(prop_key: String, display_obtained := true, as_important_item printerr("prophud inspect_item invalid texture for key:", prop_key) return if as_important_item: - var content = get_item_description(prop_key) - var wide = len(content) > 150 - inspector.pop_standard_inspection(texture, null, content, false, wide) + # skip | show + var display_mode = tr(prop_key + "_详情") + inspector.pop_prop_inspection(prop_key, texture, true) + # 重要物品可能展示检阅界面 + if display_mode == "show": + var content = get_item_description(prop_key) + inspector.hiding_tween_started.connect(_post_display_detail.bind(texture, content), CONNECT_ONE_SHOT) else: inspector.pop_prop_inspection(prop_key, texture, display_obtained) +# 重要物品可能展示检阅界面 +func _post_display_detail(texture, content) -> void: + var wide = len(content) > 150 + var inspector = SceneManager.get_inspector() as PropInspector + inspector.pop_standard_inspection(texture, null, content, false, wide) + + func disable_prop_item(prop_key: String) -> void: if not inventory or not prop_key: return diff --git a/scene/ux/prop_inspector.gd b/scene/ux/prop_inspector.gd index ae8953b2..60da2cd6 100644 --- a/scene/ux/prop_inspector.gd +++ b/scene/ux/prop_inspector.gd @@ -8,6 +8,7 @@ enum { STATUS_INSPECTING_NOTES } +signal hiding_tween_started signal quit_and_hidden @onready var mouse_mask = %MouseMask as Control @@ -64,11 +65,10 @@ func _hide(): blinking_tween.kill() hiding_tween.parallel().tween_property(tip_label, "modulate:a", 0.0, 0.15) hiding_tween.tween_callback(_post_hide) - + # 在状态设置后发送信号 + hiding_tween_started.emit() func _post_hide(): - # hiding_tween 被 kill 的时候需要调用 _post_hide 或 quit_and_hidden.emit() - quit_and_hidden.emit() scroll_container.mouse_filter = Control.MOUSE_FILTER_IGNORE locking = false full_texture.texture = null @@ -78,6 +78,8 @@ func _post_hide(): tip_label.text = tip_cover notes_bg.visible = false visible = false + # hiding_tween 被 kill 的时候需要调用 _post_hide 或 quit_and_hidden.emit() + quit_and_hidden.emit() func _blink_label(init := true): @@ -169,7 +171,7 @@ func pop_prop_inspection( # 缩略只要第一行 var content = original_word_lines[0] + ("..." if len(original_word_lines) > 1 else "") if display_obtained: - var obtain_str = tr("ui_获得道具") + var obtain_str = tr("ui_获得") inspector_balloon.show_prop_balloon(obtain_str, prop_title, content) else: inspector_balloon.show_prop_content(content)