This commit is contained in:
jkboy 2025-05-20 22:21:42 +08:00
parent dbf6357bf1
commit 6eab720402
2 changed files with 24 additions and 0 deletions

View File

@ -7,6 +7,7 @@ const _TypewriterLogic = preload("res://UI/class/TypewriterLogic.gd")
@export var default_npc_name = '秘书'
@onready var npc_icon: TextureRect = $Part_2/npc_icon
@onready var npc_name_label: Label = $Part_2/npc_name
var npc_icon_png_folder = "res://Entity/NPC/art/"
var typing_speed: float = 20.0 # 每秒显示的字符数
@ -44,9 +45,11 @@ func _on_page_activated():
if GameState.get_value("dialogue_npc"):
var npc_name = GameState.get_value("dialogue_npc")
npc_icon.texture = load(npc_icon_png_folder+npc_name+'.png')
npc_name_label.text = npc_name
GameState.set_value("dialogue_npc",null)
else:
npc_icon.texture = load(npc_icon_png_folder+default_npc_name+'.png')
npc_name_label.text = default_npc_name
print(node_name + ": Page activated.")
_start(dialogues)

View File

@ -178,6 +178,27 @@ libraries = {
}
autoplay = "base"
[node name="npc_name" type="Label" parent="Part_2"]
custom_minimum_size = Vector2(100, 0)
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -50.0
offset_top = -40.0
offset_right = 50.0
offset_bottom = -17.0
grow_horizontal = 2
grow_vertical = 0
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_fonts/font = ExtResource("3_ilhgc")
theme_override_font_sizes/font_size = 24
text = "秘书"
horizontal_alignment = 1
vertical_alignment = 1
[node name="npc_icon" type="TextureRect" parent="Part_2"]
layout_mode = 1
anchors_preset = 3