Skip to content

Commit e6ae86c

Browse files
committed
Saving and using custom display name
1 parent 3874991 commit e6ae86c

File tree

5 files changed

+37
-17
lines changed

5 files changed

+37
-17
lines changed

addons/dialogic/Editor/EditorCharacter.gd

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ onready var character_editor = {
1212
'file': $CharacterEditor/HBoxContainer/Container/FileName/LineEdit,
1313
'color': $CharacterEditor/HBoxContainer/Container/Color/ColorPickerButton,
1414
'default_speaker': $CharacterEditor/HBoxContainer/Container/Actions/DefaultSpeaker,
15+
'display_name_checkbox': $CharacterEditor/HBoxContainer/Container/Name/CheckBox,
16+
'display_name': $CharacterEditor/HBoxContainer/Container/DisplayName/LineEdit,
1517
}
1618

1719
func _ready():
@@ -51,6 +53,8 @@ func clear_character_editor():
5153
character_editor['description'].text = ''
5254
character_editor['color'].color = Color('#ffffff')
5355
character_editor['default_speaker'].pressed = false
56+
character_editor['display_name_checkbox'].pressed = false
57+
character_editor['display_name'].text = ''
5458
character_editor['portraits'] = []
5559
# Clearing portraits
5660
for p in $CharacterEditor/HBoxContainer/Container/ScrollContainer/VBoxContainer/PortraitList.get_children():
@@ -107,7 +111,9 @@ func generate_character_data_to_save():
107111
'description': character_editor['description'].text,
108112
'color': character_editor['color'].color.to_html(),
109113
'default_speaker': default_speaker,
110-
'portraits': portraits
114+
'portraits': portraits,
115+
'display_name_bool': character_editor['display_name_checkbox'].pressed,
116+
'display_name': character_editor['display_name'].text,
111117
}
112118
# Adding name later for cases when no name is provided
113119
if character_editor['name'].text != '':
@@ -148,7 +154,12 @@ func load_character_editor(data):
148154
if data.has('default_speaker'):
149155
if data['default_speaker'] == 'true':
150156
character_editor['default_speaker'].pressed = true
151-
157+
158+
if data.has('display_name_bool'):
159+
character_editor['display_name_checkbox'].pressed = data['display_name_bool']
160+
if data.has('display_name'):
161+
character_editor['display_name'].text = data['display_name']
162+
152163
# Portraits
153164
var default_portrait = create_portrait_entry()
154165
default_portrait.get_node('NameEdit').text = 'Default'

addons/dialogic/Editor/EditorView.tscn

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,6 @@ icon = ExtResource( 8 )
431431
align = 0
432432

433433
[node name="EditorCharacter" type="HSplitContainer" parent="."]
434-
visible = false
435434
anchor_right = 1.0
436435
anchor_bottom = 1.0
437436
margin_left = 6.0
@@ -459,7 +458,7 @@ margin_right = 180.0
459458
margin_bottom = 541.0
460459
size_flags_horizontal = 3
461460
size_flags_vertical = 3
462-
items = [ "Narrator", ExtResource( 7 ), false, "Shia", ExtResource( 7 ), false, "Lyra", ExtResource( 7 ), false ]
461+
items = [ "Lyra", ExtResource( 7 ), false, "Shia", ExtResource( 7 ), false, "Narrator", ExtResource( 7 ), false ]
463462
allow_rmb_select = true
464463

465464
[node name="NoCharacters" type="CenterContainer" parent="EditorCharacter"]
@@ -749,6 +748,7 @@ __meta__ = {
749748
}
750749

751750
[node name="EditorTheme" type="ScrollContainer" parent="."]
751+
visible = false
752752
anchor_right = 1.0
753753
anchor_bottom = 1.0
754754
margin_left = 6.0
@@ -761,7 +761,7 @@ __meta__ = {
761761
}
762762

763763
[node name="VBoxContainer" type="VBoxContainer" parent="EditorTheme"]
764-
margin_right = 985.0
764+
margin_right = 997.0
765765
margin_bottom = 657.0
766766
size_flags_horizontal = 3
767767
size_flags_vertical = 3
@@ -797,10 +797,10 @@ margin_right = 511.0
797797
margin_bottom = 38.0
798798

799799
[node name="ActionOptionButton" type="OptionButton" parent="EditorTheme/VBoxContainer/VBoxContainer/HBoxContainer/VBoxContainer"]
800-
margin_right = 76.0
800+
margin_right = 104.0
801801
margin_bottom = 20.0
802802
size_flags_horizontal = 0
803-
text = "ui_right"
803+
text = "mouse_test"
804804
items = [ "[Select Action]", null, false, 0, null, "ui_accept", null, false, 1, null, "ui_select", null, false, 2, null, "ui_cancel", null, false, 3, null, "ui_focus_next", null, false, 4, null, "ui_focus_prev", null, false, 5, null, "ui_left", null, false, 6, null, "ui_right", null, false, 7, null, "ui_up", null, false, 8, null, "ui_down", null, false, 9, null, "ui_page_up", null, false, 10, null, "ui_page_down", null, false, 11, null, "ui_home", null, false, 12, null, "ui_end", null, false, 13, null ]
805805
selected = 0
806806

@@ -913,14 +913,13 @@ text = "Text shadow"
913913
margin_left = 89.0
914914
margin_right = 113.0
915915
margin_bottom = 30.0
916-
pressed = true
917916

918917
[node name="ColorPickerButtonShadow" type="ColorPickerButton" parent="EditorTheme/VBoxContainer/HBoxContainer"]
919918
margin_left = 123.0
920919
margin_right = 173.0
921920
margin_bottom = 30.0
922921
rect_min_size = Vector2( 50, 30 )
923-
color = Color( 0, 0, 0, 0.576471 )
922+
color = Color( 0.996078, 0.145098, 0.00784314, 0.823529 )
924923

925924
[node name="Label3" type="Label" parent="EditorTheme/VBoxContainer/HBoxContainer"]
926925
margin_left = 183.0
@@ -942,7 +941,7 @@ prefix = "X"
942941
margin_left = 368.0
943942
margin_right = 442.0
944943
margin_bottom = 30.0
945-
value = 1.0
944+
value = 4.0
946945
rounded = true
947946
allow_lesser = true
948947
prefix = "Y"
@@ -958,15 +957,15 @@ text = " Text margin"
958957
margin_left = 569.0
959958
margin_right = 643.0
960959
margin_bottom = 30.0
961-
value = 19.0
960+
value = 15.0
962961
rounded = true
963962
prefix = "V"
964963

965964
[node name="TextMarginH" type="SpinBox" parent="EditorTheme/VBoxContainer/HBoxContainer"]
966965
margin_left = 653.0
967966
margin_right = 727.0
968967
margin_bottom = 30.0
969-
value = 40.0
968+
value = 15.0
970969
rounded = true
971970
prefix = "H"
972971

addons/dialogic/Nodes/Dialog.tscn

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,17 @@ __meta__ = {
7777
[node name="RichTextLabel" type="RichTextLabel" parent="TextBubble"]
7878
anchor_right = 1.0
7979
anchor_bottom = 1.0
80-
margin_left = 26.0
80+
margin_left = 15.0
8181
margin_top = 15.0
82-
margin_right = -26.0
82+
margin_right = -15.0
8383
margin_bottom = -15.0
8484
rect_clip_content = false
8585
custom_styles/normal = SubResource( 1 )
8686
custom_fonts/normal_font = ExtResource( 3 )
8787
custom_colors/default_color = Color( 1, 1, 1, 1 )
8888
custom_colors/font_color_shadow = Color( 0, 0, 0, 0.576471 )
8989
custom_constants/shadow_offset_x = 1
90-
custom_constants/shadow_offset_y = 1
90+
custom_constants/shadow_offset_y = 4
9191
bbcode_enabled = true
9292
bbcode_text = "Placeholder text for testing and formatting."
9393
text = "Placeholder text for testing and formatting."
@@ -122,16 +122,16 @@ anims/IDLE = SubResource( 2 )
122122
margin_left = 2.0
123123
margin_top = -37.0
124124
margin_right = 369.0
125+
rect_clip_content = false
125126
custom_styles/normal = SubResource( 1 )
126127
custom_fonts/normal_font = ExtResource( 3 )
127128
custom_colors/default_color = Color( 1, 1, 1, 1 )
128129
custom_colors/font_color_shadow = Color( 0, 0, 0, 0.576471 )
129130
custom_constants/shadow_offset_x = 1
130-
custom_constants/shadow_offset_y = 1
131+
custom_constants/shadow_offset_y = 4
131132
custom_constants/shadow_as_outline = 10
132133
bbcode_enabled = true
133134
bbcode_text = "Name Here"
134-
text = "Name Here"
135135
scroll_active = false
136136
__meta__ = {
137137
"_edit_use_anchors_": false

addons/dialogic/Nodes/dialog_node.gd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ func update_name(character, color='FFFFFF'):
139139
$TextBubble/NameLabel.bbcode_text = ''
140140
else:
141141
var parsed_name = character['name']
142+
if character.has('display_name'):
143+
if character['display_name'] != '':
144+
parsed_name = character['display_name']
142145
if character.has('color'):
143146
color = character['color'].to_html()
144147
$TextBubble/NameLabel.bbcode_text = '[color=#' + color + ']' + parsed_name + '[/color]'

addons/dialogic/Other/DialogicUtil.gd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ static func get_character_list():
7979
var c_name = data['id']
8080
var default_speaker = 'false'
8181
var portraits = []
82+
var display_name = ''
8283
if data.has('color'):
8384
color = Color('#' + data['color'])
8485
if data.has('name'):
@@ -87,12 +88,18 @@ static func get_character_list():
8788
default_speaker = data['default_speaker']
8889
if data.has('portraits'):
8990
portraits = data['portraits']
91+
if data.has('display_name'):
92+
if data['display_name_bool']:
93+
if data.has('display_name'):
94+
display_name = data['display_name']
95+
9096
characters.append({
9197
'name': c_name,
9298
'color': color,
9399
'file': file,
94100
'default_speaker' : default_speaker,
95101
'portraits': portraits,
102+
'display_name': display_name
96103
})
97104

98105
return characters

0 commit comments

Comments
 (0)