Added translations management
Prepares work for line voiceovers management.
This commit is contained in:
@@ -465,9 +465,18 @@ func say(command_params : Array) -> esctypes:
|
||||
# Manage specific dialog scene
|
||||
if command_params.size() > 2:
|
||||
dialog_scene_name = command_params[2]
|
||||
|
||||
|
||||
# Manage translation/voice lines keys in the form of :
|
||||
# line_key:"Default line text"
|
||||
# If a line_key exists, we'll set it a label as it will automatically be
|
||||
# translated
|
||||
var dialog_key_line = command_params[1].split(":", true, 1)
|
||||
if dialog_key_line.size() > 1:
|
||||
dialog_key_line[1] = dialog_key_line[1].trim_prefix("\"")
|
||||
|
||||
dict = {
|
||||
"line": command_params[1],
|
||||
"key": dialog_key_line[0],
|
||||
"line": dialog_key_line[1] if dialog_key_line.size() > 1 else dialog_key_line[0],
|
||||
"ui": dialog_scene_name
|
||||
#"ui": "dialog_label"
|
||||
#"ui": "dialog_box_inset"
|
||||
|
||||
@@ -40,7 +40,8 @@ func preload_resources(path : String):
|
||||
add_resource(basename, dialog_scene)
|
||||
file_name = dialog_folder.get_next()
|
||||
else:
|
||||
escoria.logger.report_errors("dialog_player.gd:preload_resources()", ["An error occurred when trying to access the path: {_}.".format(path)])
|
||||
escoria.logger.report_errors("dialog_player.gd:preload_resources()",
|
||||
["An error occurred when trying to access the path: {_}.".format(path)])
|
||||
|
||||
|
||||
func say(character : String, params : Dictionary):
|
||||
|
||||
@@ -43,7 +43,12 @@ func say(character : String, params : Dictionary) :
|
||||
var text_color = current_character.dialog_color
|
||||
var text_color_html = text_color.to_html(false)
|
||||
|
||||
text_node.bbcode_text = "[center][color=#" + text_color_html + "]".format([text_color_html]) + params["line"] + "[/color][center]"
|
||||
if params["key"] != params["line"]:
|
||||
text_node.bbcode_text = "[center][color=#" + text_color_html + "]" \
|
||||
.format([text_color_html]) + tr(params["key"]) + "[/color][center]"
|
||||
else:
|
||||
text_node.bbcode_text = "[center][color=#" + text_color_html + "]" \
|
||||
.format([text_color_html]) + params["line"] + "[/color][center]"
|
||||
|
||||
text_node.percent_visible = 0.0
|
||||
var time_show_full_text = text_speed_per_character * len(params["line"])
|
||||
|
||||
Reference in New Issue
Block a user