Skip to content

Commit f1993fe

Browse files
committed
Squashed commit of the following:
commit 813dc1e99200da844e79fb1c7b434bc48b61f78c Author: AnidemDex <[email protected]> Date: Sat Nov 20 15:48:08 2021 -0500 Add docs in script for DialogNode commit e4ac4b4849c8762682c19b5a903a216e28ee531c Author: AnidemDex <[email protected]> Date: Sat Nov 20 15:47:58 2021 -0500 Add docs in script for PortraitManager commit cf72db73923f2fd59d41ba683a6b0b9e1f12d834 Author: AnidemDex <[email protected]> Date: Sat Nov 20 15:47:43 2021 -0500 Add docs in script for OptionsManager commit be6403dbfefa0e36ab717b1e2e7c0900239015be Author: AnidemDex <[email protected]> Date: Sat Nov 20 15:47:30 2021 -0500 Add documentation in script for DialogManager
1 parent b34c855 commit f1993fe

File tree

4 files changed

+39
-4
lines changed

4 files changed

+39
-4
lines changed

addons/textalog/nodes/dialogue_base_node/dialog_node/dialog_node.gd

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,48 @@ class_name DialogManager
1111
## @tutorial(Online Documentation): https://anidemdex.gitbook.io/godot-dialog-plugin/documentation/node-class/class_dialog-dialogue-node
1212
##
1313

14+
## Anchor points that the bubble can take as reference
1415
enum BubblePosition {CENTER_LEFT,CENTER_RIGHT,CENTER_TOP,CENTER_DOWN}
1516

17+
## Emmited when the text is fully displayed
1618
signal text_displayed
19+
## Emmited eveytime that a character is displayed
1720
signal character_displayed(character)
1821

22+
## The speed that the node uses to wait before adding another character.
23+
## Values between 0.02 and 0.08 are good ones to use.
1924
export(float) var text_speed:float = 0.02
25+
## If true, DialogManager will try to scroll the text to fit new content
2026
export(bool) var text_autoscroll:bool = true
27+
## If true and [member text_autoscroll] is false, DialogManager will scale its size
28+
## to fit its content.
2129
export(bool) var text_fit_content_height:bool = true
30+
## If true, DialogManager will show an VScroll to scroll its content
2231
export(bool) var text_show_scroll_at_end:bool = true
32+
## The [member BubblePosition] that the bubble will take as reference point.
2333
export(BubblePosition) var bubble_anchor:int = BubblePosition.CENTER_DOWN setget _set_bubble_anchor
34+
## Offset of the bubble relative to the selected [member bubble_anchor]
2435
export(Vector2) var bubble_offset:Vector2 = Vector2() setget _set_bubble_offset
2536

26-
var text_node:RichTextLabel
37+
## The node that actually displays the text
38+
var text_node:RichTextLabel setget ,get_text_node
2739
var _text_timer:Timer
2840

29-
41+
## Calling this method will make to all text to be visible inmediatly
3042
func display_all_text() -> void:
3143
if text_node.visible_characters >= text_node.get_total_character_count():
3244
return
3345
text_node.visible_characters = text_node.get_total_character_count() -1
3446
_update_displayed_text()
3547

3648

49+
## Starts displaying the text setted by [method set_text]
3750
func display_text() -> void:
3851
_text_timer.start(text_speed)
3952

4053

54+
## Set the text that this node will display. Call [method display_text]
55+
## after using this method to display the text.
4156
func set_text(text:String) -> void:
4257
text_node.bbcode_text = text
4358
text_node.visible_characters = 0
@@ -51,10 +66,13 @@ func set_text(text:String) -> void:
5166
text_node.get_v_scroll().value = 0
5267

5368

69+
## Adds text to the current one at the end. No need to call
70+
## [method display_text] if the node is already displaying text
5471
func add_text(text:String) -> void:
5572
text_node.append_bbcode(text)
5673

5774

75+
## Returns the used text_node
5876
func get_text_node() -> RichTextLabel:
5977
if is_instance_valid(text_node):
6078
return text_node

addons/textalog/nodes/dialogue_base_node/dialogue_base_node.gd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,28 @@ tool
22
extends Control
33
class_name DialogNode
44

5+
## Emmited when the text was fully displayed
56
signal text_displayed
67

8+
## Emmited when a portrait was added
79
signal portrait_added(character, portrait)
10+
## Emmited when a portrait that is already in the scene, changes
811
signal portrait_changed(character, portrait)
12+
## Emmited when a portrait is removed from scene
913
signal portrait_removed(character)
1014

15+
## Emmited when an option is added
1116
signal option_added(option_button)
17+
## Emmited when an option is selected
1218
signal option_selected(option_string)
1319

20+
## Path to [Class DialogManager] node
1421
export(NodePath) var DialogNode_Path:NodePath
22+
## Path to [Class PortraitManager] node
1523
export(NodePath) var PortraitNode_Path:NodePath
24+
## Path to [Class OptionsManager] node
1625
export(NodePath) var OptionsNode_Path:NodePath
26+
## Path to name node
1727
export(NodePath) var NameNode_path:NodePath
1828

1929
var dialog_manager:DialogManager
@@ -41,6 +51,7 @@ func add_option(option:String) -> void:
4151
options_manager.add_option(option)
4252

4353

54+
## Make an instance of this class. Required since you can't call .new() directly
4455
static func instance() -> Node:
4556
var _default_scene := load("res://addons/textalog/nodes/dialogue_base_node/dialogue_base_node.tscn") as PackedScene
4657
return _default_scene.instance()

addons/textalog/nodes/dialogue_base_node/options_node/options_node.gd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
extends Container
22
class_name OptionsManager
33

4+
## Emmited when an option is selected
45
signal option_selected(option)
6+
## Emmited when an option is added
57
signal option_added(option_button)
68

9+
## Option button scene used
710
var OptionButtonScene:PackedScene = load("res://addons/textalog/nodes/dialogue_base_node/options_node/option_button/option_button.tscn")
811

12+
## Adds an option and display it inmediatly to scene
913
func add_option(option:String) -> void:
1014
var option_button:Button = OptionButtonScene.instance() as Button
1115
option_button.connect("ready", self, "emit_signal", ["option_added", option_button])
@@ -19,6 +23,7 @@ func _on_OptionButton_pressed(option:String) -> void:
1923
emit_signal("option_selected", option)
2024

2125

26+
## Removes all option buttons in scene
2227
func remove_options() -> void:
2328
for child in get_children():
2429
child.queue_free()

addons/textalog/nodes/dialogue_base_node/portraits_node/portraits_node.gd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ class_name PortraitManager
1010
## @tutorial(Online Documentation): https://anidemdex.gitbook.io/godot-dialog-plugin/documentation/node-class/class_dialog-portrait-manager
1111
##
1212

13-
## Emmited when a character[DialogCharacterResource] portrait was added.
13+
## Emmited when a character portrait was added.
1414
signal portrait_added(character, new_portrait)
1515

16-
## Emmited when a portrait was changed with a new one.
16+
## Emmited when a [Class Portrait] was changed with a new one.
1717
signal portrait_changed(character, new_portrait)
1818

1919
## Emmited when a character portrait was removed from scene.
@@ -27,6 +27,7 @@ onready var size_reference_node:Control = get_node(ReferenceSize) as Control
2727
# {CharacterResource: PortraitNode(TextureRect)}
2828
var portraits:Dictionary = {}
2929

30+
## Adds a portrait for character to the scene
3031
func add_portrait(
3132
character:Character,
3233
portrait:Portrait,

0 commit comments

Comments
 (0)