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,98 @@
@tool
class_name DialogicTextInputEvent
extends DialogicEvent
## Event that shows an input field and will change a dialogic variable.
### Settings
## The promt to be shown.
var text := "Please enter some text:"
## The name/path of the variable to set.
var variable := ""
## The placeholder text to show in the line edit.
var placeholder := ""
## The value that should be in the line edit by default.
var default := ""
## If true, the player can continue if nothing is entered.
var allow_empty := false
################################################################################
## EXECUTION
################################################################################
func _execute() -> void:
dialogic.Inputs.auto_skip.enabled = false
dialogic.current_state = DialogicGameHandler.States.WAITING
dialogic.TextInput.show_text_input(text, default, placeholder, allow_empty)
dialogic.TextInput.input_confirmed.connect(_on_DialogicTextInput_input_confirmed, CONNECT_ONE_SHOT)
func _on_DialogicTextInput_input_confirmed(input:String) -> void:
if !dialogic.has_subsystem('VAR'):
printerr('[Dialogic] The TextInput event needs the variable subsystem to be present.')
finish()
return
dialogic.VAR.set_variable(variable, input)
dialogic.TextInput.hide_text_input()
dialogic.current_state = DialogicGameHandler.States.IDLE
finish()
################################################################################
## SAVING/LOADING
################################################################################
func _init() -> void:
event_name = "Text Input"
set_default_color('Color6')
event_category = "Logic"
event_sorting_index = 6
################################################################################
## SAVING/LOADING
################################################################################
func get_shortcode() -> String:
return "text_input"
func get_shortcode_parameters() -> Dictionary:
return {
#param_name : property_info
"text" : {"property": "text", "default": "Please enter some text:"},
"var" : {"property": "variable", "default": "", "suggestions":get_var_suggestions},
"placeholder" : {"property": "placeholder", "default": ""},
"default" : {"property": "default", "default": ""},
"allow_empty" : {"property": "allow_empty", "default": false},
}
################################################################################
## EDITOR
################################################################################
func build_event_editor() -> void:
add_header_label('Show an input and store it in')
add_header_edit('variable', ValueType.DYNAMIC_OPTIONS,
{'suggestions_func' : get_var_suggestions,
'icon' : load("res://addons/dialogic/Editor/Images/Pieces/variable.svg"),
'placeholder':'Select Variable'})
add_body_edit('text', ValueType.SINGLELINE_TEXT, {'left_text':'Text:'})
add_body_edit('placeholder', ValueType.SINGLELINE_TEXT, {'left_text':'Placeholder:'})
add_body_edit('default', ValueType.SINGLELINE_TEXT, {'left_text':'Default:'})
add_body_edit('allow_empty', ValueType.BOOL, {'left_text':'Allow empty:'})
func get_var_suggestions(filter:String="") -> Dictionary:
var suggestions := {}
if filter:
suggestions[filter] = {
'value' : filter,
'editor_icon' : ["GuiScrollArrowRight", "EditorIcons"]}
var vars: Dictionary = ProjectSettings.get_setting('dialogic/variables', {})
for var_path in DialogicUtil.list_variables(vars, "", DialogicUtil.VarTypes.STRING):
suggestions[var_path] = {'value':var_path, 'icon':load("res://addons/dialogic/Editor/Images/Pieces/variable.svg")}
return suggestions

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d0nd366sf5gpu"
path="res://.godot/imported/icon.png-aea103d18fdc694e2da87b3c5a56be35.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/dialogic/Modules/TextInput/icon.png"
dest_files=["res://.godot/imported/icon.png-aea103d18fdc694e2da87b3c5a56be35.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,11 @@
@tool
extends DialogicIndexer
func _get_events() -> Array:
return [this_folder.path_join('event_text_input.gd')]
func _get_subsystems() -> Array:
return [{'name':'TextInput', 'script':this_folder.path_join('subsystem_text_input.gd')}]

View File

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

View File

@@ -0,0 +1,58 @@
class_name DialogicNode_TextInput
extends Control
## Node that will show when a text input field is reached.
## Should be connected to a (probably contained) label, a line edit and a button to work.
## The LineEdit to use.
@export_node_path var input_line_edit: NodePath
## The Label to use.
@export_node_path var text_label: NodePath
## The Button to use.
@export_node_path var confirmation_button: NodePath
# This is set by the subsystem and used as a confirmation check.
var _allow_empty := false
func _ready() -> void:
add_to_group('dialogic_text_input')
if confirmation_button:
get_node(confirmation_button).pressed.connect(_on_confirmation_button_pressed)
if input_line_edit:
get_node(input_line_edit).text_changed.connect(_on_input_text_changed)
get_node(input_line_edit).text_submitted.connect(_on_confirmation_button_pressed)
visible = false
func set_text(text:String) -> void:
if get_node(text_label) is Label:
get_node(text_label).text = text
func set_placeholder(placeholder:String) -> void:
if get_node(input_line_edit) is LineEdit:
get_node(input_line_edit).placeholder_text = placeholder
get_node(input_line_edit).grab_focus()
func set_default(default:String) -> void:
if get_node(input_line_edit) is LineEdit:
get_node(input_line_edit).text = default
_on_input_text_changed(default)
func set_allow_empty(boolean:bool) -> void:
_allow_empty = boolean
func _on_input_text_changed(text:String) -> void:
if confirmation_button.is_empty():
return
get_node(confirmation_button).disabled = !_allow_empty and text.is_empty()
func _on_confirmation_button_pressed(text:="") -> void:
if get_node(input_line_edit) is LineEdit:
if !get_node(input_line_edit).text.is_empty() or _allow_empty:
DialogicUtil.autoload().TextInput.input_confirmed.emit(get_node(input_line_edit).text)

View File

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

View File

@@ -0,0 +1,36 @@
extends DialogicSubsystem
## Subsystem that handles showing of input promts.
## Signal that is fired when a confirmation button was pressed.
signal input_confirmed(input:String)
signal input_shown(info:Dictionary)
#region STATE
####################################################################################################
func clear_game_state(_clear_flag:=DialogicGameHandler.ClearFlags.FULL_CLEAR) -> void:
hide_text_input()
#endregion
#region MAIN METHODS
####################################################################################################
func show_text_input(text:= "", default:= "", placeholder:= "", allow_empty:= false) -> void:
for node in get_tree().get_nodes_in_group('dialogic_text_input'):
node.show()
if node.has_method('set_allow_empty'): node.set_allow_empty(allow_empty)
if node.has_method('set_text'): node.set_text(text)
if node.has_method('set_default'): node.set_default(default)
if node.has_method('set_placeholder'): node.set_placeholder(placeholder)
input_shown.emit({'text':text, 'default':default, 'placeholder':placeholder, 'allow_empty':allow_empty})
func hide_text_input() -> void:
for node in get_tree().get_nodes_in_group('dialogic_text_input'):
node.hide()
#endregion

View File

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