First work on dialogic, resized guild, and started implementing portraits.

This commit is contained in:
2025-08-14 10:26:24 -04:00
parent 95a7db036b
commit 3aeb3d44e6
959 changed files with 47688 additions and 46 deletions

View File

@@ -0,0 +1,161 @@
@tool
class_name DialogicJumpEvent
extends DialogicEvent
## Event that allows starting another timeline. Also can jump to a label in that or the current timeline.
### Settings
## The timeline to jump to, if null then it's the current one. This setting should be a dialogic timeline resource.
var timeline: DialogicTimeline
## If not empty, the event will try to find a Label event with this set as name. Empty by default..
var label_name := ""
### Helpers
## Used to set the timeline resource from the unique name identifier and vice versa
var timeline_identifier := "":
get:
if timeline:
var identifier := DialogicResourceUtil.get_unique_identifier(timeline.resource_path)
if not identifier.is_empty():
return identifier
return timeline_identifier
set(value):
timeline_identifier = value
timeline = DialogicResourceUtil.get_timeline_resource(value)
if (not timeline_identifier in DialogicResourceUtil.get_label_cache().keys()
or not label_name in DialogicResourceUtil.get_label_cache()[timeline_identifier]):
label_name = ""
ui_update_needed.emit()
################################################################################
## EXECUTION
################################################################################
func _execute() -> void:
dialogic.Jump.push_to_jump_stack()
if timeline and timeline != dialogic.current_timeline:
dialogic.Jump.switched_timeline.emit({'previous_timeline':dialogic.current_timeline, 'timeline':timeline, 'label':label_name})
dialogic.start_timeline(timeline, label_name)
else:
if label_name:
dialogic.Jump.jump_to_label(label_name)
finish()
else:
dialogic.start_timeline(dialogic.current_timeline)
################################################################################
## INITIALIZE
################################################################################
func _init() -> void:
event_name = "Jump"
set_default_color('Color4')
event_category = "Flow"
event_sorting_index = 4
func _get_icon() -> Resource:
return load(self.get_script().get_path().get_base_dir().path_join('icon_jump.png'))
################################################################################
## SAVING/LOADING
################################################################################
func to_text() -> String:
var result := "jump "
if timeline_identifier:
result += timeline_identifier+'/'
if label_name:
result += label_name
elif label_name:
result += label_name
return result
func from_text(string:String) -> void:
var result := RegEx.create_from_string(r"jump (?<timeline>.*\/)?(?<label>.*)?").search(string.strip_edges())
if result:
timeline_identifier = result.get_string('timeline').trim_suffix('/')
label_name = result.get_string('label')
func is_valid_event(string:String) -> bool:
if string.strip_edges().begins_with("jump"):
return true
return false
func get_shortcode_parameters() -> Dictionary:
return {
#param_name : property_info
"timeline" : {"property": "timeline_identifier", "default": null,
"suggestions": get_timeline_suggestions},
"label" : {"property": "label_name", "default": ""},
}
################################################################################
## EDITOR REPRESENTATION
################################################################################
func build_event_editor() -> void:
add_header_edit('timeline_identifier', ValueType.DYNAMIC_OPTIONS, {'left_text':'Jump to',
'file_extension': '.dtl',
'mode' : 2,
'suggestions_func': get_timeline_suggestions,
'editor_icon' : ["TripleBar", "EditorIcons"],
'empty_text' : '(this timeline)',
'autofocus' : true,
})
add_header_edit("label_name", ValueType.DYNAMIC_OPTIONS, {'left_text':"at",
'empty_text':'the beginning',
'suggestions_func':get_label_suggestions,
'editor_icon':["ArrowRight", "EditorIcons"]})
func get_timeline_suggestions(_filter:String= "") -> Dictionary:
var suggestions := {}
suggestions['(this timeline)'] = {'value':'', 'editor_icon':['GuiRadioUnchecked', 'EditorIcons']}
for resource in DialogicResourceUtil.get_timeline_directory().keys():
suggestions[resource] = {'value': resource, 'tooltip':DialogicResourceUtil.get_timeline_directory()[resource], 'editor_icon': ["TripleBar", "EditorIcons"]}
return suggestions
func get_label_suggestions(_filter:String="") -> Dictionary:
var suggestions := {}
suggestions['at the beginning'] = {'value':'', 'editor_icon':['GuiRadioUnchecked', 'EditorIcons']}
if timeline_identifier in DialogicResourceUtil.get_label_cache().keys():
for label in DialogicResourceUtil.get_label_cache()[timeline_identifier]:
suggestions[label] = {'value': label, 'tooltip':label, 'editor_icon': ["ArrowRight", "EditorIcons"]}
return suggestions
####################### CODE COMPLETION ########################################
################################################################################
func _get_code_completion(CodeCompletionHelper:Node, TextNode:TextEdit, line:String, _word:String, symbol:String) -> void:
if symbol == ' ' and line.count(' ') == 1:
CodeCompletionHelper.suggest_labels(TextNode, '', '\n', event_color.lerp(TextNode.syntax_highlighter.normal_color, 0.6))
CodeCompletionHelper.suggest_timelines(TextNode, CodeEdit.KIND_MEMBER, event_color.lerp(TextNode.syntax_highlighter.normal_color, 0.6))
if symbol == '/':
CodeCompletionHelper.suggest_labels(TextNode, line.strip_edges().trim_prefix('jump ').trim_suffix('/'+String.chr(0xFFFF)).strip_edges(), '\n', event_color.lerp(TextNode.syntax_highlighter.normal_color, 0.6))
func _get_start_code_completion(_CodeCompletionHelper:Node, TextNode:TextEdit) -> void:
TextNode.add_code_completion_option(CodeEdit.KIND_PLAIN_TEXT, 'jump', 'jump ', event_color.lerp(TextNode.syntax_highlighter.normal_color, 0.3))
#################### SYNTAX HIGHLIGHTING #######################################
################################################################################
func _get_syntax_highlighting(Highlighter:SyntaxHighlighter, dict:Dictionary, line:String) -> Dictionary:
dict[line.find('jump')] = {"color":event_color.lerp(Highlighter.normal_color, 0.3)}
dict[line.find('jump')+4] = {"color":event_color.lerp(Highlighter.normal_color, 0.5)}
return dict

View File

@@ -0,0 +1 @@
uid://bjxxkoxsvvsqd

View File

@@ -0,0 +1,114 @@
@tool
class_name DialogicLabelEvent
extends DialogicEvent
## Event that is used as an anchor. You can use the DialogicJumpEvent to jump to this point.
### Settings
## Used to identify the label. Duplicate names in a timeline will mean it always chooses the first.
var name := ""
var display_name := ""
################################################################################
## EXECUTE
################################################################################
func _execute() -> void:
# This event is mainly implemented in the Jump subsystem.
dialogic.Jump.passed_label.emit(
{
"identifier": name,
"display_name": get_property_translated("display_name"),
"display_name_orig": display_name,
"timeline": DialogicResourceUtil.get_unique_identifier(dialogic.current_timeline.resource_path)
})
finish()
################################################################################
## INITIALIZE
################################################################################
func _init() -> void:
event_name = "Label"
set_default_color('Color4')
event_category = "Flow"
event_sorting_index = 3
func _get_icon() -> Resource:
return load(self.get_script().get_path().get_base_dir().path_join('icon_label.png'))
################################################################################
## SAVING/LOADING
################################################################################
func to_text() -> String:
if display_name.is_empty():
return "label "+name
else:
return "label "+name+ " ("+display_name+")"
func from_text(string:String) -> void:
var regex := RegEx.create_from_string(r'label +(?<name>[^(]+)(\((?<display_name>.+)\))?')
var result := regex.search(string.strip_edges())
if result:
name = result.get_string('name').strip_edges()
display_name = result.get_string('display_name').strip_edges()
func is_valid_event(string:String) -> bool:
if string.strip_edges().begins_with("label"):
return true
return false
# this is only here to provide a list of default values
# this way the module manager can add custom default overrides to this event.
func get_shortcode_parameters() -> Dictionary:
return {
#param_name : property_info
"name" : {"property": "name", "default": ""},
"display" : {"property": "display_name", "default": ""},
}
func _get_translatable_properties() -> Array:
return ["display_name"]
func _get_property_original_translation(property_name:String) -> String:
match property_name:
'display_name':
return display_name
return ''
################################################################################
## EDITOR REPRESENTATION
################################################################################
func build_event_editor() -> void:
add_header_edit('name', ValueType.SINGLELINE_TEXT, {'left_text':'Label', 'autofocus':true})
add_body_edit('display_name', ValueType.SINGLELINE_TEXT, {'left_text':'Display Name:'})
####################### CODE COMPLETION ########################################
################################################################################
func _get_start_code_completion(_CodeCompletionHelper:Node, TextNode:TextEdit) -> void:
TextNode.add_code_completion_option(CodeEdit.KIND_PLAIN_TEXT, 'label', 'label ', event_color.lerp(TextNode.syntax_highlighter.normal_color, 0.3))
#################### SYNTAX HIGHLIGHTING #######################################
################################################################################
func _get_syntax_highlighting(Highlighter:SyntaxHighlighter, dict:Dictionary, line:String) -> Dictionary:
dict[line.find('label')] = {"color":event_color.lerp(Highlighter.normal_color, 0.3)}
dict[line.find('label')+5] = {"color":event_color.lerp(Highlighter.normal_color, 0.5)}
return dict

View File

@@ -0,0 +1 @@
uid://6cy32ewbhhsx

View File

@@ -0,0 +1,73 @@
@tool
class_name DialogicReturnEvent
extends DialogicEvent
## Event that will make dialogic jump back to the last jump point.
################################################################################
## EXECUTION
################################################################################
func _execute() -> void:
if !dialogic.Jump.is_jump_stack_empty():
dialogic.Jump.resume_from_last_jump()
else:
dialogic.end_timeline()
################################################################################
## INITIALIZE
################################################################################
func _init() -> void:
event_name = "Return"
set_default_color('Color4')
event_category = "Flow"
event_sorting_index = 5
func _get_icon() -> Resource:
return load(self.get_script().get_path().get_base_dir().path_join('icon_return.svg'))
################################################################################
## SAVING/LOADING
################################################################################
func to_text() -> String:
return "return"
func from_text(_string:String) -> void:
pass
func is_valid_event(string:String) -> bool:
if string.strip_edges() == "return":
return true
return false
################################################################################
## EDITOR REPRESENTATION
################################################################################
func build_event_editor() -> void:
add_header_label('Return')
####################### CODE COMPLETION ########################################
################################################################################
func _get_start_code_completion(_CodeCompletionHelper:Node, TextNode:TextEdit) -> void:
TextNode.add_code_completion_option(CodeEdit.KIND_PLAIN_TEXT, 'return', 'return\n', event_color.lerp(TextNode.syntax_highlighter.normal_color, 0.3))
#################### SYNTAX HIGHLIGHTING #######################################
################################################################################
func _get_syntax_highlighting(Highlighter:SyntaxHighlighter, dict:Dictionary, line:String) -> Dictionary:
dict[line.find('return')] = {"color":event_color.lerp(Highlighter.normal_color, 0.3)}
dict[line.find('return')+6] = {"color":event_color.lerp(Highlighter.normal_color, 0.5)}
return dict

View File

@@ -0,0 +1 @@
uid://cwtnaaltksb6n

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cxffd4uch5wt1"
path="res://.godot/imported/icon.png-11806ce6c1ed02d2080de0cde1d6b3b4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/dialogic/Events/Jump/icon.png"
dest_files=["res://.godot/imported/icon.png-11806ce6c1ed02d2080de0cde1d6b3b4.ctex"]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ceqkajv8edisg"
path="res://.godot/imported/icon_jump.png-50f6cdd715fcbdbed16b43c5beb6b851.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/dialogic/Modules/Jump/icon_jump.png"
dest_files=["res://.godot/imported/icon_jump.png-50f6cdd715fcbdbed16b43c5beb6b851.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c53yjrxmhmgh"
path="res://.godot/imported/icon_label.png-3923bd1131990c8869923c838ffdb9ae.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/dialogic/Modules/Jump/icon_label.png"
dest_files=["res://.godot/imported/icon_label.png-3923bd1131990c8869923c838ffdb9ae.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg width="63.999996" height="63.999996" viewBox="0 0 16.933332 16.933332" version="1.1" id="svg5" inkscape:export-filename="return-icon.svg" inkscape:export-xdpi="96" inkscape:export-ydpi="96" sodipodi:docname="icon_return.svg" inkscape:version="1.2.2 (732a01da63, 2022-12-09)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview id="namedview7" pagecolor="#464646" bordercolor="#000000" borderopacity="0.25" inkscape:showpageshadow="2" inkscape:pageopacity="0" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:document-units="mm" showgrid="false" showguides="true" inkscape:zoom="1.5898438" inkscape:cx="-188.38329" inkscape:cy="-45.916462" inkscape:window-width="1920" inkscape:window-height="1017" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:current-layer="svg5" />
<defs id="defs2" />
<path id="path12307" style="stroke-width:0.962584;stroke-dasharray:none;fill:#ffffff;stroke:#ffffff;stroke-linecap:round;stroke-linejoin:round" d="M 10.031312,2.6802332 5.2444126,5.3787436 9.1771421,8.4917066 9.4598944,6.5688835 C 14.624065,7.1434 13.406023,13.790987 4.5579588,13.899478 17.332931,13.799654 17.986687,5.0197568 9.7415716,4.652511 Z" transform="matrix(0.9613292,0,0,0.9613292,-0.91886125,0.49040979)" />
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,44 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://kwk8ola23icj"
path="res://.godot/imported/icon_return.svg-dc7fb704ff391638f73cbbc2b30b32fa.ctex"
metadata={
"has_editor_variant": true,
"vram_texture": false
}
[deps]
source_file="res://addons/dialogic/Modules/Jump/icon_return.svg"
dest_files=["res://.godot/imported/icon_return.svg-dc7fb704ff391638f73cbbc2b30b32fa.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=true
editor/convert_colors_with_editor_theme=true

View File

@@ -0,0 +1,9 @@
@tool
extends DialogicIndexer
func _get_events() -> Array:
return [this_folder.path_join('event_jump.gd'), this_folder.path_join('event_label.gd'), this_folder.path_join('event_return.gd')]
func _get_subsystems() -> Array:
return [{'name':'Jump', 'script':this_folder.path_join('subsystem_jump.gd')}]

View File

@@ -0,0 +1 @@
uid://cfckra0582pu2

View File

@@ -0,0 +1,90 @@
extends DialogicSubsystem
## Subsystem that holds methods for jumping to specific labels, or return to the previous jump.
signal switched_timeline(info:Dictionary)
signal jumped_to_label(info:Dictionary)
signal returned_from_jump(info:Dictionary)
signal passed_label(info:Dictionary)
#region STATE
####################################################################################################
func clear_game_state(_clear_flag:=DialogicGameHandler.ClearFlags.FULL_CLEAR) -> void:
dialogic.current_state_info['jump_stack'] = []
dialogic.current_state_info.erase("last_label")
func load_game_state(_load_flag:=LoadFlags.FULL_LOAD) -> void:
if not 'jump_stack' in dialogic.current_state_info:
dialogic.current_state_info['jump_stack'] = []
#endregion
#region MAIN METHODS JUMP
####################################################################################################
func jump_to_label(label:String) -> void:
if label.is_empty():
dialogic.current_event_idx = 0
jumped_to_label.emit({'timeline':dialogic.current_timeline, 'label':"TOP"})
return
var idx: int = -1
while true:
idx += 1
var event: Variant = dialogic.current_timeline.get_event(idx)
if not event:
idx = dialogic.current_event_idx
break
if event is DialogicLabelEvent and event.name == label:
break
dialogic.current_event_idx = idx-1
jumped_to_label.emit({'timeline':dialogic.current_timeline, 'label':label})
func push_to_jump_stack() -> void:
dialogic.current_state_info['jump_stack'].push_back({'timeline':dialogic.current_timeline, 'index':dialogic.current_event_idx, 'label':dialogic.current_timeline_events[dialogic.current_event_idx].label_name})
func resume_from_last_jump() -> void:
var sub_timeline: DialogicTimeline = dialogic.current_timeline
var stack_info: Dictionary = dialogic.current_state_info['jump_stack'].pop_back()
dialogic.start_timeline(stack_info.timeline, stack_info.index+1)
returned_from_jump.emit({'sub_timeline':sub_timeline, 'label':stack_info.label})
func is_jump_stack_empty() -> bool:
return len(dialogic.current_state_info['jump_stack']) < 1
#endregion
#region MAIN MEHTODS LABELS
####################################################################################################
func _ready() -> void:
passed_label.connect(_on_passed_label)
func _on_passed_label(info:Dictionary) -> void:
dialogic.current_state_info["last_label"] = info
## Returns the identifier name of the last passed label
func get_last_label_identifier() -> String:
if not dialogic.current_state_info.has("last_label"):
return ""
return dialogic.current_state_info["last_label"].identifier
## Returns the display name of the last passed label (translated if translation are enabled)
func get_last_label_name() -> String:
if not dialogic.current_state_info.has("last_label"):
return ""
return dialogic.current_state_info["last_label"].display_name
#endregion

View File

@@ -0,0 +1 @@
uid://biwewjdrc5dia