chore: Update dialogue manager version
parent
d63a93bb93
commit
dde1d18bc5
|
@ -1,6 +1,6 @@
|
||||||
[remap]
|
[remap]
|
||||||
|
|
||||||
importer="dialogue_manager_compiler_11"
|
importer="dialogue_manager_compiler_12"
|
||||||
type="Resource"
|
type="Resource"
|
||||||
uid="uid://dilmuoilweoeh"
|
uid="uid://dilmuoilweoeh"
|
||||||
path="res://.godot/imported/books.dialogue-cc272ebae322ae3ca46820dca11a3437.tres"
|
path="res://.godot/imported/books.dialogue-cc272ebae322ae3ca46820dca11a3437.tres"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[remap]
|
[remap]
|
||||||
|
|
||||||
importer="dialogue_manager_compiler_11"
|
importer="dialogue_manager_compiler_12"
|
||||||
type="Resource"
|
type="Resource"
|
||||||
uid="uid://c2om4y0fm81yr"
|
uid="uid://c2om4y0fm81yr"
|
||||||
path="res://.godot/imported/clone-machine.dialogue-8810934a67eacdad52469e9ef5f970fb.tres"
|
path="res://.godot/imported/clone-machine.dialogue-8810934a67eacdad52469e9ef5f970fb.tres"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[remap]
|
[remap]
|
||||||
|
|
||||||
importer="dialogue_manager_compiler_11"
|
importer="dialogue_manager_compiler_12"
|
||||||
type="Resource"
|
type="Resource"
|
||||||
uid="uid://dntkvjjr8mrgf"
|
uid="uid://dntkvjjr8mrgf"
|
||||||
path="res://.godot/imported/doc.dialogue-8f95f6a09d3ac685b71d7e07c49df1c6.tres"
|
path="res://.godot/imported/doc.dialogue-8f95f6a09d3ac685b71d7e07c49df1c6.tres"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[remap]
|
[remap]
|
||||||
|
|
||||||
importer="dialogue_manager_compiler_11"
|
importer="dialogue_manager_compiler_12"
|
||||||
type="Resource"
|
type="Resource"
|
||||||
uid="uid://c4n7vhoxybu70"
|
uid="uid://c4n7vhoxybu70"
|
||||||
path="res://.godot/imported/snus-dealer.dialogue-69dbddee28632f18888364bae03f393d.tres"
|
path="res://.godot/imported/snus-dealer.dialogue-69dbddee28632f18888364bae03f393d.tres"
|
||||||
|
|
|
@ -206,6 +206,13 @@ namespace DialogueManagerRuntime
|
||||||
|
|
||||||
public partial class DialogueLine : RefCounted
|
public partial class DialogueLine : RefCounted
|
||||||
{
|
{
|
||||||
|
private string id = "";
|
||||||
|
public string Id
|
||||||
|
{
|
||||||
|
get => id;
|
||||||
|
set => id = value;
|
||||||
|
}
|
||||||
|
|
||||||
private string type = "dialogue";
|
private string type = "dialogue";
|
||||||
public string Type
|
public string Type
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,26 +70,28 @@ func _ready() -> void:
|
||||||
|
|
||||||
|
|
||||||
func _gui_input(event: InputEvent) -> void:
|
func _gui_input(event: InputEvent) -> void:
|
||||||
|
# Handle shortcuts that come from the editor
|
||||||
if event is InputEventKey and event.is_pressed():
|
if event is InputEventKey and event.is_pressed():
|
||||||
match event.as_text():
|
var shortcut: String = Engine.get_meta("DialogueManagerPlugin").get_editor_shortcut(event)
|
||||||
"Ctrl+Equal", "Command+Equal":
|
match shortcut:
|
||||||
self.font_size += 1
|
"toggle_comment":
|
||||||
get_viewport().set_input_as_handled()
|
|
||||||
"Ctrl+Minus", "Command+Minus":
|
|
||||||
self.font_size -= 1
|
|
||||||
get_viewport().set_input_as_handled()
|
|
||||||
"Ctrl+0", "Command+0":
|
|
||||||
self.font_size = theme_overrides.font_size
|
|
||||||
get_viewport().set_input_as_handled()
|
|
||||||
"Ctrl+K", "Command+K":
|
|
||||||
toggle_comment()
|
toggle_comment()
|
||||||
get_viewport().set_input_as_handled()
|
get_viewport().set_input_as_handled()
|
||||||
"Alt+Up":
|
"move_up":
|
||||||
move_line(-1)
|
move_line(-1)
|
||||||
get_viewport().set_input_as_handled()
|
get_viewport().set_input_as_handled()
|
||||||
"Alt+Down":
|
"move_down":
|
||||||
move_line(1)
|
move_line(1)
|
||||||
get_viewport().set_input_as_handled()
|
get_viewport().set_input_as_handled()
|
||||||
|
"text_size_increase":
|
||||||
|
self.font_size += 1
|
||||||
|
get_viewport().set_input_as_handled()
|
||||||
|
"text_size_decrease":
|
||||||
|
self.font_size -= 1
|
||||||
|
get_viewport().set_input_as_handled()
|
||||||
|
"text_size_reset":
|
||||||
|
self.font_size = theme_overrides.font_size
|
||||||
|
get_viewport().set_input_as_handled()
|
||||||
|
|
||||||
elif event is InputEventMouse:
|
elif event is InputEventMouse:
|
||||||
match event.as_text():
|
match event.as_text():
|
||||||
|
|
|
@ -26,11 +26,11 @@ var regex_dict: RegEx = RegEx.create_from_string("^\\{((?>[^\\{\\}]+|(?R))*)\\}$
|
||||||
var regex_kvdict: RegEx = RegEx.create_from_string("^\\s*(?<left>.*?)\\s*(?<colon>:|=)\\s*(?<right>[^\\/]+)$")
|
var regex_kvdict: RegEx = RegEx.create_from_string("^\\s*(?<left>.*?)\\s*(?<colon>:|=)\\s*(?<right>[^\\/]+)$")
|
||||||
var regex_commas: RegEx = RegEx.create_from_string("([^,]+)(?:\\s*,\\s*)?")
|
var regex_commas: RegEx = RegEx.create_from_string("([^,]+)(?:\\s*,\\s*)?")
|
||||||
var regex_assignment: RegEx = RegEx.create_from_string("^\\s*(?<var>[a-zA-Z_][a-zA-Z_0-9]*)(?:(?<attr>(?:\\.[a-zA-Z_][a-zA-Z_0-9]*)+)|(?:\\[(?<key>[^\\]]+)\\]))?\\s*(?<op>(?:\\/|\\*|-|\\+)?=)\\s*(?<val>.*)$")
|
var regex_assignment: RegEx = RegEx.create_from_string("^\\s*(?<var>[a-zA-Z_][a-zA-Z_0-9]*)(?:(?<attr>(?:\\.[a-zA-Z_][a-zA-Z_0-9]*)+)|(?:\\[(?<key>[^\\]]+)\\]))?\\s*(?<op>(?:\\/|\\*|-|\\+)?=)\\s*(?<val>.*)$")
|
||||||
var regex_varname: RegEx = RegEx.create_from_string("^\\s*(?!true|false|and|or|not|in|null)(?<var>[a-zA-Z_][a-zA-Z_0-9]*)(?:(?<attr>(?:\\.[a-zA-Z_][a-zA-Z_0-9]*)+)|(?:\\[(?<key>[^\\]]+)\\]))?\\s*$")
|
var regex_varname: RegEx = RegEx.create_from_string("^\\s*(?!true|false|and|or|&&|\\|\\|not|in|null)(?<var>[a-zA-Z_][a-zA-Z_0-9]*)(?:(?<attr>(?:\\.[a-zA-Z_][a-zA-Z_0-9]*)+)|(?:\\[(?<key>[^\\]]+)\\]))?\\s*$")
|
||||||
var regex_keyword: RegEx = RegEx.create_from_string("^\\s*(true|false|null)\\s*$")
|
var regex_keyword: RegEx = RegEx.create_from_string("^\\s*(true|false|null)\\s*$")
|
||||||
var regex_function: RegEx = RegEx.create_from_string("^\\s*([a-zA-Z_][a-zA-Z_0-9]*\\s*)\\(")
|
var regex_function: RegEx = RegEx.create_from_string("^\\s*([a-zA-Z_][a-zA-Z_0-9]*\\s*)\\(")
|
||||||
var regex_comparison: RegEx = RegEx.create_from_string("^(?<left>.*?)\\s*(?<op>==|>=|<=|<|>|!=)\\s*(?<right>.*)$")
|
var regex_comparison: RegEx = RegEx.create_from_string("^(?<left>.*?)\\s*(?<op>==|>=|<=|<|>|!=)\\s*(?<right>.*)$")
|
||||||
var regex_blogical: RegEx = RegEx.create_from_string("^(?<left>.*?)\\s+(?<op>and|or|in)\\s+(?<right>.*)$")
|
var regex_blogical: RegEx = RegEx.create_from_string("^(?<left>.*?)\\s+(?<op>and|or|in|&&|\\|\\|)\\s+(?<right>.*)$")
|
||||||
var regex_ulogical: RegEx = RegEx.create_from_string("^\\s*(?<op>not)\\s+(?<right>.*)$")
|
var regex_ulogical: RegEx = RegEx.create_from_string("^\\s*(?<op>not)\\s+(?<right>.*)$")
|
||||||
var regex_paren: RegEx = RegEx.create_from_string("\\((?<paren>((?:[^\\(\\)]*)|(?:\\((?1)\\)))*?)\\)")
|
var regex_paren: RegEx = RegEx.create_from_string("\\((?<paren>((?:[^\\(\\)]*)|(?:\\((?1)\\)))*?)\\)")
|
||||||
|
|
||||||
|
@ -186,9 +186,9 @@ func _get_dialogue_syntax_highlighting(start_index: int, text: String) -> Dictio
|
||||||
for goto_match in goto_matches:
|
for goto_match in goto_matches:
|
||||||
colors[start_index + goto_match.get_start(0)] = {"color": text_edit.theme_overrides.jumps_color}
|
colors[start_index + goto_match.get_start(0)] = {"color": text_edit.theme_overrides.jumps_color}
|
||||||
if "file" in goto_match.names:
|
if "file" in goto_match.names:
|
||||||
colors[start_index + goto_match.get_start("file")] = {"color": text_edit.theme_overrides.members_color}
|
colors[start_index + goto_match.get_start("file")] = {"color": text_edit.theme_overrides.jumps_color}
|
||||||
colors[start_index + goto_match.get_end("file")] = {"color": text_edit.theme_overrides.symbols_color}
|
colors[start_index + goto_match.get_end("file")] = {"color": text_edit.theme_overrides.symbols_color}
|
||||||
colors[start_index + goto_match.get_start("title")] = {"color": text_edit.theme_overrides.titles_color}
|
colors[start_index + goto_match.get_start("title")] = {"color": text_edit.theme_overrides.jumps_color}
|
||||||
colors[start_index + goto_match.get_end("title")] = {"color": text_edit.theme_overrides.jumps_color}
|
colors[start_index + goto_match.get_end("title")] = {"color": text_edit.theme_overrides.jumps_color}
|
||||||
colors[start_index + goto_match.get_end(0)] = {"color": text_edit.theme_overrides.text_color}
|
colors[start_index + goto_match.get_end(0)] = {"color": text_edit.theme_overrides.text_color}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ var TOKEN_DEFINITIONS: Dictionary = {
|
||||||
DialogueConstants.TOKEN_DOT: RegEx.create_from_string("^\\."),
|
DialogueConstants.TOKEN_DOT: RegEx.create_from_string("^\\."),
|
||||||
DialogueConstants.TOKEN_STRING: RegEx.create_from_string("^(\".*?\"|\'.*?\')"),
|
DialogueConstants.TOKEN_STRING: RegEx.create_from_string("^(\".*?\"|\'.*?\')"),
|
||||||
DialogueConstants.TOKEN_NOT: RegEx.create_from_string("^(not( |$)|!)"),
|
DialogueConstants.TOKEN_NOT: RegEx.create_from_string("^(not( |$)|!)"),
|
||||||
DialogueConstants.TOKEN_AND_OR: RegEx.create_from_string("^(and|or)( |$)"),
|
DialogueConstants.TOKEN_AND_OR: RegEx.create_from_string("^(and|or|&&|\\|\\|)( |$)"),
|
||||||
DialogueConstants.TOKEN_VARIABLE: RegEx.create_from_string("^[a-zA-Z_][a-zA-Z_0-9]*"),
|
DialogueConstants.TOKEN_VARIABLE: RegEx.create_from_string("^[a-zA-Z_][a-zA-Z_0-9]*"),
|
||||||
DialogueConstants.TOKEN_COMMENT: RegEx.create_from_string("^#.*"),
|
DialogueConstants.TOKEN_COMMENT: RegEx.create_from_string("^#.*"),
|
||||||
DialogueConstants.TOKEN_CONDITION: RegEx.create_from_string("^(if|elif|else)"),
|
DialogueConstants.TOKEN_CONDITION: RegEx.create_from_string("^(if|elif|else)"),
|
||||||
|
@ -230,6 +230,7 @@ func parse(text: String, path: String) -> Error:
|
||||||
line["character"] = first_child.character
|
line["character"] = first_child.character
|
||||||
line["character_replacements"] = first_child.character_replacements
|
line["character_replacements"] = first_child.character_replacements
|
||||||
line["text"] = first_child.text
|
line["text"] = first_child.text
|
||||||
|
line["text_replacements"] = extract_dialogue_replacements(line.text, indent_size + 2)
|
||||||
line["translation_key"] = first_child.translation_key
|
line["translation_key"] = first_child.translation_key
|
||||||
parsed_lines[str(id) + ".2"] = first_child
|
parsed_lines[str(id) + ".2"] = first_child
|
||||||
line["next_id"] = str(id) + ".2"
|
line["next_id"] = str(id) + ".2"
|
||||||
|
@ -691,12 +692,7 @@ func get_line_after_line(id: int, indent_size: int, line: Dictionary) -> String:
|
||||||
var next_nonempty_line_id = get_next_nonempty_line_id(id)
|
var next_nonempty_line_id = get_next_nonempty_line_id(id)
|
||||||
if next_nonempty_line_id != DialogueConstants.ID_NULL \
|
if next_nonempty_line_id != DialogueConstants.ID_NULL \
|
||||||
and indent_size <= get_indent(raw_lines[next_nonempty_line_id.to_int()]):
|
and indent_size <= get_indent(raw_lines[next_nonempty_line_id.to_int()]):
|
||||||
# The next line is a title so we need the next nonempty line after that
|
return next_nonempty_line_id
|
||||||
if is_title_line(raw_lines[next_nonempty_line_id.to_int()]):
|
|
||||||
return get_next_nonempty_line_id(next_nonempty_line_id.to_int())
|
|
||||||
# Otherwise it's a normal line
|
|
||||||
else:
|
|
||||||
return next_nonempty_line_id
|
|
||||||
# Otherwise, we grab the ID from the parents next ID after children
|
# Otherwise, we grab the ID from the parents next ID after children
|
||||||
elif line.has("parent_id") and parsed_lines.has(line.parent_id):
|
elif line.has("parent_id") and parsed_lines.has(line.parent_id):
|
||||||
return parsed_lines[line.parent_id].next_id_after
|
return parsed_lines[line.parent_id].next_id_after
|
||||||
|
@ -927,8 +923,8 @@ func find_next_line_after_responses(line_number: int) -> String:
|
||||||
if get_indent(line) <= expected_indent:
|
if get_indent(line) <= expected_indent:
|
||||||
return str(line_number)
|
return str(line_number)
|
||||||
|
|
||||||
# EOF so must be end of conversation
|
# EOF so it's also the end of a block
|
||||||
return DialogueConstants.ID_END_CONVERSATION
|
return DialogueConstants.ID_END
|
||||||
|
|
||||||
|
|
||||||
## Get the names of any autoloads in the project
|
## Get the names of any autoloads in the project
|
||||||
|
@ -1529,10 +1525,15 @@ func build_token_tree(tokens: Array[Dictionary], line_type: String, expected_clo
|
||||||
DialogueConstants.TOKEN_ASSIGNMENT, \
|
DialogueConstants.TOKEN_ASSIGNMENT, \
|
||||||
DialogueConstants.TOKEN_OPERATOR, \
|
DialogueConstants.TOKEN_OPERATOR, \
|
||||||
DialogueConstants.TOKEN_AND_OR, \
|
DialogueConstants.TOKEN_AND_OR, \
|
||||||
DialogueConstants.TOKEN_VARIABLE: \
|
DialogueConstants.TOKEN_VARIABLE:
|
||||||
|
var value = token.value.strip_edges()
|
||||||
|
if value == "&&":
|
||||||
|
value = "and"
|
||||||
|
elif value == "||":
|
||||||
|
value = "or"
|
||||||
tree.append({
|
tree.append({
|
||||||
type = token.type,
|
type = token.type,
|
||||||
value = token.value.strip_edges()
|
value = value
|
||||||
})
|
})
|
||||||
|
|
||||||
DialogueConstants.TOKEN_STRING:
|
DialogueConstants.TOKEN_STRING:
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
||||||
@icon("./assets/responses_menu.svg")
|
@icon("./assets/responses_menu.svg")
|
||||||
|
|
||||||
## A VBoxContainer for dialogue responses provided by [b]Dialogue Manager[/b].
|
## A [Container] for dialogue responses provided by [b]Dialogue Manager[/b].
|
||||||
class_name DialogueResponsesMenu extends VBoxContainer
|
class_name DialogueResponsesMenu extends Container
|
||||||
|
|
||||||
|
|
||||||
## Emitted when a response is selected.
|
## Emitted when a response is selected.
|
||||||
|
@ -14,8 +14,10 @@ signal response_selected(response)
|
||||||
## The action for accepting a response (is possibly overridden by parent dialogue balloon).
|
## The action for accepting a response (is possibly overridden by parent dialogue balloon).
|
||||||
@export var next_action: StringName = &""
|
@export var next_action: StringName = &""
|
||||||
|
|
||||||
# The list of dialogue responses.
|
## The list of dialogue responses.
|
||||||
var responses: Array = []:
|
var responses: Array = []:
|
||||||
|
get:
|
||||||
|
return responses
|
||||||
set(value):
|
set(value):
|
||||||
responses = value
|
responses = value
|
||||||
|
|
||||||
|
@ -64,11 +66,25 @@ func _ready() -> void:
|
||||||
response_template.hide()
|
response_template.hide()
|
||||||
|
|
||||||
|
|
||||||
# This is deprecated.
|
## Get the selectable items in the menu.
|
||||||
|
func get_menu_items() -> Array:
|
||||||
|
var items: Array = []
|
||||||
|
for child in get_children():
|
||||||
|
if not child.visible: continue
|
||||||
|
if "Disallowed" in child.name: continue
|
||||||
|
items.append(child)
|
||||||
|
|
||||||
|
return items
|
||||||
|
|
||||||
|
|
||||||
|
## [b]DEPRECATED[/b]. Do not use.
|
||||||
func set_responses(next_responses: Array) -> void:
|
func set_responses(next_responses: Array) -> void:
|
||||||
self.responses = next_responses
|
self.responses = next_responses
|
||||||
|
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
|
||||||
|
|
||||||
# Prepare the menu for keyboard and mouse navigation.
|
# Prepare the menu for keyboard and mouse navigation.
|
||||||
func _configure_focus() -> void:
|
func _configure_focus() -> void:
|
||||||
var items = get_menu_items()
|
var items = get_menu_items()
|
||||||
|
@ -100,18 +116,9 @@ func _configure_focus() -> void:
|
||||||
items[0].grab_focus()
|
items[0].grab_focus()
|
||||||
|
|
||||||
|
|
||||||
## Get the selectable items in the menu.
|
#endregion
|
||||||
func get_menu_items() -> Array:
|
|
||||||
var items: Array = []
|
|
||||||
for child in get_children():
|
|
||||||
if not child.visible: continue
|
|
||||||
if "Disallowed" in child.name: continue
|
|
||||||
items.append(child)
|
|
||||||
|
|
||||||
return items
|
#region Signals
|
||||||
|
|
||||||
|
|
||||||
### Signals
|
|
||||||
|
|
||||||
|
|
||||||
func _on_response_mouse_entered(item: Control) -> void:
|
func _on_response_mouse_entered(item: Control) -> void:
|
||||||
|
@ -129,3 +136,6 @@ func _on_response_gui_input(event: InputEvent, item: Control, response) -> void:
|
||||||
response_selected.emit(response)
|
response_selected.emit(response)
|
||||||
elif event.is_action_pressed(&"ui_accept" if next_action.is_empty() else next_action) and item in get_menu_items():
|
elif event.is_action_pressed(&"ui_accept" if next_action.is_empty() else next_action) and item in get_menu_items():
|
||||||
response_selected.emit(response)
|
response_selected.emit(response)
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
|
@ -105,6 +105,21 @@ namespace DialogueManagerRuntime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override async void _Notification(int what)
|
||||||
|
{
|
||||||
|
// Detect a change of locale and update the current dialogue line to show the new language
|
||||||
|
if (what == NotificationTranslationChanged)
|
||||||
|
{
|
||||||
|
float visibleRatio = dialogueLabel.VisibleRatio;
|
||||||
|
DialogueLine = await DialogueManager.GetNextDialogueLine(resource, DialogueLine.Id, temporaryGameStates);
|
||||||
|
if (visibleRatio < 1.0f)
|
||||||
|
{
|
||||||
|
dialogueLabel.Call("skip_typing");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public async void Start(Resource dialogueResource, string title, Array<Variant> extraGameStates = null)
|
public async void Start(Resource dialogueResource, string title, Array<Variant> extraGameStates = null)
|
||||||
{
|
{
|
||||||
temporaryGameStates = extraGameStates ?? new Array<Variant>();
|
temporaryGameStates = extraGameStates ?? new Array<Variant>();
|
||||||
|
|
|
@ -89,6 +89,15 @@ func _unhandled_input(_event: InputEvent) -> void:
|
||||||
get_viewport().set_input_as_handled()
|
get_viewport().set_input_as_handled()
|
||||||
|
|
||||||
|
|
||||||
|
func _notification(what: int) -> void:
|
||||||
|
# Detect a change of locale and update the current dialogue line to show the new language
|
||||||
|
if what == NOTIFICATION_TRANSLATION_CHANGED:
|
||||||
|
var visible_ratio = dialogue_label.visible_ratio
|
||||||
|
self.dialogue_line = await resource.get_next_dialogue_line(dialogue_line.id)
|
||||||
|
if visible_ratio < 1:
|
||||||
|
dialogue_label.skip_typing()
|
||||||
|
|
||||||
|
|
||||||
## Start some dialogue
|
## Start some dialogue
|
||||||
func start(dialogue_resource: DialogueResource, title: String, extra_game_states: Array = []) -> void:
|
func start(dialogue_resource: DialogueResource, title: String, extra_game_states: Array = []) -> void:
|
||||||
temporary_game_states = [self] + extra_game_states
|
temporary_game_states = [self] + extra_game_states
|
||||||
|
@ -102,7 +111,7 @@ func next(next_id: String) -> void:
|
||||||
self.dialogue_line = await resource.get_next_dialogue_line(next_id, temporary_game_states)
|
self.dialogue_line = await resource.get_next_dialogue_line(next_id, temporary_game_states)
|
||||||
|
|
||||||
|
|
||||||
### Signals
|
#region Signals
|
||||||
|
|
||||||
|
|
||||||
func _on_mutated(_mutation: Dictionary) -> void:
|
func _on_mutated(_mutation: Dictionary) -> void:
|
||||||
|
@ -139,3 +148,6 @@ func _on_balloon_gui_input(event: InputEvent) -> void:
|
||||||
|
|
||||||
func _on_responses_menu_response_selected(response: DialogueResponse) -> void:
|
func _on_responses_menu_response_selected(response: DialogueResponse) -> void:
|
||||||
next(response.next_id)
|
next(response.next_id)
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
|
@ -8,7 +8,7 @@ signal compiled_resource(resource: Resource)
|
||||||
const DialogueResource = preload("./dialogue_resource.gd")
|
const DialogueResource = preload("./dialogue_resource.gd")
|
||||||
const DialogueManagerParseResult = preload("./components/parse_result.gd")
|
const DialogueManagerParseResult = preload("./components/parse_result.gd")
|
||||||
|
|
||||||
const compiler_version = 11
|
const compiler_version = 12
|
||||||
|
|
||||||
|
|
||||||
func _get_importer_name() -> String:
|
func _get_importer_name() -> String:
|
||||||
|
|
|
@ -4,7 +4,7 @@ msgstr ""
|
||||||
"POT-Creation-Date: \n"
|
"POT-Creation-Date: \n"
|
||||||
"PO-Revision-Date: \n"
|
"PO-Revision-Date: \n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: penghao123456、憨憨羊の宇航鸽鸽\n"
|
"Language-Team: penghao123456、憨憨羊の宇航鸽鸽、ABShinri\n"
|
||||||
"Language: zh\n"
|
"Language: zh\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
@ -29,6 +29,9 @@ msgstr "清空历史记录"
|
||||||
msgid "save_all_files"
|
msgid "save_all_files"
|
||||||
msgstr "保存所有文件"
|
msgstr "保存所有文件"
|
||||||
|
|
||||||
|
msgid "find_in_files"
|
||||||
|
msgstr "在文件中查找"
|
||||||
|
|
||||||
msgid "test_dialogue"
|
msgid "test_dialogue"
|
||||||
msgstr "测试对话"
|
msgstr "测试对话"
|
||||||
|
|
||||||
|
@ -51,10 +54,10 @@ msgid "docs"
|
||||||
msgstr "文档"
|
msgstr "文档"
|
||||||
|
|
||||||
msgid "insert.wave_bbcode"
|
msgid "insert.wave_bbcode"
|
||||||
msgstr "BBCode [lb]wave[rb]"
|
msgstr "波浪效果"
|
||||||
|
|
||||||
msgid "insert.shake_bbcode"
|
msgid "insert.shake_bbcode"
|
||||||
msgstr "BBCode [lb]wave[rb]"
|
msgstr "抖动效果"
|
||||||
|
|
||||||
msgid "insert.typing_pause"
|
msgid "insert.typing_pause"
|
||||||
msgstr "输入间隔"
|
msgstr "输入间隔"
|
||||||
|
@ -95,6 +98,9 @@ msgstr "结束对话"
|
||||||
msgid "generate_line_ids"
|
msgid "generate_line_ids"
|
||||||
msgstr "生成行 ID"
|
msgstr "生成行 ID"
|
||||||
|
|
||||||
|
msgid "save_characters_to_csv"
|
||||||
|
msgstr "保存角色到 CSV"
|
||||||
|
|
||||||
msgid "save_to_csv"
|
msgid "save_to_csv"
|
||||||
msgstr "生成 CSV"
|
msgstr "生成 CSV"
|
||||||
|
|
||||||
|
@ -134,6 +140,9 @@ msgstr "在 Godot 侧边栏中显示"
|
||||||
msgid "settings.revert_to_default_test_scene"
|
msgid "settings.revert_to_default_test_scene"
|
||||||
msgstr "重置测试场景设定"
|
msgstr "重置测试场景设定"
|
||||||
|
|
||||||
|
msgid "settings.default_balloon_hint"
|
||||||
|
msgstr "设置调用 \"DialogueManager.show_balloon()\" 时使用的对话框"
|
||||||
|
|
||||||
msgid "settings.autoload"
|
msgid "settings.autoload"
|
||||||
msgstr "Autoload"
|
msgstr "Autoload"
|
||||||
|
|
||||||
|
@ -150,10 +159,10 @@ msgid "settings.missing_keys_hint"
|
||||||
msgstr "如果你使用静态键,这将会帮助你寻找未添加至翻译文件的键。"
|
msgstr "如果你使用静态键,这将会帮助你寻找未添加至翻译文件的键。"
|
||||||
|
|
||||||
msgid "settings.characters_translations"
|
msgid "settings.characters_translations"
|
||||||
msgstr "在翻译文件中导出角色名。"
|
msgstr "在翻译文件中导出角色名"
|
||||||
|
|
||||||
msgid "settings.wrap_long_lines"
|
msgid "settings.wrap_long_lines"
|
||||||
msgstr "自动折行"
|
msgstr "文本编辑器自动换行"
|
||||||
|
|
||||||
msgid "settings.include_failed_responses"
|
msgid "settings.include_failed_responses"
|
||||||
msgstr "在判断条件失败时仍显示回复选项"
|
msgstr "在判断条件失败时仍显示回复选项"
|
||||||
|
@ -176,9 +185,39 @@ msgstr "当一个 Autoload 在这里被勾选,他的所有成员会被映射
|
||||||
msgid "settings.states_hint"
|
msgid "settings.states_hint"
|
||||||
msgstr "比如,当你开启对于“Foo”的映射时,你可以将“Foo.bar”简写成“bar”。"
|
msgstr "比如,当你开启对于“Foo”的映射时,你可以将“Foo.bar”简写成“bar”。"
|
||||||
|
|
||||||
|
msgid "settings.recompile_warning"
|
||||||
|
msgstr "更改这些选项会强制重新编译所有的对话框,当你清楚在做什么的时候更改。"
|
||||||
|
|
||||||
|
msgid "settings.create_lines_for_responses_with_characters"
|
||||||
|
msgstr "回复项带角色名时(- char: response),会自动生成为选择后的下一句对话"
|
||||||
|
|
||||||
|
msgid "settings.include_characters_in_translations"
|
||||||
|
msgstr "导出 CSV 时包括角色名"
|
||||||
|
|
||||||
|
msgid "settings.include_notes_in_translations"
|
||||||
|
msgstr "导出 CSV 时包括注释(## comments)"
|
||||||
|
|
||||||
|
msgid "settings.check_for_updates"
|
||||||
|
msgstr "检查升级"
|
||||||
|
|
||||||
msgid "n_of_n"
|
msgid "n_of_n"
|
||||||
msgstr "第{index}个,共{total}个"
|
msgstr "第{index}个,共{total}个"
|
||||||
|
|
||||||
|
msgid "search.find"
|
||||||
|
msgstr "查找:"
|
||||||
|
|
||||||
|
msgid "search.find_all"
|
||||||
|
msgstr "查找全部..."
|
||||||
|
|
||||||
|
msgid "search.placeholder"
|
||||||
|
msgstr "请输入查找的内容"
|
||||||
|
|
||||||
|
msgid "search.replace_placeholder"
|
||||||
|
msgstr "请输入替换的内容"
|
||||||
|
|
||||||
|
msgid "search.replace_selected"
|
||||||
|
msgstr "替换勾选"
|
||||||
|
|
||||||
msgid "search.previous"
|
msgid "search.previous"
|
||||||
msgstr "查找上一个"
|
msgstr "查找上一个"
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ msgstr ""
|
||||||
"POT-Creation-Date: \n"
|
"POT-Creation-Date: \n"
|
||||||
"PO-Revision-Date: \n"
|
"PO-Revision-Date: \n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: 憨憨羊の宇航鴿鴿\n"
|
"Language-Team: 憨憨羊の宇航鴿鴿、ABShinri\n"
|
||||||
"Language: zh_TW\n"
|
"Language: zh_TW\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
@ -29,6 +29,9 @@ msgstr "清空歷史記錄"
|
||||||
msgid "save_all_files"
|
msgid "save_all_files"
|
||||||
msgstr "儲存所有檔案"
|
msgstr "儲存所有檔案"
|
||||||
|
|
||||||
|
msgid "find_in_files"
|
||||||
|
msgstr "在檔案中查找"
|
||||||
|
|
||||||
msgid "test_dialogue"
|
msgid "test_dialogue"
|
||||||
msgstr "測試對話"
|
msgstr "測試對話"
|
||||||
|
|
||||||
|
@ -51,10 +54,10 @@ msgid "docs"
|
||||||
msgstr "文檔"
|
msgstr "文檔"
|
||||||
|
|
||||||
msgid "insert.wave_bbcode"
|
msgid "insert.wave_bbcode"
|
||||||
msgstr "BBCode [lb]wave[rb]"
|
msgstr "波浪特效"
|
||||||
|
|
||||||
msgid "insert.shake_bbcode"
|
msgid "insert.shake_bbcode"
|
||||||
msgstr "BBCode [lb]wave[rb]"
|
msgstr "震動特效"
|
||||||
|
|
||||||
msgid "insert.typing_pause"
|
msgid "insert.typing_pause"
|
||||||
msgstr "輸入間隔"
|
msgstr "輸入間隔"
|
||||||
|
@ -95,6 +98,9 @@ msgstr "結束對話"
|
||||||
msgid "generate_line_ids"
|
msgid "generate_line_ids"
|
||||||
msgstr "生成行 ID"
|
msgstr "生成行 ID"
|
||||||
|
|
||||||
|
msgid "save_characters_to_csv"
|
||||||
|
msgstr "保存角色到 CSV"
|
||||||
|
|
||||||
msgid "save_to_csv"
|
msgid "save_to_csv"
|
||||||
msgstr "生成 CSV"
|
msgstr "生成 CSV"
|
||||||
|
|
||||||
|
@ -134,6 +140,9 @@ msgstr "在 Godot 側邊欄中顯示"
|
||||||
msgid "settings.revert_to_default_test_scene"
|
msgid "settings.revert_to_default_test_scene"
|
||||||
msgstr "重置測試場景設定"
|
msgstr "重置測試場景設定"
|
||||||
|
|
||||||
|
msgid "settings.default_balloon_hint"
|
||||||
|
msgstr "設置使用 \"DialogueManager.show_balloon()\" 时的对话框"
|
||||||
|
|
||||||
msgid "settings.autoload"
|
msgid "settings.autoload"
|
||||||
msgstr "Autoload"
|
msgstr "Autoload"
|
||||||
|
|
||||||
|
@ -176,9 +185,39 @@ msgstr "當一個 Autoload 在這裏被勾選,他的所有成員會被映射
|
||||||
msgid "settings.states_hint"
|
msgid "settings.states_hint"
|
||||||
msgstr "比如,當你開啓對於“Foo”的映射時,你可以將“Foo.bar”簡寫成“bar”。"
|
msgstr "比如,當你開啓對於“Foo”的映射時,你可以將“Foo.bar”簡寫成“bar”。"
|
||||||
|
|
||||||
|
msgid "settings.recompile_warning"
|
||||||
|
msgstr "更改這些選項會強制重新編譯所有的對話框,當你清楚在做什麼的時候更改。"
|
||||||
|
|
||||||
|
msgid "settings.create_lines_for_responses_with_characters"
|
||||||
|
msgstr "回覆項目帶角色名稱時(- char: response),會自動產生為選擇後的下一句對話"
|
||||||
|
|
||||||
|
msgid "settings.include_characters_in_translations"
|
||||||
|
msgstr "匯出 CSV 時包含角色名"
|
||||||
|
|
||||||
|
msgid "settings.include_notes_in_translations"
|
||||||
|
msgstr "匯出 CSV 時包括註解(## comments)"
|
||||||
|
|
||||||
|
msgid "settings.check_for_updates"
|
||||||
|
msgstr "檢查升級"
|
||||||
|
|
||||||
msgid "n_of_n"
|
msgid "n_of_n"
|
||||||
msgstr "第{index}個,共{total}個"
|
msgstr "第{index}個,共{total}個"
|
||||||
|
|
||||||
|
msgid "search.find"
|
||||||
|
msgstr "搜尋:"
|
||||||
|
|
||||||
|
msgid "search.find_all"
|
||||||
|
msgstr "搜尋全部..."
|
||||||
|
|
||||||
|
msgid "search.placeholder"
|
||||||
|
msgstr "請輸入搜尋的內容"
|
||||||
|
|
||||||
|
msgid "search.replace_placeholder"
|
||||||
|
msgstr "請輸入替換的內容"
|
||||||
|
|
||||||
|
msgid "search.replace_selected"
|
||||||
|
msgstr "替換勾選"
|
||||||
|
|
||||||
msgid "search.previous"
|
msgid "search.previous"
|
||||||
msgstr "搜尋上一個"
|
msgstr "搜尋上一個"
|
||||||
|
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
name="Dialogue Manager"
|
name="Dialogue Manager"
|
||||||
description="A simple but powerful branching dialogue system"
|
description="A simple but powerful branching dialogue system"
|
||||||
author="Nathan Hoad"
|
author="Nathan Hoad"
|
||||||
version="2.38.0"
|
version="2.39.1"
|
||||||
script="plugin.gd"
|
script="plugin.gd"
|
||||||
|
|
|
@ -145,6 +145,80 @@ func _build() -> bool:
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
|
## Get the shortcuts used by the plugin
|
||||||
|
func get_editor_shortcuts() -> Dictionary:
|
||||||
|
var shortcuts: Dictionary = {
|
||||||
|
toggle_comment = [
|
||||||
|
_create_event("Ctrl+K"),
|
||||||
|
_create_event("Ctrl+Slash")
|
||||||
|
],
|
||||||
|
move_up = [
|
||||||
|
_create_event("Alt+Up")
|
||||||
|
],
|
||||||
|
move_down = [
|
||||||
|
_create_event("Alt+Down")
|
||||||
|
],
|
||||||
|
save = [
|
||||||
|
_create_event("Ctrl+Alt+S")
|
||||||
|
],
|
||||||
|
close_file = [
|
||||||
|
_create_event("Ctrl+W")
|
||||||
|
],
|
||||||
|
find_in_files = [
|
||||||
|
_create_event("Ctrl+Shift+F")
|
||||||
|
],
|
||||||
|
|
||||||
|
run_test_scene = [
|
||||||
|
_create_event("Ctrl+F5")
|
||||||
|
],
|
||||||
|
text_size_increase = [
|
||||||
|
_create_event("Ctrl+Equal")
|
||||||
|
],
|
||||||
|
text_size_decrease = [
|
||||||
|
_create_event("Ctrl+Minus")
|
||||||
|
],
|
||||||
|
text_size_reset = [
|
||||||
|
_create_event("Ctrl+0")
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
var paths = get_editor_interface().get_editor_paths()
|
||||||
|
var settings = load(paths.get_config_dir() + "/editor_settings-4.tres")
|
||||||
|
|
||||||
|
if not settings: return shortcuts
|
||||||
|
|
||||||
|
for s in settings.get("shortcuts"):
|
||||||
|
for key in shortcuts:
|
||||||
|
if s.name == "script_text_editor/%s" % key or s.name == "script_editor/%s" % key:
|
||||||
|
shortcuts[key] = []
|
||||||
|
for event in s.shortcuts:
|
||||||
|
if event is InputEventKey:
|
||||||
|
shortcuts[key].append(event)
|
||||||
|
|
||||||
|
return shortcuts
|
||||||
|
|
||||||
|
|
||||||
|
func _create_event(string: String) -> InputEventKey:
|
||||||
|
var event: InputEventKey = InputEventKey.new()
|
||||||
|
var bits = string.split("+")
|
||||||
|
event.keycode = OS.find_keycode_from_string(bits[bits.size() - 1])
|
||||||
|
event.shift_pressed = bits.has("Shift")
|
||||||
|
event.alt_pressed = bits.has("Alt")
|
||||||
|
if bits.has("Ctrl") or bits.has("Command"):
|
||||||
|
event.command_or_control_autoremap = true
|
||||||
|
return event
|
||||||
|
|
||||||
|
|
||||||
|
## Get the editor shortcut that matches an event
|
||||||
|
func get_editor_shortcut(event: InputEventKey) -> String:
|
||||||
|
var shortcuts: Dictionary = get_editor_shortcuts()
|
||||||
|
for key in shortcuts:
|
||||||
|
for shortcut in shortcuts.get(key, []):
|
||||||
|
if event.is_match(shortcut):
|
||||||
|
return key
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
## Get the current version
|
## Get the current version
|
||||||
func get_version() -> String:
|
func get_version() -> String:
|
||||||
var config: ConfigFile = ConfigFile.new()
|
var config: ConfigFile = ConfigFile.new()
|
||||||
|
|
|
@ -176,9 +176,5 @@ static func has_dotnet_solution() -> bool:
|
||||||
var has_dotnet_solution: bool = FileAccess.file_exists("res://%s/%s.sln" % [directory, file_name])
|
var has_dotnet_solution: bool = FileAccess.file_exists("res://%s/%s.sln" % [directory, file_name])
|
||||||
set_user_value("has_dotnet_solution", has_dotnet_solution)
|
set_user_value("has_dotnet_solution", has_dotnet_solution)
|
||||||
return has_dotnet_solution
|
return has_dotnet_solution
|
||||||
else:
|
|
||||||
var plugin_path: String = new().get_script().resource_path.get_base_dir()
|
|
||||||
if not ResourceLoader.exists(plugin_path + "/DialogueManager.cs"): return false
|
|
||||||
if load(plugin_path + "/DialogueManager.cs") == null: return false
|
|
||||||
|
|
||||||
return true
|
return false
|
||||||
|
|
|
@ -11,7 +11,8 @@ const SUPPORTED_BUILTIN_TYPES = [
|
||||||
TYPE_DICTIONARY,
|
TYPE_DICTIONARY,
|
||||||
TYPE_QUATERNION,
|
TYPE_QUATERNION,
|
||||||
TYPE_COLOR,
|
TYPE_COLOR,
|
||||||
TYPE_SIGNAL
|
TYPE_SIGNAL,
|
||||||
|
TYPE_CALLABLE
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -181,19 +181,20 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||||
if not visible: return
|
if not visible: return
|
||||||
|
|
||||||
if event is InputEventKey and event.is_pressed():
|
if event is InputEventKey and event.is_pressed():
|
||||||
match event.as_text():
|
var shortcut: String = Engine.get_meta("DialogueManagerPlugin").get_editor_shortcut(event)
|
||||||
"Ctrl+Alt+S", "Command+Alt+S":
|
match shortcut:
|
||||||
get_viewport().set_input_as_handled()
|
"close_file":
|
||||||
save_file(current_file_path)
|
|
||||||
"Ctrl+W", "Command+W":
|
|
||||||
get_viewport().set_input_as_handled()
|
get_viewport().set_input_as_handled()
|
||||||
close_file(current_file_path)
|
close_file(current_file_path)
|
||||||
"Ctrl+F5", "Command+F5":
|
"save":
|
||||||
get_viewport().set_input_as_handled()
|
get_viewport().set_input_as_handled()
|
||||||
_on_test_button_pressed()
|
save_file(current_file_path)
|
||||||
"Ctrl+Shift+F", "Command+Shift+F":
|
"find_in_files":
|
||||||
get_viewport().set_input_as_handled()
|
get_viewport().set_input_as_handled()
|
||||||
_on_find_in_files_button_pressed()
|
_on_find_in_files_button_pressed()
|
||||||
|
"run_test_scene":
|
||||||
|
get_viewport().set_input_as_handled()
|
||||||
|
_on_test_button_pressed()
|
||||||
|
|
||||||
|
|
||||||
func apply_changes() -> void:
|
func apply_changes() -> void:
|
||||||
|
@ -1044,9 +1045,11 @@ func _on_files_list_file_middle_clicked(path: String):
|
||||||
func _on_files_popup_menu_about_to_popup() -> void:
|
func _on_files_popup_menu_about_to_popup() -> void:
|
||||||
files_popup_menu.clear()
|
files_popup_menu.clear()
|
||||||
|
|
||||||
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.save"), ITEM_SAVE, KEY_MASK_CTRL | KEY_MASK_ALT | KEY_S)
|
var shortcuts: Dictionary = Engine.get_meta("DialogueManagerPlugin").get_editor_shortcuts()
|
||||||
|
|
||||||
|
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.save"), ITEM_SAVE, OS.find_keycode_from_string(shortcuts.get("save")[0].as_text_keycode()))
|
||||||
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.save_as"), ITEM_SAVE_AS)
|
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.save_as"), ITEM_SAVE_AS)
|
||||||
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.close"), ITEM_CLOSE, KEY_MASK_CTRL | KEY_W)
|
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.close"), ITEM_CLOSE, OS.find_keycode_from_string(shortcuts.get("close_file")[0].as_text_keycode()))
|
||||||
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.close_all"), ITEM_CLOSE_ALL)
|
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.close_all"), ITEM_CLOSE_ALL)
|
||||||
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.close_other_files"), ITEM_CLOSE_OTHERS)
|
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.close_other_files"), ITEM_CLOSE_OTHERS)
|
||||||
files_popup_menu.add_separator()
|
files_popup_menu.add_separator()
|
||||||
|
|
Loading…
Reference in New Issue