prop inspect 流程优化
This commit is contained in:
parent
8422c7a614
commit
3bc89b97e8
@ -600,19 +600,25 @@ func inspect_item(prop_key: String, display_obtained := true, as_important_item
|
|||||||
if not texture:
|
if not texture:
|
||||||
printerr("prophud inspect_item invalid texture for key:", prop_key)
|
printerr("prophud inspect_item invalid texture for key:", prop_key)
|
||||||
return
|
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:
|
if as_important_item:
|
||||||
# skip | show
|
# skip | show
|
||||||
var display_mode = tr(prop_key + "_详情")
|
var display_mode = tr(prop_key + "_详情")
|
||||||
inspector.pop_prop_inspection(prop_key, texture, true)
|
|
||||||
# 重要物品可能展示检阅界面
|
# 重要物品可能展示检阅界面
|
||||||
if display_mode == "show":
|
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:
|
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:
|
func _post_display_detail(texture, content) -> void:
|
||||||
var wide = len(content) > 150
|
var wide = len(content) > 150
|
||||||
var inspector = SceneManager.get_inspector() as PropInspector
|
var inspector = SceneManager.get_inspector() as PropInspector
|
||||||
|
@ -145,7 +145,8 @@ var locking = false:
|
|||||||
func pop_prop_inspection(
|
func pop_prop_inspection(
|
||||||
prop_key: String,
|
prop_key: String,
|
||||||
cover_texture: Texture2D,
|
cover_texture: Texture2D,
|
||||||
display_obtained: bool
|
display_obtained: bool,
|
||||||
|
describe_content: String
|
||||||
):
|
):
|
||||||
if not cover_texture:
|
if not cover_texture:
|
||||||
push_error("PropInspector: cover_texture is not set")
|
push_error("PropInspector: cover_texture is not set")
|
||||||
@ -166,15 +167,11 @@ func pop_prop_inspection(
|
|||||||
# 显示道具获得提示
|
# 显示道具获得提示
|
||||||
if prop_key:
|
if prop_key:
|
||||||
var prop_title = tr(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:
|
if display_obtained:
|
||||||
var obtain_str = tr("ui_获得")
|
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:
|
else:
|
||||||
inspector_balloon.show_prop_content(content)
|
inspector_balloon.show_prop_content(describe_content)
|
||||||
|
|
||||||
|
|
||||||
func _show_prop_words(line_id: String):
|
func _show_prop_words(line_id: String):
|
||||||
|
Loading…
Reference in New Issue
Block a user