prop 检阅道具/重要物品
This commit is contained in:
parent
1f4eec47da
commit
990312b621
@ -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
|
||||
|
|
@ -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_撕下的照片上_说明]
|
||||
|
@ -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")
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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")
|
||||
|
@ -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:
|
||||
|
@ -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):
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user