增加花名册、老鼠精音效;解决 inspector 文本 scroll 与 prop hud 冲突问题;文本剧中滚动
This commit is contained in:
parent
fb21480880
commit
b9fb44ec4b
@ -27,6 +27,11 @@ enum { STATUS_HIDDEN, STATUS_TRANSITIONING, STATUS_INSPECTING_COVER, STATUS_INSP
|
||||
# 第一次交互时的气泡文字(unrevealed -> revealed) 如果为空则跳过
|
||||
@export var first_interact_os_key := ""
|
||||
@export var content_centered: bool = false
|
||||
@export var content_width := 150.0:
|
||||
set(val):
|
||||
content_width = val
|
||||
if is_node_ready():
|
||||
content_label.custom_minimum_size.x = content_width
|
||||
@export var action_key := 4
|
||||
@export var collision_width_and_x := Vector2(20.0, 0):
|
||||
set(val):
|
||||
@ -52,6 +57,7 @@ var content_key: String = ""
|
||||
@onready var container = %Container
|
||||
@onready var cover_rect = %Cover as TextureRect
|
||||
@onready var content_area = %ContentArea as Control
|
||||
@onready var scroll_container = %ScrollContainer as ScrollContainer
|
||||
@onready var content_label = %ContentLabel as Label
|
||||
@onready var tip_label = %TipLabel as Label
|
||||
|
||||
@ -99,6 +105,7 @@ func _ready() -> void:
|
||||
# setup default value
|
||||
ground_archive = ArchiveManager.archive.ground_archive()
|
||||
icount = ground_archive.get_value(name, "icount", 0)
|
||||
content_label.custom_minimum_size.x = content_width
|
||||
if content_centered:
|
||||
content_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
# sign_mark.interacted.connect(_on_interacted)
|
||||
@ -143,12 +150,14 @@ func _on_interacted() -> void:
|
||||
|
||||
|
||||
func _do_action() -> void:
|
||||
scroll_container.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
if status == STATUS_HIDDEN:
|
||||
# if TranslationServer.get_locale().begins_with("zh_"):
|
||||
# content_label.add_theme_font_size_override("font_size", 0)
|
||||
# else:
|
||||
# content_label.add_theme_font_size_override("font_size", 7)
|
||||
|
||||
# 刷新文本 translation
|
||||
if TranslationServer.get_locale().begins_with("zh_"):
|
||||
content_label.add_theme_font_size_override("font_size", 0)
|
||||
else:
|
||||
content_label.add_theme_font_size_override("font_size", 7)
|
||||
content_label.text = _get_tr_content()
|
||||
# 不使用 lock player, 因为需要用 sign 进行继续交互
|
||||
SceneManager.freeze_player(0, action_key)
|
||||
@ -175,6 +184,7 @@ func _do_action() -> void:
|
||||
elif status == STATUS_INSPECTING_COVER:
|
||||
sfx.play()
|
||||
status = STATUS_INSPECTING_NOTES
|
||||
scroll_container.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||
tip_label.text = tip_notes()
|
||||
create_tween().tween_property(content_area, "modulate:a", 1.0, 0.15)
|
||||
elif status == STATUS_INSPECTING_NOTES:
|
||||
@ -200,6 +210,7 @@ func _blink_label(init := true):
|
||||
|
||||
|
||||
func _on_cancel(_body = null):
|
||||
scroll_container.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
if STATUS_TRANSITIONING == status or status == STATUS_HIDDEN:
|
||||
return
|
||||
quit_inspecting.emit()
|
||||
|
@ -45,6 +45,13 @@ collision_layer = 0
|
||||
unique_name_in_owner = true
|
||||
shape = SubResource("RectangleShape2D_4fuic")
|
||||
|
||||
[node name="SignSnapper" type="Marker2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("10_mtbvd")
|
||||
radius = 3.0
|
||||
action_on_arrived = 4
|
||||
metadata/_custom_type_script = "uid://cnt01hiw52bmn"
|
||||
|
||||
[node name="InspectLayer" type="CanvasLayer" parent="."]
|
||||
layer = 20
|
||||
|
||||
@ -100,6 +107,7 @@ mouse_filter = 2
|
||||
texture = ExtResource("7_xawjo")
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="InspectLayer/Root/Container/ContentArea"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 200)
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
@ -113,17 +121,19 @@ offset_right = 65.0
|
||||
offset_bottom = 75.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 0
|
||||
focus_mode = 2
|
||||
mouse_filter = 2
|
||||
horizontal_scroll_mode = 0
|
||||
vertical_scroll_mode = 3
|
||||
|
||||
[node name="ContentLabel" type="Label" parent="InspectLayer/Root/Container/ContentArea/ScrollContainer"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 100
|
||||
custom_minimum_size = Vector2(130, 0)
|
||||
custom_minimum_size = Vector2(150, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 6
|
||||
mouse_filter = 1
|
||||
text = "tdb119a3714,据闻奉贤县分水墩有两人染受鼠疫毙命,医官拟将死者尸骸解剖以观受病之原因及其情状,竟未得死者家属之同意,以该处风气闭塞,闻解剖之说,地方人民甚为惊骇,闻已有聚众滋闹之事,并闻医官已被人殴打,政府以防疫事宜关系紧要拟改令赴沪南区一带调查防疫事宜云。,,,,\"It is reported that two people in Fenshuidun, Fengxian County have died from plague. Medical officials proposed to autopsy the bodies to examine the cause and nature of the disease, but failed to obtain consent from the families of the deceased. Due to the conservative local customs, the mention of autopsy has greatly alarmed the local people. There are reports of crowds gathering to cause trouble, and medical officials have been assaulted. Given the critical importance of epidemic prevention, the government plans to redirect orders to investigate epidemic prevention matters in the southern Shanghai area.\"
|
||||
"
|
||||
vertical_alignment = 1
|
||||
@ -149,10 +159,3 @@ theme_override_fonts/font = ExtResource("7_ianbs")
|
||||
text = "Q: Exit E: Read"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="SignSnapper" type="Marker2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("10_mtbvd")
|
||||
radius = 3.0
|
||||
action_on_arrived = 4
|
||||
metadata/_custom_type_script = "uid://cnt01hiw52bmn"
|
||||
|
@ -21,7 +21,7 @@ func _setup_content():
|
||||
for c in get_children():
|
||||
if c.name == "TipContainer":
|
||||
continue
|
||||
c.visible = displaying
|
||||
c.set("visible", displaying)
|
||||
# reset_tips
|
||||
if displaying:
|
||||
label.text = tip_can_hide
|
||||
@ -41,10 +41,12 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
return
|
||||
if event.is_action_pressed("interact"):
|
||||
if not visible:
|
||||
$"Sfx显示".play()
|
||||
visible = true
|
||||
displaying = false
|
||||
_setup_content()
|
||||
else:
|
||||
$"Sfx收起".play()
|
||||
displaying = not displaying
|
||||
_setup_content()
|
||||
get_viewport().set_input_as_handled()
|
||||
|
@ -1,7 +1,10 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dmysq4sxx8iqh"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://dmysq4sxx8iqh"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://0dcbk75cd5pl" path="res://scene/entity/ux/content_inspector.gd" id="1_4n727"]
|
||||
[ext_resource type="FontVariation" uid="uid://1ryw42kej6lv" path="res://config/font_ui.tres" id="2_mtwgq"]
|
||||
[ext_resource type="AudioStream" uid="uid://dky3j8lwcy5sk" path="res://asset/audio/sfx/UI/物品查看.mp3" id="2_x36rf"]
|
||||
[ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/audio/sfx.gd" id="3_ksykb"]
|
||||
[ext_resource type="AudioStream" uid="uid://3nfd1t2lllmh" path="res://asset/audio/sfx/UI/花名册.mp3" id="4_ndmve"]
|
||||
|
||||
[node name="ContentInspector" type="Control"]
|
||||
layout_mode = 3
|
||||
@ -12,6 +15,20 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_4n727")
|
||||
|
||||
[node name="Sfx显示" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("2_x36rf")
|
||||
volume_db = 5.0
|
||||
bus = &"game_sfx"
|
||||
script = ExtResource("3_ksykb")
|
||||
metadata/_custom_type_script = "uid://rq6w1vuhuq1m"
|
||||
|
||||
[node name="Sfx收起" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("4_ndmve")
|
||||
volume_db = 5.0
|
||||
bus = &"game_sfx"
|
||||
script = ExtResource("3_ksykb")
|
||||
metadata/_custom_type_script = "uid://rq6w1vuhuq1m"
|
||||
|
||||
[node name="TipContainer" type="MarginContainer" parent="."]
|
||||
z_index = 100
|
||||
layout_mode = 1
|
||||
|
19
scene/entity/ux/scrollable_words.gd
Normal file
19
scene/entity/ux/scrollable_words.gd
Normal file
@ -0,0 +1,19 @@
|
||||
extends Control
|
||||
|
||||
@export var width := 200:
|
||||
set(val):
|
||||
width = val
|
||||
if is_node_ready():
|
||||
label.custom_minimum_size.x = width
|
||||
@export var translation_key := "":
|
||||
set(val):
|
||||
translation_key = val
|
||||
if is_node_ready():
|
||||
label.translation_key = translation_key
|
||||
|
||||
@onready var label = $ScrollContainer/WordsLabel as Label
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
label.custom_minimum_size.x = width
|
||||
label.translation_key = translation_key
|
1
scene/entity/ux/scrollable_words.gd.uid
Normal file
1
scene/entity/ux/scrollable_words.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://pkdpas41oa2d
|
51
scene/entity/ux/scrollable_words.tscn
Normal file
51
scene/entity/ux/scrollable_words.tscn
Normal file
@ -0,0 +1,51 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://cp8aee5onwjuc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://pkdpas41oa2d" path="res://scene/entity/ux/scrollable_words.gd" id="1_86u3k"]
|
||||
[ext_resource type="Texture2D" uid="uid://f186lvt5y2ql" path="res://asset/art/ui/遮罩/inspect背景遮罩.png" id="2_gmjbs"]
|
||||
[ext_resource type="Script" uid="uid://dpocj5al0rvai" path="res://ui/text_helper.gd" id="3_6l2e8"]
|
||||
|
||||
[node name="ScrollableWords" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_86u3k")
|
||||
|
||||
[node name="遮罩" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("2_gmjbs")
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||
custom_minimum_size = Vector2(0, 200)
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
horizontal_scroll_mode = 0
|
||||
vertical_scroll_mode = 3
|
||||
|
||||
[node name="WordsLabel" type="Label" parent="ScrollContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(200, 10)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 1
|
||||
text = "tdb119a3714,据闻奉贤县分水墩有两人染受鼠疫毙命,医官拟将死者尸骸解剖以观受病之原因及其情状,竟未得死者家属之同意,以该处风气闭塞,闻解剖之说,地方人民甚为惊骇,闻已有聚众滋闹之事,并闻医官已被人殴打,政府以防疫事宜关系紧要拟改令赴沪南区一带调查防疫事宜云。,,,,\"It is reported that two people in Fenshuidun, Fengxian County have died from plague. Medical officials proposed to autopsy the bodies to examine the cause and nature of the disease, but failed to obtain consent from the families of the deceased. Due to the conservative local customs, the mention of autopsy has greatly alarmed the local people. There are reports of crowds gathering to cause trouble, and medical officials have been assaulted. Given the critical importance of epidemic prevention, the government plans to redirect orders to investigate epidemic prevention matters in the southern Shanghai area.\"
|
||||
"
|
||||
autowrap_mode = 3
|
||||
script = ExtResource("3_6l2e8")
|
@ -125,6 +125,7 @@ content_key = "c02_青岛啤酒"
|
||||
|
||||
[node name="鼠疫海报" parent="Ground/DeployLayer" index="8" instance=ExtResource("12_0fckv")]
|
||||
position = Vector2(442, -30)
|
||||
content_width = 200.0
|
||||
texture_cover = ExtResource("7_wdwbi")
|
||||
content_key = "c02_鼠疫海报"
|
||||
|
||||
|
@ -61,38 +61,44 @@ target_portal = "1"
|
||||
[node name="portal_right" parent="Ground/DeployLayer" index="1"]
|
||||
position = Vector2(551, 22)
|
||||
|
||||
[node name="Ambush进门看到小蝉" parent="Ground/DeployLayer" index="2" instance=ExtResource("7_ypth3")]
|
||||
[node name="Local寻人启事" parent="Ground/DeployLayer" index="2" instance=ExtResource("19_k74x7")]
|
||||
position = Vector2(116, -1)
|
||||
texture = ExtResource("20_g8amr")
|
||||
texture_cover = ExtResource("21_cq2m4")
|
||||
content_key = "c02_寻人启事_完整"
|
||||
|
||||
[node name="Ambush进门看到小蝉" parent="Ground/DeployLayer" index="3" instance=ExtResource("7_ypth3")]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(72, 51)
|
||||
hook_method = "xiaochan_disappear"
|
||||
|
||||
[node name="涂鸦提示" type="Sprite2D" parent="Ground/DeployLayer" index="3"]
|
||||
[node name="涂鸦提示" type="Sprite2D" parent="Ground/DeployLayer" index="4"]
|
||||
position = Vector2(275, 13)
|
||||
texture = ExtResource("6_gk1h4")
|
||||
|
||||
[node name="小钳子提示" type="Sprite2D" parent="Ground/DeployLayer" index="4"]
|
||||
[node name="小钳子提示" type="Sprite2D" parent="Ground/DeployLayer" index="5"]
|
||||
position = Vector2(270, -3)
|
||||
texture = ExtResource("9_k74x7")
|
||||
|
||||
[node name="Closeup折锡纸" parent="Ground/DeployLayer" index="5" instance=ExtResource("6_66gue")]
|
||||
[node name="Closeup折锡纸" parent="Ground/DeployLayer" index="6" instance=ExtResource("6_66gue")]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(189, 15)
|
||||
packed_scene = ExtResource("7_fvlg0")
|
||||
first_interact_os_key = "c02_保卫科祭台os"
|
||||
|
||||
[node name="Closeup老鼠精" parent="Ground/DeployLayer" index="6" instance=ExtResource("6_66gue")]
|
||||
[node name="Closeup老鼠精" parent="Ground/DeployLayer" index="7" instance=ExtResource("6_66gue")]
|
||||
light_mask = 5
|
||||
position = Vector2(207.5, -40.5)
|
||||
texture = ExtResource("11_ffvrp")
|
||||
packed_scene = ExtResource("8_cm3g6")
|
||||
|
||||
[node name="Closeup花名册" parent="Ground/DeployLayer" index="7" instance=ExtResource("6_66gue")]
|
||||
[node name="Closeup花名册" parent="Ground/DeployLayer" index="8" instance=ExtResource("6_66gue")]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(351, 31)
|
||||
packed_scene = ExtResource("6_fvlg0")
|
||||
first_interact_os_key = "c02_保卫科花名册os"
|
||||
|
||||
[node name="煤油灯" type="Sprite2D" parent="Ground/DeployLayer" index="8"]
|
||||
[node name="煤油灯" type="Sprite2D" parent="Ground/DeployLayer" index="9"]
|
||||
position = Vector2(370, 39)
|
||||
|
||||
[node name="灯光" type="AnimatedSprite2D" parent="Ground/DeployLayer/煤油灯"]
|
||||
@ -109,15 +115,9 @@ energy = 2.0
|
||||
blend_mode = 2
|
||||
texture = ExtResource("9_a43aq")
|
||||
|
||||
[node name="小手讨东西" parent="Ground/DeployLayer" index="9" instance=ExtResource("10_a43aq")]
|
||||
[node name="小手讨东西" parent="Ground/DeployLayer" index="10" instance=ExtResource("10_a43aq")]
|
||||
position = Vector2(295, -6)
|
||||
|
||||
[node name="Local寻人启事" parent="Ground/DeployLayer" index="10" instance=ExtResource("19_k74x7")]
|
||||
position = Vector2(116, -1)
|
||||
texture = ExtResource("20_g8amr")
|
||||
texture_cover = ExtResource("21_cq2m4")
|
||||
content_key = "c02_寻人启事_完整"
|
||||
|
||||
[node name="小蝉写字" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="11"]
|
||||
position = Vector2(351, 51)
|
||||
sprite_frames = ExtResource("20_47ju4")
|
||||
|
@ -1,13 +1,23 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://cdf2qe8l7323i"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://cdf2qe8l7323i"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dyk58stu5enia" path="res://scene/ground/script/c02/老鼠精画像.gd" id="1_l77sh"]
|
||||
[ext_resource type="Texture2D" uid="uid://d1xr7g5huv5or" path="res://asset/art/scene/c02/s04_保卫科/ux_老鼠画像特写.png" id="2_eyynm"]
|
||||
[ext_resource type="AudioStream" uid="uid://bi4hcr04231qr" path="res://asset/audio/sfx/UI/挂画查看.mp3" id="2_nvvir"]
|
||||
[ext_resource type="PackedScene" uid="uid://dmysq4sxx8iqh" path="res://scene/entity/ux/content_inspector.tscn" id="3_lpmq3"]
|
||||
[ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/audio/sfx.gd" id="3_u15ce"]
|
||||
[ext_resource type="Texture2D" uid="uid://f186lvt5y2ql" path="res://asset/art/ui/遮罩/inspect背景遮罩.png" id="4_l77sh"]
|
||||
|
||||
[node name="老鼠精画像" type="CanvasLayer"]
|
||||
script = ExtResource("1_l77sh")
|
||||
|
||||
[node name="Sfx打开查看" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("2_nvvir")
|
||||
volume_db = 3.0
|
||||
autoplay = true
|
||||
bus = &"game_sfx"
|
||||
script = ExtResource("3_u15ce")
|
||||
metadata/_custom_type_script = "uid://rq6w1vuhuq1m"
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
@ -11,11 +11,13 @@ var texture_dict = {
|
||||
var click_count = 0
|
||||
|
||||
func _ready() -> void:
|
||||
$"Sfx翻页".play()
|
||||
layer = GlobalConfig.CANVAS_LAYER_LITTLE_GAME
|
||||
button.pressed.connect(_on_button_pressed)
|
||||
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
$"Sfx翻页".play()
|
||||
click_count += 1
|
||||
if click_count == 1:
|
||||
button.texture_normal = texture_dict["1"]
|
||||
|
@ -1,6 +1,8 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://b8i6tqwdvvddy"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://b8i6tqwdvvddy"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cmapmn0v70p4l" path="res://scene/ground/script/c02/花名册.gd" id="1_jin3n"]
|
||||
[ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/audio/sfx.gd" id="2_654vh"]
|
||||
[ext_resource type="AudioStream" uid="uid://c3qonrtdjnmau" path="res://asset/audio/sfx/UI/纸声.wav" id="2_su2aa"]
|
||||
[ext_resource type="Texture2D" uid="uid://cypvxj1vsl5yk" path="res://asset/art/scene/c02/s04_保卫科/花名册/bg_花名册桌面.png" id="2_v047l"]
|
||||
[ext_resource type="Texture2D" uid="uid://sx3i3lkt2vfd" path="res://asset/art/scene/c02/s04_保卫科/花名册/花名册封皮.png" id="3_myeas"]
|
||||
[ext_resource type="PackedScene" uid="uid://dmysq4sxx8iqh" path="res://scene/entity/ux/content_inspector.tscn" id="4_1s4sv"]
|
||||
@ -9,6 +11,12 @@
|
||||
[node name="花名册" type="CanvasLayer"]
|
||||
script = ExtResource("1_jin3n")
|
||||
|
||||
[node name="Sfx翻页" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("2_su2aa")
|
||||
bus = &"game_sfx"
|
||||
script = ExtResource("2_654vh")
|
||||
metadata/_custom_type_script = "uid://rq6w1vuhuq1m"
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
@ -74,9 +74,9 @@ item_key = "prop_令牌"
|
||||
display_time = 1.5
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="PropInspector" parent="." instance=ExtResource("5_ux0rw")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="GroundLoader" parent="." instance=ExtResource("10_8rc5n")]
|
||||
position = Vector2(1, 0)
|
||||
entrance_portal = "right"
|
||||
|
||||
[node name="PropInspector" parent="." instance=ExtResource("5_ux0rw")]
|
||||
unique_name_in_owner = true
|
||||
|
@ -16,9 +16,11 @@ signal quit_and_hidden
|
||||
@onready var prop_bg = %PropBG as TextureRect
|
||||
@onready var origin_texture = %OriginPropTexture as TextureRect
|
||||
@onready var full_texture = %FullTexture as TextureRect
|
||||
@onready var scroll_container = %ScrollContainer as ScrollContainer
|
||||
@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
|
||||
@ -60,6 +62,7 @@ func _hide():
|
||||
|
||||
func _post_hide():
|
||||
status = STATUS_HIDDEN
|
||||
scroll_container.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
locking = false
|
||||
origin_texture.texture = null
|
||||
full_texture.texture = null
|
||||
@ -202,10 +205,12 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
_hide()
|
||||
if event.is_action_pressed("interact"):
|
||||
get_viewport().set_input_as_handled()
|
||||
scroll_container.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
# STATUS_INSPECTING_COVER 与 STATUS_INSPECTING_NOTES 之间互相切换
|
||||
if status == STATUS_INSPECTING_COVER:
|
||||
# inspect notes
|
||||
status = STATUS_INSPECTING_NOTES
|
||||
scroll_container.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||
if not texture_notes:
|
||||
notes_bg.visible = true
|
||||
else:
|
||||
|
@ -22,7 +22,7 @@ offset_bottom = 120.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 4
|
||||
mouse_filter = 0
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("2_j83lq")
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
@ -91,10 +91,11 @@ theme_override_constants/margin_right = 200
|
||||
theme_override_constants/margin_bottom = 60
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer2"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 200)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
mouse_filter = 0
|
||||
mouse_filter = 2
|
||||
horizontal_scroll_mode = 0
|
||||
vertical_scroll_mode = 3
|
||||
|
||||
|
@ -2,20 +2,24 @@
|
||||
extends Node
|
||||
|
||||
@export var property_name := "text"
|
||||
@export var translation_key := ""
|
||||
@export var translation_key := "":
|
||||
set(val):
|
||||
translation_key = val
|
||||
if is_node_ready():
|
||||
refresh()
|
||||
@export var vertical := false
|
||||
@export_tool_button("刷新") var refresh = _refresh.bind(true)
|
||||
@export_tool_button("刷新") var _refresh = refresh.bind(true)
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_refresh()
|
||||
refresh()
|
||||
|
||||
|
||||
# res://asset/dialogue/item_description.zh_CN.translation
|
||||
var items_translation = preload("uid://c1x5bqwulamey") as Translation
|
||||
|
||||
|
||||
func _refresh(from_tool := false):
|
||||
func refresh(from_tool := false):
|
||||
if property_name and translation_key:
|
||||
var msg = tr(translation_key)
|
||||
if from_tool:
|
||||
@ -31,4 +35,4 @@ func _refresh(from_tool := false):
|
||||
|
||||
func _notification(what: int) -> void:
|
||||
if what == NOTIFICATION_TRANSLATION_CHANGED:
|
||||
_refresh()
|
||||
refresh()
|
||||
|
Loading…
Reference in New Issue
Block a user