From 3bc89b97e8f9de97708d7ee9ea6ad6f562fc0a1b Mon Sep 17 00:00:00 2001 From: cakipaul Date: Mon, 18 Aug 2025 23:02:51 +0800 Subject: [PATCH] =?UTF-8?q?prop=20inspect=20=E6=B5=81=E7=A8=8B=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scene/ux/prop_hud.gd | 16 +++++++++++----- scene/ux/prop_inspector.gd | 11 ++++------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/scene/ux/prop_hud.gd b/scene/ux/prop_hud.gd index d59b126a..8becffb4 100644 --- a/scene/ux/prop_hud.gd +++ b/scene/ux/prop_hud.gd @@ -600,19 +600,25 @@ func inspect_item(prop_key: String, display_obtained := true, as_important_item if not texture: printerr("prophud inspect_item invalid texture for key:", prop_key) return + # 道具的一句话说明 + var full_content = tr(prop_key + "_说明").replace("{br}", "\n").split("\n") + # 缩略只要第一行 + var describe_content = full_content[0] + ("..." if len(full_content) > 1 else "") if as_important_item: # 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) + # 不需要展示一句话描述, 直接展示详情 + inspector.pop_prop_inspection(prop_key, texture, true, "") + inspector.hiding_tween_started.connect(_post_display_detail.bind(texture, full_content), CONNECT_ONE_SHOT) + elif display_mode == "skip": + inspector.pop_prop_inspection(prop_key, texture, true, describe_content) else: - inspector.pop_prop_inspection(prop_key, texture, display_obtained) + inspector.pop_prop_inspection(prop_key, texture, display_obtained, describe_content) -# 重要物品可能展示检阅界面 +# 重要物品可能展示检阅详情界面 func _post_display_detail(texture, content) -> void: var wide = len(content) > 150 var inspector = SceneManager.get_inspector() as PropInspector diff --git a/scene/ux/prop_inspector.gd b/scene/ux/prop_inspector.gd index 60da2cd6..e971346e 100644 --- a/scene/ux/prop_inspector.gd +++ b/scene/ux/prop_inspector.gd @@ -145,7 +145,8 @@ var locking = false: func pop_prop_inspection( prop_key: String, cover_texture: Texture2D, - display_obtained: bool + display_obtained: bool, + describe_content: String ): if not cover_texture: push_error("PropInspector: cover_texture is not set") @@ -166,15 +167,11 @@ func pop_prop_inspection( # 显示道具获得提示 if prop_key: var prop_title = tr(prop_key) - # 道具的一句话说明 - var original_word_lines = tr(prop_key + "_说明").replace("{br}", "\n").split("\n") - # 缩略只要第一行 - var content = original_word_lines[0] + ("..." if len(original_word_lines) > 1 else "") if display_obtained: var obtain_str = tr("ui_获得") - inspector_balloon.show_prop_balloon(obtain_str, prop_title, content) + inspector_balloon.show_prop_balloon(obtain_str, prop_title, describe_content) else: - inspector_balloon.show_prop_content(content) + inspector_balloon.show_prop_content(describe_content) func _show_prop_words(line_id: String):