Skip to content

Commit

Permalink
Rename Input, Animation and Expression
Browse files Browse the repository at this point in the history
This is a ton of changes unfortunately. But needs to happen I think.
  • Loading branch information
Jowan-Spooner committed Jan 18, 2024
1 parent 35decd8 commit c8e69ea
Show file tree
Hide file tree
Showing 24 changed files with 82 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func _input(event:InputEvent) -> void:
if (event is InputEventMouseButton
and event.is_pressed()
and event.button_index == MOUSE_BUTTON_MIDDLE):
var auto_skip: DialogicAutoSkip = DialogicUtil.autoload().Input.auto_skip
var auto_skip: DialogicAutoSkip = DialogicUtil.autoload().Inputs.auto_skip
var is_auto_skip_enabled := auto_skip.enabled

auto_skip.disable_on_unread_text = false
Expand Down
4 changes: 2 additions & 2 deletions addons/dialogic/Modules/Background/event_background.gd
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ var _scene_type := SceneTypes.DEFAULT :
func _execute() -> void:
var final_fade_duration := fade

if dialogic.Input.auto_skip.enabled:
var time_per_event: float = dialogic.Input.auto_skip.time_per_event
if dialogic.Inputs.auto_skip.enabled:
var time_per_event: float = dialogic.Inputs.auto_skip.time_per_event
final_fade_duration = min(fade, time_per_event)

dialogic.Backgrounds.update_background(scene, argument, final_fade_duration, transition)
Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/Modules/Call/event_call.gd
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func _execute() -> void:
var args := []
for arg in arguments:
if arg is String and arg.begins_with('@'):
args.append(dialogic.Expression.execute_string(arg.trim_prefix('@')))
args.append(dialogic.Expressions.execute_string(arg.trim_prefix('@')))
else:
args.append(arg)
dialogic.current_state = dialogic.States.WAITING
Expand Down
16 changes: 8 additions & 8 deletions addons/dialogic/Modules/Character/event_character.gd
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ func _execute() -> void:

var final_animation_length: float = animation_length

if dialogic.Input.auto_skip.enabled:
var max_time: float = dialogic.Input.auto_skip.time_per_event
if dialogic.Inputs.auto_skip.enabled:
var max_time: float = dialogic.Inputs.auto_skip.time_per_event
final_animation_length = min(max_time, animation_length)

await dialogic.Portraits.join_character(
Expand All @@ -88,8 +88,8 @@ func _execute() -> void:
Actions.LEAVE:
var final_animation_length: float = animation_length

if dialogic.Input.auto_skip.enabled:
var max_time: float = dialogic.Input.auto_skip.time_per_event
if dialogic.Inputs.auto_skip.enabled:
var max_time: float = dialogic.Inputs.auto_skip.time_per_event
final_animation_length = min(max_time, animation_length)

if character_identifier == '--All--':
Expand Down Expand Up @@ -131,8 +131,8 @@ func _execute() -> void:
if set_position:
var final_position_move_time: float = position_move_time

if dialogic.Input.auto_skip.enabled:
var max_time: float = dialogic.Input.auto_skip.time_per_event
if dialogic.Inputs.auto_skip.enabled:
var max_time: float = dialogic.Inputs.auto_skip.time_per_event
final_position_move_time = min(max_time, position_move_time)

dialogic.Portraits.move_character(character, position, final_position_move_time)
Expand All @@ -141,8 +141,8 @@ func _execute() -> void:
var final_animation_length: float = animation_length
var final_animation_repitions: int = animation_repeats

if dialogic.Input.auto_skip.enabled:
var time_per_event: float = dialogic.Input.auto_skip.time_per_event
if dialogic.Inputs.auto_skip.enabled:
var time_per_event: float = dialogic.Inputs.auto_skip.time_per_event
var time_for_repitions: float = time_per_event / animation_repeats
final_animation_length = time_for_repitions

Expand Down
4 changes: 2 additions & 2 deletions addons/dialogic/Modules/Character/event_position.gd
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ var movement_time: float = 0
func _execute() -> void:
var final_movement_time: float = movement_time

if dialogic.Input.auto_skip.enabled:
var time_per_event: float = dialogic.Input.auto_skip.time_per_event
if dialogic.Inputs.auto_skip.enabled:
var time_per_event: float = dialogic.Inputs.auto_skip.time_per_event
final_movement_time = max(movement_time, time_per_event)

match action:
Expand Down
8 changes: 4 additions & 4 deletions addons/dialogic/Modules/Character/subsystem_portraits.gd
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ func _remove_portrait(character_node:Node2D) -> void:
func _get_join_default_length() -> float:
var default_time = ProjectSettings.get_setting('dialogic/animations/join_default_length', 0.5)

if dialogic.Input.auto_skip.enabled:
default_time = min(default_time, dialogic.Input.auto_skip.time_per_event)
if dialogic.Inputs.auto_skip.enabled:
default_time = min(default_time, dialogic.Inputs.auto_skip.time_per_event)

return default_time

Expand All @@ -260,8 +260,8 @@ func _get_join_default_length() -> float:
func _get_leave_default_length() -> float:
var default_time = ProjectSettings.get_setting('dialogic/animations/leave_default_length', 0.5)

if dialogic.Input.auto_skip.enabled:
default_time = min(default_time, dialogic.Input.auto_skip.time_per_event)
if dialogic.Inputs.auto_skip.enabled:
default_time = min(default_time, dialogic.Inputs.auto_skip.time_per_event)

return default_time

Expand Down
8 changes: 4 additions & 4 deletions addons/dialogic/Modules/Choice/subsystem_choices.gd
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,21 @@ func show_current_choices(instant:=true) -> void:
choice_blocker.start(reveal_delay)
choice_blocker.timeout.connect(show_current_choices)
if reveal_by_input:
dialogic.Input.dialogic_action.connect(show_current_choices)
dialogic.Inputs.dialogic_action.connect(show_current_choices)
return

if choice_blocker.timeout.is_connected(show_current_choices):
choice_blocker.timeout.disconnect(show_current_choices)
if dialogic.Input.dialogic_action.is_connected(show_current_choices):
dialogic.Input.dialogic_action.disconnect(show_current_choices)
if dialogic.Inputs.dialogic_action.is_connected(show_current_choices):
dialogic.Inputs.dialogic_action.disconnect(show_current_choices)


var button_idx := 1
last_question_info = {'choices':[]}
for choice_index in get_current_choice_indexes():
var choice_event: DialogicEvent = dialogic.current_timeline_events[choice_index]
# check if condition is false
if not choice_event.condition.is_empty() and not dialogic.Expression.execute_condition(choice_event.condition):
if not choice_event.condition.is_empty() and not dialogic.Expressions.execute_condition(choice_event.condition):
if choice_event.else_action == DialogicChoiceEvent.ElseActions.DEFAULT:
choice_event.else_action = ProjectSettings.get_setting('dialogic/choices/def_false_behaviour', 0)

Expand Down
4 changes: 2 additions & 2 deletions addons/dialogic/Modules/Clear/event_clear.gd
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ var clear_background := true
func _execute() -> void:
var final_time := time

if dialogic.Input.auto_skip.enabled:
var time_per_event: float = dialogic.Input.auto_skip.time_per_event
if dialogic.Inputs.auto_skip.enabled:
var time_per_event: float = dialogic.Inputs.auto_skip.time_per_event
final_time = min(time, time_per_event)

if clear_textbox and dialogic.has_subsystem("Text"):
Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/Modules/Condition/event_condition.gd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func _execute() -> void:

if condition.is_empty(): condition = "true"

var result :bool= dialogic.Expression.execute_condition(condition)
var result :bool= dialogic.Expressions.execute_condition(condition)
if not result:
var idx :int= dialogic.current_event_idx
var ignore := 1
Expand Down
4 changes: 2 additions & 2 deletions addons/dialogic/Modules/Core/subsystem_input.gd
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ func effect_input(text_node:Control, skipped:bool, argument:String) -> void:
if skipped:
return
dialogic.Text.show_next_indicators()
await dialogic.Input.dialogic_action_priority
await dialogic.Inputs.dialogic_action_priority
dialogic.Text.hide_next_indicators()
dialogic.Input.action_was_consumed = true
dialogic.Inputs.action_was_consumed = true


func effect_noskip(text_node:Control, skipped:bool, argument:String) -> void:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func _on_dialogic_display_dialog_text_meta_hover_started(meta:String) -> void:
get_panel().self_modulate = info.get(&'color', Color.WHITE)
get_panel_point().self_modulate = info.get(&'color', Color.WHITE)

DialogicUtil.autoload().Input.action_was_consumed = true
DialogicUtil.autoload().Inputs.action_was_consumed = true


## Method that keeps the bubble at mouse position when visible
Expand All @@ -119,11 +119,11 @@ func _process(_delta : float) -> void:
## Method that hides the bubble
func _on_dialogic_display_dialog_text_meta_hover_ended(_meta:String) -> void:
get_pointer().hide()
DialogicUtil.autoload().Input.action_was_consumed = false
DialogicUtil.autoload().Inputs.action_was_consumed = false


func _on_dialogic_display_dialog_text_meta_clicked(_meta:String) -> void:
DialogicUtil.autoload().Input.action_was_consumed = true
DialogicUtil.autoload().Inputs.action_was_consumed = true


func _apply_export_overrides() -> void:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func _on_textbox_show() -> void:
if animation_in == AnimationsIn.NONE:
return
play('RESET')
var animation_system : Node = DialogicUtil.autoload().get(&'Animation')
var animation_system : Node = DialogicUtil.autoload().get(&'Animations')
animation_system.call(&'start_animating')
get_text_panel().get_parent().get_parent().set(&'modulate', Color.TRANSPARENT)
get_dialog().text = ""
Expand Down Expand Up @@ -68,7 +68,7 @@ func _on_about_to_show_text(info:Dictionary) -> void:


func _on_textbox_new_text() -> void:
if DialogicUtil.autoload().Input.auto_skip.enabled:
if DialogicUtil.autoload().Inputs.auto_skip.enabled:
return

if animation_new_text == AnimationsNewText.NONE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ func _process(_delta : float) -> void:
if !enabled:
hide()
return
if DialogicUtil.autoload().Input.auto_advance.get_progress() < 0:
if DialogicUtil.autoload().Inputs.auto_advance.get_progress() < 0:
hide()
else:
show()
value = DialogicUtil.autoload().Input.auto_advance.get_progress()
value = DialogicUtil.autoload().Inputs.auto_advance.get_progress()
4 changes: 2 additions & 2 deletions addons/dialogic/Modules/Text/auto_advance.gd
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var enabled_until_user_input := false :
_try_emit_toggled()

func _init() -> void:
DialogicUtil.autoload().Input.add_child(autoadvance_timer)
DialogicUtil.autoload().Inputs.add_child(autoadvance_timer)
autoadvance_timer.one_shot = true
autoadvance_timer.timeout.connect(_on_autoadvance_timer_timeout)
toggled.connect(_on_toggled)
Expand Down Expand Up @@ -172,7 +172,7 @@ func _on_toggled(is_enabled: bool) -> void:
# If auto-advance is disabled and we are auto-advancing,
# we want to cancel the auto-advance mode.
elif !is_enabled and is_advancing():
DialogicUtil.autoload().Input.stop()
DialogicUtil.autoload().Inputs.stop()
#endregion

#region AUTOADVANCE HELPERS
Expand Down
46 changes: 23 additions & 23 deletions addons/dialogic/Modules/Text/event_text.gd
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,25 @@ func _mark_as_read(final_text: String) -> void:
dialogic.History.event_was_read(self)

func _connect_signals() -> void:
if not dialogic.Input.dialogic_action.is_connected(_on_dialogic_input_action):
dialogic.Input.dialogic_action.connect(_on_dialogic_input_action)
if not dialogic.Inputs.dialogic_action.is_connected(_on_dialogic_input_action):
dialogic.Inputs.dialogic_action.connect(_on_dialogic_input_action)

dialogic.Input.auto_skip.toggled.connect(_on_auto_skip_enable)
dialogic.Inputs.auto_skip.toggled.connect(_on_auto_skip_enable)

if not dialogic.Input.auto_advance.autoadvance.is_connected(_on_dialogic_input_autoadvance):
dialogic.Input.auto_advance.autoadvance.connect(_on_dialogic_input_autoadvance)
if not dialogic.Inputs.auto_advance.autoadvance.is_connected(_on_dialogic_input_autoadvance):
dialogic.Inputs.auto_advance.autoadvance.connect(_on_dialogic_input_autoadvance)

## If the event is done, this method can clean-up signal connections.
func _disconnect_signals() -> void:
dialogic.Input.dialogic_action.disconnect(_on_dialogic_input_action)
dialogic.Input.auto_advance.autoadvance.disconnect(_on_dialogic_input_autoadvance)
dialogic.Input.auto_skip.toggled.disconnect(_on_auto_skip_enable)
dialogic.Inputs.dialogic_action.disconnect(_on_dialogic_input_action)
dialogic.Inputs.auto_advance.autoadvance.disconnect(_on_dialogic_input_autoadvance)
dialogic.Inputs.auto_skip.toggled.disconnect(_on_auto_skip_enable)

## Tries to play the voice clip for the current line.
func _try_play_current_line_voice() -> void:
# If Auto-Skip is enabled and we skip voice clips, we don't want to play.
if (dialogic.Input.auto_skip.enabled
and dialogic.Input.auto_skip.skip_voice):
if (dialogic.Inputs.auto_skip.enabled
and dialogic.Inputs.auto_skip.skip_voice):
return

# Plays the audio region for the current line.
Expand Down Expand Up @@ -149,7 +149,7 @@ func _execute() -> void:

# We must skip text animation before we potentially return when there
# is a Choice event.
if dialogic.Input.auto_skip.enabled:
if dialogic.Inputs.auto_skip.enabled:
dialogic.Text.skip_text_animation()
else:
await dialogic.Text.text_finished
Expand All @@ -162,9 +162,9 @@ func _execute() -> void:
dialogic.Choices.show_current_choices(false)
dialogic.current_state = dialogic.States.AWAITING_CHOICE
return
elif dialogic.Input.auto_advance.is_enabled():
elif dialogic.Inputs.auto_advance.is_enabled():
dialogic.Text.show_next_indicators(false, true)
dialogic.Input.auto_advance.start()
dialogic.Inputs.auto_advance.start()
else:
dialogic.Text.show_next_indicators()

Expand All @@ -173,11 +173,11 @@ func _execute() -> void:

# If Auto-Skip is enabled and there are multiple parts of this text
# we need to skip the text after the defined time per event.
if dialogic.Input.auto_skip.enabled:
await dialogic.Input.start_autoskip_timer()
if dialogic.Inputs.auto_skip.enabled:
await dialogic.Inputs.start_autoskip_timer()

# Check if Auto-Skip is still enabled.
if not dialogic.Input.auto_skip.enabled:
if not dialogic.Inputs.auto_skip.enabled:
await advance

else:
Expand All @@ -191,13 +191,13 @@ func _on_dialogic_input_action():
States.REVEALING:
if dialogic.Text.can_skip_text_reveal():
dialogic.Text.skip_text_animation()
dialogic.Input.stop()
dialogic.Input.block_input(ProjectSettings.get_setting('dialogic/text/text_reveal_skip_delay', 0.1))
dialogic.Inputs.stop()
dialogic.Inputs.block_input(ProjectSettings.get_setting('dialogic/text/text_reveal_skip_delay', 0.1))
_:
if dialogic.Input.is_manualadvance_enabled():
if dialogic.Inputs.is_manualadvance_enabled():
advance.emit()
dialogic.Input.stop()
dialogic.Input.block_input(ProjectSettings.get_setting('dialogic/text/text_reveal_skip_delay', 0.1))
dialogic.Inputs.stop()
dialogic.Inputs.block_input(ProjectSettings.get_setting('dialogic/text/text_reveal_skip_delay', 0.1))


func _on_dialogic_input_autoadvance():
Expand All @@ -211,10 +211,10 @@ func _on_auto_skip_enable(enabled: bool):

match state:
States.DONE:
await dialogic.Input.start_autoskip_timer()
await dialogic.Inputs.start_autoskip_timer()

# If Auto-Skip is still enabled, advance the text.
if dialogic.Input.auto_skip.enabled:
if dialogic.Inputs.auto_skip.enabled:
advance.emit()

States.REVEALING:
Expand Down
4 changes: 2 additions & 2 deletions addons/dialogic/Modules/Text/node_dialog_text.gd
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func reveal_text(_text:String, keep_previous:bool=false) -> void:

# If Auto-Skip is enabled and we append the text (keep_previous),
# we can skip revealing the text and just show it all at once.
if DialogicUtil.autoload().Input.auto_skip.enabled:
if DialogicUtil.autoload().Inputs.auto_skip.enabled:
visible_characters = 1
return

Expand All @@ -93,7 +93,7 @@ func continue_reveal() -> void:
# if the text finished organically, add a small input block
# this prevents accidental skipping when you expected the text to be longer
# TODO! Make this configurable in the settings!
DialogicUtil.autoload().Input.block_input(0.3)
DialogicUtil.autoload().Inputs.block_input(0.3)


# shows all the text imidiatly
Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/Modules/Text/node_input.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ func _input(event: InputEvent) -> void:
func _on_gui_input(event:InputEvent) -> void:
if Input.is_action_just_pressed(ProjectSettings.get_setting('dialogic/text/input_action', 'dialogic_default_action')):
if event is InputEventMouseButton and event.pressed:
DialogicUtil.autoload().Input.handle_input()
DialogicUtil.autoload().Inputs.handle_input()
4 changes: 2 additions & 2 deletions addons/dialogic/Modules/Text/node_type_sound.gd
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func _on_continued_revealing_text(new_character:String) -> void:
return

# We don't want to play type sounds if Auto-Skip is enabled.
if !Engine.is_editor_hint() and DialogicUtil.autoload().Input.auto_skip.enabled:
if !Engine.is_editor_hint() and DialogicUtil.autoload().Inputs.auto_skip.enabled:
return

# don't play if a voice-track is running
Expand Down Expand Up @@ -101,7 +101,7 @@ func _on_continued_revealing_text(new_character:String) -> void:

func _on_finished_revealing_text() -> void:
# We don't want to play type sounds if Auto-Skip is enabled.
if !Engine.is_editor_hint() and DialogicUtil.autoload().Input.auto_skip.enabled:
if !Engine.is_editor_hint() and DialogicUtil.autoload().Inputs.auto_skip.enabled:
return

if end_sound != null:
Expand Down
Loading

0 comments on commit c8e69ea

Please sign in to comment.