diff --git a/asset/dialogue/item_description.csv b/asset/dialogue/item_description.csv index d9ceb701..1d47f1b7 100644 --- a/asset/dialogue/item_description.csv +++ b/asset/dialogue/item_description.csv @@ -1,4 +1,5 @@ keys,zh_CN,_character,_notes,_tags,zh_SH,en +prop_小猫玩具完整,小猫玩具,,,[#texture=c02/新小猫全身.png],,Cat Toy index_新游戏,新游戏,,,,,New Game index_继续游戏,继续游戏,,,,,Continue index_退出游戏,退出游戏,,,,,Exit Game @@ -40,7 +41,8 @@ ui_press_shift,按住 Shift 奔跑,,,,,Hold Shift to run ui_boxcat_press_s,按住 S 躲藏,,,,,Hold S to hide input_拼凑信件,点击选择信件碎片,方向键移动,E 旋碎片转,Q 退出,,,,,"Click to select letter fragments, arrow keys to move, E to rotate, Q to exit" input_书架游戏,点击书本可选中或交换,Q 退出,,,,,"Click books to select or swap, Q to exit" -ui_获得,获得,,,,,Obtained +ui_获得道具,获得道具,,,,,"Item Obtained" +ui_获得重要物品,重要物品,,,,,"Important Item" ui_退出,退出,,,,,Exit ui_阅读,阅读,,,,,Read ui_检阅,检阅,,,,,Examine @@ -64,7 +66,7 @@ prop_小猫玩具的脑袋,小猫玩具的脑袋,,,[#texture=c02/新小猫头.pn prop_小猫玩具的脑袋_说明,某个玩具的部件,有些眼熟,,,,,"Part of some toy, looks familiar" prop_无头小猫玩具,无头小猫玩具,,,[#texture=c02/新小猫身体.png][#inspect=c02/新小猫身体_特写.png],,Headless Cat Toy prop_无头小猫玩具_说明,没有脑袋的小猫玩偶,针脚歪歪扭扭,不甚熟练,,,,,"A headless cat doll with crooked, unskilled stitching" -prop_小猫玩具完整,小猫玩具,,,[#texture=c02/新小猫全身.png],,Cat Toy +小猫玩具 [ID:],小猫玩具 [ID:],,,[#texture=c02/新小猫全身.png],, prop_小猫玩具完整_说明,这个玩具看久了有些眼熟,,,,,This toy looks familiar after staring at it for a while prop_撕下的照片上,撕下的照片(上),,,[#texture=c02/照片_上.png],,Torn Photo (Upper) prop_撕下的照片上_说明,女儿生辰纪念 于 民国元年,,,,,"Daughter's Birthday Memorial, Year 1 of the Republic" @@ -187,7 +189,7 @@ c02_小蝉盒子特写,我会在盒子里一直陪着你 :3,,,,,I'll stay with y c02_小蝉恨他们,我恨他们!,,,,,I hate them! c02_火灾等待准备,还没准备好点火呢,,,,,Not ready to start the fire yet c02_霸凌救小蝉开始,啊!我得想办法帮帮她...,,,,,Ah! I need to find a way to help her... -c02_点火前阻止右移,没时间浪费了,我得点个火引走这些小孩,,,,,"There's no time to waste! I have to light a fire to scare these kids away." +c02_点火前阻止右移,没时间浪费了,我得点个火引走这些小孩,,,,,There's no time to waste! I have to light a fire to scare these kids away. c02_看到小蝉上楼,?!,,,,,?! c02_看到杂物堆消失,楼梯口的杂物消失了...,,,,,The clutter at the stairway has disappeared... c02_demo感谢试玩,感谢试玩,,,,,Thank you for playing diff --git a/asset/dialogue/item_description.dialogue b/asset/dialogue/item_description.dialogue index 008cee16..c0db6bb0 100644 --- a/asset/dialogue/item_description.dialogue +++ b/asset/dialogue/item_description.dialogue @@ -50,7 +50,8 @@ 点击选择信件碎片,方向键移动,E 旋碎片转,Q 退出 [ID:input_拼凑信件] 点击书本可选中或交换,Q 退出 [ID:input_书架游戏] -获得 [ID:ui_获得] +获得道具 [ID:ui_获得道具] +重要物品 [ID:ui_获得重要物品] 退出 [ID:ui_退出] 阅读 [ID:ui_阅读] 检阅 [ID:ui_检阅] @@ -84,7 +85,7 @@ 某个玩具的部件,有些眼熟[ID:prop_小猫玩具的脑袋_说明] 无头小猫玩具 [#texture=c02/新小猫身体.png] [#inspect=c02/新小猫身体_特写.png] [ID:prop_无头小猫玩具] 没有脑袋的小猫玩偶,针脚歪歪扭扭,不甚熟练 [ID:prop_无头小猫玩具_说明] -小猫玩具 [#texture=c02/新小猫全身.png] [ID:prop_小猫玩具完整] +小猫玩具 [#texture=c02/新小猫全身.png] [ID:] 这个玩具看久了有些眼熟[ID:prop_小猫玩具完整_说明] 撕下的照片(上) [#texture=c02/照片_上.png] [ID:prop_撕下的照片上] 女儿生辰纪念 于 民国元年 [ID:prop_撕下的照片上_说明] diff --git a/manager/scene/scene_manager.gd b/manager/scene/scene_manager.gd index 1145651d..20b5e3f1 100644 --- a/manager/scene/scene_manager.gd +++ b/manager/scene/scene_manager.gd @@ -206,9 +206,7 @@ func enable_prop_item(prop_key: String) -> void: func enable_important_item(prop_key: String, display_inspector = true) -> void: var prop_hud = get_prop_hud() if prop_hud: - prop_hud.inventory.enable_important_item(prop_key) - # if display_inspector: - # prop_hud.display_inspector(prop_key) + prop_hud.enable_important_item(prop_key, display_inspector) else: printerr("enable_important_item PropHud node not found") diff --git a/scene/ground/scene/animation_root.gd b/scene/ground/scene/animation_root.gd index 27ef4036..34b96c7a 100644 --- a/scene/ground/scene/animation_root.gd +++ b/scene/ground/scene/animation_root.gd @@ -333,7 +333,7 @@ func _find_props(props: Dictionary, node: Node) -> void: props[child.prop_key3] = true print("Find Interactable2D prop3: " + child.prop_key3) elif child is Pickable2D: - if child.prop_key != &"": + if child.prop_key != &"" and not child.as_important_item: props[child.prop_key] = true print("Find Pickable2D prop: " + child.prop_key) _find_props(props, child) diff --git a/scene/ground/scene/c01/s12_书店外_诡异版.gd b/scene/ground/scene/c01/s12_书店外_诡异版.gd index 3ff95dff..206e0a91 100644 --- a/scene/ground/scene/c01/s12_书店外_诡异版.gd +++ b/scene/ground/scene/c01/s12_书店外_诡异版.gd @@ -154,6 +154,10 @@ func player_been_catched(transition := true) -> void: ghost.global_position.x = ghost_start_x + 100.0 SceneManager.get_player().global_position.x = player_start_x await SceneManager.toggle_ground_mask(false).finished + else: + # reset player and ghost position + ghost.global_position.x = ghost_start_x + 100.0 + SceneManager.get_player().global_position.x = player_start_x _ghost_appear_sfx() DialogueManager.show_dialogue_balloon(dialogue_c01, "c01_s12_鬼差来了") await DialogueManager.dialogue_ended diff --git a/scene/ground/scene/c02/s10_空房间.gd b/scene/ground/scene/c02/s10_空房间.gd index 7b696848..1145ee9d 100644 --- a/scene/ground/scene/c02/s10_空房间.gd +++ b/scene/ground/scene/c02/s10_空房间.gd @@ -83,8 +83,8 @@ func _on_ground_ready() -> void: counter.enabled = false else: # 空柜子 x 坐标 - var counter_x = ArchiveManager.get_global_value(&"c02_counter_x", default_counter_x) - if counter_x < 0: + var counter_x = float(ArchiveManager.get_global_value(&"c02_counter_x", default_counter_x)) + if counter_x <= 0: counter_x = default_counter_x counter.interacted.connect(_on_counter_interacted) counter.global_position.x = counter_x @@ -206,12 +206,14 @@ func after_counter_moved(): func _on_pick_catty_head() -> void: if SceneManager.has_prop("prop_无头小猫玩具"): + print("拼接小猫玩具...") SceneManager.lock_player() var inspector = SceneManager.get_inspector() await inspector.quit_and_hidden # 将小猫头与身子合并 SceneManager.disable_prop_item("prop_小猫玩具的脑袋") SceneManager.disable_prop_item("prop_无头小猫玩具") + SceneManager.enable_prop_item_silently("prop_小猫玩具完整") var sprite = $"../DeployLayer/拼接小猫玩具" sprite.visible = true sprite.play() diff --git a/scene/ground/script/c01/s10_鬼差探头.tscn b/scene/ground/script/c01/s10_鬼差探头.tscn index a75baa5a..ec60561e 100644 --- a/scene/ground/script/c01/s10_鬼差探头.tscn +++ b/scene/ground/script/c01/s10_鬼差探头.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=14 format=3 uid="uid://bf6oxxe2e6vxj"] +[gd_scene load_steps=15 format=3 uid="uid://bf6oxxe2e6vxj"] [ext_resource type="Script" uid="uid://bgffnekpvw8pu" path="res://scene/ground/script/c01/s10_鬼差探头.gd" id="1_pvnth"] [ext_resource type="Texture2D" uid="uid://cfh7riig4cnpa" path="res://asset/art/scene/c01/s10_公寓过道/ux_鬼差背景.png" id="2_k54st"] @@ -9,6 +9,7 @@ [ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/audio/sfx.gd" id="5_ug335"] [ext_resource type="AudioStream" uid="uid://b8rg7adnnkjll" path="res://asset/audio/BGM/戏曲声.wav" id="7_72vl6"] [ext_resource type="AudioStream" uid="uid://bi6gm533oqsa" path="res://asset/audio/BGM/街道背景音.wav" id="8_vputk"] +[ext_resource type="Texture2D" uid="uid://cbql1i4hblmt1" path="res://asset/art/ui/遮罩/inspect特写通用遮罩.png" id="10_k54st"] [sub_resource type="Animation" id="Animation_ug335"] length = 0.001 @@ -126,3 +127,12 @@ stream = SubResource("AudioStreamSynchronized_k54st") bus = &"game_sfx" script = ExtResource("5_ug335") metadata/_custom_type_script = "uid://rq6w1vuhuq1m" + +[node name="TextureRect" type="TextureRect" parent="."] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +texture = ExtResource("10_k54st") diff --git a/scene/ux/prop_hud.gd b/scene/ux/prop_hud.gd index 26eb6bbd..09f378cc 100644 --- a/scene/ux/prop_hud.gd +++ b/scene/ux/prop_hud.gd @@ -325,7 +325,7 @@ func _on_prop_inspected(id := 0) -> void: prop_key = inventory.current_item_key() if prop_key: sfx_inspect.play() - inspect_item(prop_key, true) + inspect_item(prop_key, false) func _on_prop_pressed(id := 0) -> void: @@ -460,8 +460,21 @@ func _toggle_btn_ability(v: bool) -> void: right_btn.disabled = !v +func enable_important_item(prop_key: String, display_inspector: bool) -> void: + if not inventory or not prop_key: + return + if not items_dict.has(prop_key): + push_error("ImportantPropItem not found! key=" + prop_key) + return + inventory.enable_important_item(prop_key) + SceneManager.pop_notification("ui_notify_important_item_update") + if display_inspector: + inspect_item(prop_key, true, true) + + func enable_prop_item(prop_key: String, inspect := true) -> void: if not inventory or not prop_key: + printerr("PropHUD Enable prop item: No inventory or prop_key provided.") return if not items_dict.has(prop_key): push_error("PropItem not found! key=" + prop_key) @@ -477,17 +490,29 @@ func enable_prop_item(prop_key: String, inspect := true) -> void: inspect_item(prop_key) -func inspect_item(prop_key: String, display_words_only := false): +func inspect_item(prop_key: String, display_obtained := true, as_important_item := false): var inspector = SceneManager.get_inspector() if inspector: + var texture_path = items_dict[prop_key].texture_path var inspect_path = items_dict[prop_key].inspect_path # 是否有独立的 inspect 图片 if inspect_path: var texture = load(inspect_path) as Texture2D - inspector.pop_prop_inspection(prop_key, texture, false, display_words_only) + inspector.pop_prop_inspection( + prop_key, texture, false, display_obtained, as_important_item + ) else: - var texture = cached_inventory_textures[prop_key] - inspector.pop_prop_inspection(prop_key, texture, true, display_words_only) + var texture = cached_inventory_textures.get(prop_key) + if not texture: + texture = load(texture_path) as Texture2D + if texture: + cached_inventory_textures[prop_key] = texture + else: + printerr("prophud inspect_item invalid texture_path:", texture_path) + return + inspector.pop_prop_inspection( + prop_key, texture, true, display_obtained, as_important_item + ) func disable_prop_item(prop_key: String) -> void: diff --git a/scene/ux/prop_inspector.gd b/scene/ux/prop_inspector.gd index 865ce7de..d211c94b 100644 --- a/scene/ux/prop_inspector.gd +++ b/scene/ux/prop_inspector.gd @@ -20,7 +20,6 @@ signal quit_and_hidden @onready var content_label = %ContentLabel as Label @onready var tip_label = %TipLabel as Label - var tip_cover = "Q: " + tr("ui_退出") + " " + "E: " + tr("ui_阅读") var tip_notes = "Q: " + tr("ui_退出") + " " + "E: " + tr("ui_收起") var texture_cover: Texture2D @@ -129,7 +128,11 @@ var balloon func pop_prop_inspection( - prop_key: String, cover_texture: Texture2D, use_default_bg: bool, display_words_only: bool + prop_key: String, + cover_texture: Texture2D, + use_default_bg: bool, + display_obtained: bool, + as_important_item: bool ): if not cover_texture: push_error("PropInspector: cover_texture is not set") @@ -156,14 +159,18 @@ func pop_prop_inspection( # 显示道具获得提示 if prop_key: - var obtain_str = tr("ui_获得") var prop_title = tr(prop_key) var text = "~ title\n" - if not display_words_only: + if display_obtained: + var obtain_str = tr("ui_获得道具") + if as_important_item: + obtain_str = tr("ui_获得重要物品") text += obtain_str + ": " + prop_title + "[#item]\n" # 道具的一句话说明 - text += tr(prop_key + "_说明").replace("{br}", "\n").strip_edges() + "\n" - text += "=> END" + var original_word_lines = tr(prop_key + "_说明").replace("{br}", "\n").split("\n") + # 缩略只要第一行 + text += original_word_lines[0] + ("..." if len(original_word_lines) > 1 else "") + text += "\n=> END" var current_prop_res = DialogueManager.create_resource_from_text(text) # 手动跳过的同时显示下一句 if is_instance_valid(balloon): diff --git a/scene/ux/prop_inventory_resource.gd b/scene/ux/prop_inventory_resource.gd index e2c77f32..c663e6cc 100644 --- a/scene/ux/prop_inventory_resource.gd +++ b/scene/ux/prop_inventory_resource.gd @@ -41,7 +41,6 @@ func enable_important_item(prop_key: String) -> void: if not important_items.has(prop_key): important_items.append(prop_key) unviewed_important_items.append(prop_key) - SceneManager.pop_notification("ui_notify_important_item_update") func has_prop(prop_key: String) -> bool: