23 lines
549 B
GDScript
23 lines
549 B
GDScript
@tool
|
|
extends Node
|
|
|
|
@export var property_name := "text"
|
|
@export var translation_key := ""
|
|
@export_tool_button("刷新") var refresh = _refresh.bind(true)
|
|
|
|
|
|
func _ready() -> void:
|
|
_refresh()
|
|
|
|
|
|
# res://asset/dialogue/item_description.zh_CN.translation
|
|
var items_translation = preload("uid://c1x5bqwulamey") as Translation
|
|
|
|
|
|
func _refresh(from_tool := false):
|
|
if property_name and translation_key:
|
|
var msg = tr(translation_key)
|
|
if from_tool:
|
|
msg = items_translation.get_message(translation_key)
|
|
set(property_name, msg.replace("<br>", "\n"))
|