diff --git a/addons/dialogic/Editor/ThemeEditor/ThemeEditor.gd b/addons/dialogic/Editor/ThemeEditor/ThemeEditor.gd index 1688d4a80..33f942a6d 100644 --- a/addons/dialogic/Editor/ThemeEditor/ThemeEditor.gd +++ b/addons/dialogic/Editor/ThemeEditor/ThemeEditor.gd @@ -216,7 +216,7 @@ func _ready() -> void: n['button_layout'].connect('item_selected', self, '_on_button_layout_selected') - for button in ['dialog_box_anchor', 'button_position_on_screen']: + for button in ['dialog_box_anchor', 'button_position_on_screen', 'alignment']: var button_positions_popup = n[button].get_popup() button_positions_popup.clear() button_positions_popup.add_icon_item( @@ -240,8 +240,10 @@ func _ready() -> void: button_positions_popup.add_icon_item( get_icon("ControlAlignBottomRight", "EditorIcons"), "Bottom Right", 8) + n['button_position_on_screen'].connect('item_selected', self, '_on_button_anchor_selected') n['dialog_box_anchor'].connect('item_selected', self, '_on_button_dialogbox_anchor_selected') + n['alignment'].connect('item_selected', self, '_on_Alignment_item_selected') n['button_offset_x'].connect('value_changed', self, '_on_button_offset_changed') n['button_offset_y'].connect('value_changed', self, '_on_button_offset_changed') @@ -377,15 +379,8 @@ func load_theme(filename): n['theme_shadow_offset_y'].value = theme.get_value('text', 'shadow_offset', Vector2(2,2)).y n['theme_text_margin'].value = theme.get_value('text', 'margin', Vector2(20, 10)).x n['theme_text_margin_h'].value = theme.get_value('text', 'margin', Vector2(20, 10)).y - n['alignment'].text = theme.get_value('text', 'alignment', 'Left') - match n['alignment'].text: - 'Left': - n['alignment'].select(0) - 'Center': - n['alignment'].select(1) - 'Right': - n['alignment'].select(2) - + n['alignment'].select(n['alignment'].get_item_index(theme.get_value('text', 'alignment', 0))) + # Name n['name_font'].text = DialogicResources.get_filename_from_path(theme.get_value('name', 'font', 'res://addons/dialogic/Example Assets/Fonts/NameFont.tres')) @@ -623,12 +618,7 @@ func _on_NameFontOpen_pressed(): func _on_Alignment_item_selected(index) -> void: if loading: return - if index == 0: - DialogicResources.set_theme_value(current_theme, 'text', 'alignment', 'Left') - elif index == 1: - DialogicResources.set_theme_value(current_theme, 'text', 'alignment', 'Center') - elif index == 2: - DialogicResources.set_theme_value(current_theme, 'text', 'alignment', 'Right') + DialogicResources.set_theme_value(current_theme, 'text', 'alignment', n['alignment'].get_item_id(index)) _on_PreviewButton_pressed() # Refreshing the preview diff --git a/addons/dialogic/Editor/ThemeEditor/ThemeEditor.tscn b/addons/dialogic/Editor/ThemeEditor/ThemeEditor.tscn index 7f259cab6..b121fc349 100644 --- a/addons/dialogic/Editor/ThemeEditor/ThemeEditor.tscn +++ b/addons/dialogic/Editor/ThemeEditor/ThemeEditor.tscn @@ -9,7 +9,7 @@ [ext_resource path="res://addons/dialogic/Editor/ThemeEditor/AudioPicker.tscn" type="PackedScene" id=7] [ext_resource path="res://addons/dialogic/Editor/Common/TLabel.tscn" type="PackedScene" id=8] -[sub_resource type="Image" id=11] +[sub_resource type="Image" id=13] data = { "data": PoolByteArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), "format": "LumAlpha8", @@ -18,13 +18,13 @@ data = { "width": 16 } -[sub_resource type="ImageTexture" id=10] +[sub_resource type="ImageTexture" id=12] flags = 4 flags = 4 -image = SubResource( 11 ) +image = SubResource( 13 ) size = Vector2( 16, 16 ) -[sub_resource type="Image" id=12] +[sub_resource type="Image" id=14] data = { "data": PoolByteArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), "format": "LumAlpha8", @@ -33,10 +33,10 @@ data = { "width": 16 } -[sub_resource type="ImageTexture" id=8] +[sub_resource type="ImageTexture" id=10] flags = 4 flags = 4 -image = SubResource( 12 ) +image = SubResource( 14 ) size = Vector2( 16, 16 ) [node name="ThemeEditor" type="ScrollContainer"] @@ -102,7 +102,6 @@ size_flags_vertical = 3 tab_align = 0 [node name="Dialog Text" type="HBoxContainer" parent="VBoxContainer/TabContainer"] -visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 4.0 @@ -159,7 +158,7 @@ margin_left = 122.0 margin_right = 150.0 margin_bottom = 22.0 size_flags_vertical = 4 -icon = SubResource( 10 ) +icon = SubResource( 12 ) [node name="TLabel2" parent="VBoxContainer/TabContainer/Dialog Text/Column/GridContainer" instance=ExtResource( 8 )] anchor_right = 0.0 @@ -189,7 +188,7 @@ margin_left = 122.0 margin_right = 150.0 margin_bottom = 22.0 size_flags_vertical = 4 -icon = SubResource( 10 ) +icon = SubResource( 12 ) [node name="TLabel3" parent="VBoxContainer/TabContainer/Dialog Text/Column/GridContainer" instance=ExtResource( 8 )] anchor_right = 0.0 @@ -219,7 +218,7 @@ margin_left = 122.0 margin_right = 150.0 margin_bottom = 22.0 size_flags_vertical = 4 -icon = SubResource( 10 ) +icon = SubResource( 12 ) [node name="VSeparator" type="VSeparator" parent="VBoxContainer/TabContainer/Dialog Text"] margin_left = 280.0 @@ -407,6 +406,7 @@ margin_right = 232.0 margin_bottom = 76.0 [node name="Dialog Box" type="HBoxContainer" parent="VBoxContainer/TabContainer"] +visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 4.0 @@ -591,8 +591,8 @@ margin_top = 56.0 margin_right = 266.0 margin_bottom = 78.0 text = "Top Left" -icon = SubResource( 8 ) -items = [ "Top Left", SubResource( 10 ), false, 0, null, "Top Center", SubResource( 10 ), false, 1, null, "Top Right", SubResource( 10 ), false, 2, null, "", null, false, -1, null, "Center Left", SubResource( 10 ), false, 3, null, "Center", SubResource( 10 ), false, 4, null, "Center Right", SubResource( 10 ), false, 5, null, "", null, false, -1, null, "Bottom Left", SubResource( 10 ), false, 6, null, "Bottom Center", SubResource( 10 ), false, 7, null, "Bottom Right", SubResource( 10 ), false, 8, null ] +icon = SubResource( 10 ) +items = [ "Top Left", SubResource( 12 ), false, 0, null, "Top Center", SubResource( 12 ), false, 1, null, "Top Right", SubResource( 12 ), false, 2, null, "", null, false, -1, null, "Center Left", SubResource( 12 ), false, 3, null, "Center", SubResource( 12 ), false, 4, null, "Center Right", SubResource( 12 ), false, 5, null, "", null, false, -1, null, "Bottom Left", SubResource( 12 ), false, 6, null, "Bottom Center", SubResource( 12 ), false, 7, null, "Bottom Right", SubResource( 12 ), false, 8, null ] selected = 0 __meta__ = { "_edit_use_anchors_": false @@ -911,7 +911,7 @@ margin_left = 130.0 margin_right = 158.0 margin_bottom = 22.0 size_flags_vertical = 4 -icon = SubResource( 10 ) +icon = SubResource( 12 ) [node name="TLabel2" parent="VBoxContainer/TabContainer/Name Label/Column/GridContainer" instance=ExtResource( 8 )] anchor_right = 0.0 @@ -1411,8 +1411,8 @@ margin_right = 309.0 margin_bottom = 130.0 size_flags_horizontal = 3 text = "Top Left" -icon = SubResource( 8 ) -items = [ "Top Left", SubResource( 10 ), false, 0, null, "Top Center", SubResource( 10 ), false, 1, null, "Top Right", SubResource( 10 ), false, 2, null, "", null, false, -1, null, "Center Left", SubResource( 10 ), false, 3, null, "Center", SubResource( 10 ), false, 4, null, "Center Right", SubResource( 10 ), false, 5, null, "", null, false, -1, null, "Bottom Left", SubResource( 10 ), false, 6, null, "Bottom Center", SubResource( 10 ), false, 7, null, "Bottom Right", SubResource( 10 ), false, 8, null ] +icon = SubResource( 10 ) +items = [ "Top Left", SubResource( 12 ), false, 0, null, "Top Center", SubResource( 12 ), false, 1, null, "Top Right", SubResource( 12 ), false, 2, null, "", null, false, -1, null, "Center Left", SubResource( 12 ), false, 3, null, "Center", SubResource( 12 ), false, 4, null, "Center Right", SubResource( 12 ), false, 5, null, "", null, false, -1, null, "Bottom Left", SubResource( 12 ), false, 6, null, "Bottom Center", SubResource( 12 ), false, 7, null, "Bottom Right", SubResource( 12 ), false, 8, null ] selected = 0 [node name="TLabel6" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer" instance=ExtResource( 8 )] @@ -1513,7 +1513,7 @@ margin_left = 90.0 margin_right = 118.0 margin_bottom = 22.0 size_flags_vertical = 4 -icon = SubResource( 10 ) +icon = SubResource( 12 ) [node name="VSeparator" type="VSeparator" parent="VBoxContainer/TabContainer/Glossary"] margin_left = 280.0 @@ -1565,7 +1565,7 @@ margin_left = 90.0 margin_right = 118.0 margin_bottom = 22.0 size_flags_vertical = 4 -icon = SubResource( 10 ) +icon = SubResource( 12 ) [node name="TLabel2" parent="VBoxContainer/TabContainer/Glossary/Column3/GridContainer" instance=ExtResource( 8 )] anchor_right = 0.0 @@ -1612,7 +1612,7 @@ margin_left = 90.0 margin_right = 118.0 margin_bottom = 22.0 size_flags_vertical = 4 -icon = SubResource( 10 ) +icon = SubResource( 12 ) [node name="TLabel4" parent="VBoxContainer/TabContainer/Glossary/Column3/GridContainer" instance=ExtResource( 8 )] anchor_right = 0.0 @@ -1659,7 +1659,7 @@ margin_left = 90.0 margin_right = 118.0 margin_bottom = 22.0 size_flags_vertical = 4 -icon = SubResource( 10 ) +icon = SubResource( 12 ) [node name="TLabel6" parent="VBoxContainer/TabContainer/Glossary/Column3/GridContainer" instance=ExtResource( 8 )] anchor_right = 0.0 @@ -1857,7 +1857,6 @@ one_shot = true [connection signal="color_changed" from="VBoxContainer/TabContainer/Dialog Text/Column2/GridContainer/HBoxContainer2/ColorPickerButtonShadow" to="." method="_on_ColorPickerButtonShadow_color_changed"] [connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Text/Column2/GridContainer/HBoxContainer/ShadowOffsetX" to="." method="_on_ShadowOffset_value_changed"] [connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Text/Column2/GridContainer/HBoxContainer/ShadowOffsetY" to="." method="_on_ShadowOffset_value_changed"] -[connection signal="item_selected" from="VBoxContainer/TabContainer/Dialog Text/Column3/GridContainer/HBoxContainer3/Alignment" to="." method="_on_Alignment_item_selected"] [connection signal="color_changed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer2/ColorPickerButton" to="." method="_on_BackgroundColor_ColorPickerButton_color_changed"] [connection signal="pressed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3/BackgroundTextureButton" to="." method="_on_BackgroundTextureButton_pressed"] [connection signal="color_changed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6/ColorPickerButton" to="." method="_on_ColorPicker_Background_texture_modulation_color_changed"] diff --git a/addons/dialogic/Nodes/DialogNode.gd b/addons/dialogic/Nodes/DialogNode.gd index 44cbf654b..8a7bddcb1 100644 --- a/addons/dialogic/Nodes/DialogNode.gd +++ b/addons/dialogic/Nodes/DialogNode.gd @@ -111,8 +111,8 @@ func _ready(): $TextBubble.connect("text_completed", self, "_on_text_completed") $TextBubble.connect("letter_written", self, "_on_letter_written") $TextBubble.connect("signal_request", self, "_on_signal_request") - $TextBubble/RichTextLabel.connect('meta_hover_started', self, '_on_RichTextLabel_meta_hover_started') - $TextBubble/RichTextLabel.connect('meta_hover_ended', self, '_on_RichTextLabel_meta_hover_ended') + $TextBubble.text_label.connect('meta_hover_started', self, '_on_RichTextLabel_meta_hover_started') + $TextBubble.text_label.connect('meta_hover_ended', self, '_on_RichTextLabel_meta_hover_ended') if Engine.is_editor_hint(): if preview: diff --git a/addons/dialogic/Nodes/TextBubble.gd b/addons/dialogic/Nodes/TextBubble.gd index 42a640e75..2497bd0f9 100644 --- a/addons/dialogic/Nodes/TextBubble.gd +++ b/addons/dialogic/Nodes/TextBubble.gd @@ -3,6 +3,7 @@ extends Control var text_speed := 0.02 # Higher = lower speed var theme_text_speed = text_speed +var theme_text_max_height = 0 #experimental database of current commands var commands = [] @@ -10,7 +11,8 @@ var commands = [] var regex = RegEx.new() var bbcoderemoverregex = RegEx.new() -onready var text_label = $RichTextLabel +onready var text_container = $TextContainer +onready var text_label = $TextContainer/RichTextLabel onready var name_label = $NameLabel onready var next_indicator = $NextIndicatorContainer/NextIndicator @@ -85,15 +87,38 @@ func update_text(text:String): result = regex.search(text_bbcodefree) - - # Updating the text and starting the animation from 0 text_label.bbcode_text = text text_label.visible_characters = 0 + + ## SIZING THE RICHTEXTLABEL + # The sizing is done in a very terrible way because the RichtTextLabel has + # a hard time knowing what size it will be and how to display this. + # for this reason the RichTextLabel ist first set to just go for the size it needs, + # even if this might be more than available. + text_label.size_flags_vertical = 0 + text_label.fit_content_height = true + # a frame later, when the sizes have been updated, it will check if there + # is enough space or the scrollbar should be activated. + call_deferred("update_sizing") + + # updating the size alignment stuff text_label.grab_focus() start_text_timer() return true +func update_sizing(): + # this will enable/disable the scrollbar based on the size of the text + theme_text_max_height = text_container.rect_size.y + + if text_label.rect_size.y >= theme_text_max_height: + text_label.fit_content_height = false + text_label.size_flags_vertical = Control.SIZE_EXPAND_FILL + else: + text_label.fit_content_height = true + text_label.size_flags_vertical = 0 + + #handle an activated command. func handle_command(command:Array): if(command[1] == "speed"): @@ -134,6 +159,14 @@ func load_theme(theme: ConfigFile): text_label.set('custom_fonts/italics_font', DialogicUtil.path_fixer_load(theme.get_value('text', 'italic_font', 'res://addons/dialogic/Example Assets/Fonts/DefaultItalicFont.tres'))) name_label.set('custom_fonts/font', DialogicUtil.path_fixer_load(theme.get_value('name', 'font', 'res://addons/dialogic/Example Assets/Fonts/NameFont.tres'))) + # setting the vertical alignment + var alignment = theme.get_value('text', 'alignment',0) + if alignment <= 2: # top + text_container.alignment = BoxContainer.ALIGN_BEGIN + elif alignment <= 5: # center + text_container.alignment = BoxContainer.ALIGN_CENTER + elif alignment <= 8: # bottom + text_container.alignment = BoxContainer.ALIGN_END var text_color = Color(theme.get_value('text', 'color', '#ffffffff')) text_label.set('custom_colors/default_color', text_color) @@ -157,10 +190,10 @@ func load_theme(theme: ConfigFile): # Margin var text_margin = theme.get_value('text', 'margin', Vector2(20, 10)) - text_label.set('margin_left', text_margin.x) - text_label.set('margin_right', text_margin.x * -1) - text_label.set('margin_top', text_margin.y) - text_label.set('margin_bottom', text_margin.y * -1) + text_container.set('margin_left', text_margin.x) + text_container.set('margin_right', text_margin.x * -1) + text_container.set('margin_top', text_margin.y) + text_container.set('margin_bottom', text_margin.y * -1) # Backgrounds $TextureRect.texture = DialogicUtil.path_fixer_load(theme.get_value('background','image', "res://addons/dialogic/Example Assets/backgrounds/background-2.png")) @@ -219,7 +252,6 @@ func load_theme(theme: ConfigFile): var animation = theme.get_value('next_indicator', 'animation', 'Up and down') next_indicator.get_node('AnimationPlayer').play(animation) - # Saving reference to the current theme _theme = theme diff --git a/addons/dialogic/Nodes/TextBubble.tscn b/addons/dialogic/Nodes/TextBubble.tscn index ae2a94791..ae75be7a8 100644 --- a/addons/dialogic/Nodes/TextBubble.tscn +++ b/addons/dialogic/Nodes/TextBubble.tscn @@ -46,7 +46,7 @@ tracks/0/keys = { [sub_resource type="StyleBoxFlat" id=6] content_margin_left = 20.0 content_margin_right = 20.0 -content_margin_bottom = -200.0 +content_margin_bottom = -170.0 bg_color = Color( 1, 1, 1, 0 ) expand_margin_left = 10.0 @@ -56,7 +56,7 @@ anchor_top = 1.0 anchor_right = 0.5 anchor_bottom = 1.0 margin_left = -455.0 -margin_top = 393.0 +margin_top = 399.0 margin_right = 455.0 margin_bottom = 560.0 script = ExtResource( 4 ) @@ -83,13 +83,24 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="RichTextLabel" type="RichTextLabel" parent="."] +[node name="TextContainer" type="VBoxContainer" parent="."] anchor_right = 1.0 anchor_bottom = 1.0 -margin_left = 20.0 -margin_top = 10.0 -margin_right = -20.0 -margin_bottom = -10.0 +margin_left = 10.0 +margin_top = 12.0 +margin_right = -10.0 +margin_bottom = -12.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +alignment = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="RichTextLabel" type="RichTextLabel" parent="TextContainer"] +margin_top = 11.0 +margin_right = 890.0 +margin_bottom = 125.0 focus_mode = 2 custom_colors/default_color = Color( 1, 1, 1, 1 ) custom_colors/selection_color = Color( 0, 0, 0, 0 ) @@ -100,9 +111,16 @@ custom_fonts/normal_font = ExtResource( 1 ) custom_styles/focus = SubResource( 1 ) custom_styles/normal = SubResource( 2 ) bbcode_enabled = true -bbcode_text = "Placeholder text for testing and formatting." +bbcode_text = "Placeholder text for testing an formatting. +Placeholder text for testing an formatting. +adsd" +visible_characters = 0 +percent_visible = 0.0 meta_underlined = false -text = "Placeholder text for testing and formatting." +text = "Placeholder text for testing an formatting. +Placeholder text for testing an formatting. +adsd" +fit_content_height = true selection_enabled = true __meta__ = { "_edit_use_anchors_": false diff --git a/addons/dialogic/Other/DialogicResources.gd b/addons/dialogic/Other/DialogicResources.gd index 17870df14..564f77c0e 100644 --- a/addons/dialogic/Other/DialogicResources.gd +++ b/addons/dialogic/Other/DialogicResources.gd @@ -238,7 +238,7 @@ static func get_theme_config(filename: String): return config -static func set_theme_value(filename, section, key, value): +static func set_theme_value(filename:String, section:String, key:String, value): # WARNING: For use in the editor only var config = get_theme_config(filename) config.set_value(section, key, value) diff --git a/addons/dialogic/Other/DialogicUtil.gd b/addons/dialogic/Other/DialogicUtil.gd index b96655129..0dceeea60 100644 --- a/addons/dialogic/Other/DialogicUtil.gd +++ b/addons/dialogic/Other/DialogicUtil.gd @@ -487,8 +487,21 @@ static func resource_fixer(): i['event_id'] = 'dialogic_042' timeline['events'] = events DialogicResources.set_timeline(timeline) + if update_index < 2: + # Updates the text alignment to be saved as int like all anchors + print("[D] Update NR. "+str(update_index)+" | Changes how some theme values are saved. No need to worry about this.") + for theme_info in get_theme_list(): + var theme = DialogicResources.get_theme_config(theme_info['file']) + + match theme.get_value('text', 'alignment', 'Left'): + 'Left': + DialogicResources.set_theme_value(theme_info['file'], 'text', 'alignment', 0) + 'Center': + DialogicResources.set_theme_value(theme_info['file'], 'text', 'alignment', 1) + 'Right': + DialogicResources.set_theme_value(theme_info['file'], 'text', 'alignment', 2) - DialogicResources.set_settings_value("updates", "updatenumber", 1) + DialogicResources.set_settings_value("updates", "updatenumber", 2) ## ***************************************************************************** diff --git a/addons/dialogic/Parser/DialogicParser.gd b/addons/dialogic/Parser/DialogicParser.gd index d6e8d7621..bde02ce8b 100644 --- a/addons/dialogic/Parser/DialogicParser.gd +++ b/addons/dialogic/Parser/DialogicParser.gd @@ -1,6 +1,7 @@ extends Node class_name DialogicParser + # adds name coloring to the dialog texts static func parse_characters(dialog_script): var characters = DialogicUtil.get_character_list() @@ -173,11 +174,11 @@ static func parse_anchors(current_dialog): # adds the alignment BBCode to text events static func parse_alignment(current_dialog, text): - var alignment = current_dialog.current_theme.get_value('text', 'alignment', 'Left') + var alignment = current_dialog.current_theme.get_value('text', 'alignment', 0) var fname = current_dialog.current_theme.get_value('settings', 'name', 'none') - if alignment == 'Center': + if alignment in [1,4,7]: text = '[center]' + text + '[/center]' - elif alignment == 'Right': + elif alignment in [2,5,8]: text = '[right]' + text + '[/right]' return text