From c8a316e4b8987dad963656a34665fa0e23dedcb1 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Mon, 22 Apr 2024 16:34:25 +0200 Subject: update --- Dialogs/Alpha/alpha-sign.dtl | 2 + Dialogs/Alpha/yubiwa-girl.dtl | 12 + Dialogs/VisualNovelTextbox/animations.gd | 86 ++++++ .../VisualNovelTextbox/autoadvance_indicator.gd | 13 + .../custom_vn_textbox_layer.tscn | 342 +++++++++++++++++++++ Dialogs/VisualNovelTextbox/next.svg | 12 + Dialogs/VisualNovelTextbox/next.svg.import | 37 +++ .../vn_textbox_default_panel.tres | 12 + Dialogs/VisualNovelTextbox/vn_textbox_layer.gd | 222 +++++++++++++ .../vn_textbox_name_label_panel.tres | 12 + Dialogs/alpha-sign.dch | 19 -- Dialogs/alpha-sign.dtl | 1 - Dialogs/panel.tres | 12 + Dialogs/sign.tres | 20 +- 14 files changed, 774 insertions(+), 28 deletions(-) create mode 100644 Dialogs/Alpha/alpha-sign.dtl create mode 100644 Dialogs/Alpha/yubiwa-girl.dtl create mode 100644 Dialogs/VisualNovelTextbox/animations.gd create mode 100644 Dialogs/VisualNovelTextbox/autoadvance_indicator.gd create mode 100644 Dialogs/VisualNovelTextbox/custom_vn_textbox_layer.tscn create mode 100644 Dialogs/VisualNovelTextbox/next.svg create mode 100644 Dialogs/VisualNovelTextbox/next.svg.import create mode 100644 Dialogs/VisualNovelTextbox/vn_textbox_default_panel.tres create mode 100644 Dialogs/VisualNovelTextbox/vn_textbox_layer.gd create mode 100644 Dialogs/VisualNovelTextbox/vn_textbox_name_label_panel.tres delete mode 100644 Dialogs/alpha-sign.dch delete mode 100644 Dialogs/alpha-sign.dtl create mode 100644 Dialogs/panel.tres (limited to 'Dialogs') diff --git a/Dialogs/Alpha/alpha-sign.dtl b/Dialogs/Alpha/alpha-sign.dtl new file mode 100644 index 0000000..e491246 --- /dev/null +++ b/Dialogs/Alpha/alpha-sign.dtl @@ -0,0 +1,2 @@ +[style name="sign"] +Welcome to Alpha! #id:11 diff --git a/Dialogs/Alpha/yubiwa-girl.dtl b/Dialogs/Alpha/yubiwa-girl.dtl new file mode 100644 index 0000000..d4d6c20 --- /dev/null +++ b/Dialogs/Alpha/yubiwa-girl.dtl @@ -0,0 +1,12 @@ +[style name="sign"] +Mom's gonna be so mad at me...sob... +What's your name?\ +Bomberman? +My name's Honey, nice to meet you. +Max? Never heard of him... +My problem? +I was playing with my mom's ring, when Pommy took it and ran off to the forest with it. +Mom says not to go in the forest... +What? You'll go find it for me? +Thank you!!!\ +I'll wait here. diff --git a/Dialogs/VisualNovelTextbox/animations.gd b/Dialogs/VisualNovelTextbox/animations.gd new file mode 100644 index 0000000..43eca1f --- /dev/null +++ b/Dialogs/VisualNovelTextbox/animations.gd @@ -0,0 +1,86 @@ +extends AnimationPlayer + +## A custom script/node that adds some animations to the textbox. + +# Careful: Sync these with the ones in the root script! +enum AnimationsIn {NONE, POP_IN, FADE_UP} +enum AnimationsOut {NONE, POP_OUT, FADE_DOWN} +enum AnimationsNewText {NONE, WIGGLE} + +var animation_in : AnimationsIn +var animation_out : AnimationsOut +var animation_new_text : AnimationsNewText + +var full_clear : bool = true + +func get_text_panel() -> PanelContainer: + return %DialogTextPanel + + +func get_dialog() -> DialogicNode_DialogText: + return %DialogicNode_DialogText + + +func _ready() -> void: + var text_system : Node = DialogicUtil.autoload().get(&'Text') + var _error : int = 0 + _error = text_system.connect(&'animation_textbox_hide', _on_textbox_hide) + _error = text_system.connect(&'animation_textbox_show', _on_textbox_show) + _error = text_system.connect(&'animation_textbox_new_text', _on_textbox_new_text) + _error = text_system.connect(&'about_to_show_text', _on_about_to_show_text) + + +func _on_textbox_show() -> void: + if animation_in == AnimationsIn.NONE: + return + play('RESET') + 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 = "" + match animation_in: + AnimationsIn.POP_IN: + play("textbox_pop") + AnimationsIn.FADE_UP: + play("textbox_fade_up") + if not is_connected(&'animation_finished', Callable(animation_system, &'animation_finished')): + var _error : int = connect(&'animation_finished', Callable(animation_system, &'animation_finished'), CONNECT_ONE_SHOT) + + +func _on_textbox_hide() -> void: + if animation_out == AnimationsOut.NONE: + return + play('RESET') + var animation_system : Node = DialogicUtil.autoload().get(&'Animations') + animation_system.call(&'start_animating') + match animation_out: + AnimationsOut.POP_OUT: + play_backwards("textbox_pop") + AnimationsOut.FADE_DOWN: + play_backwards("textbox_fade_up") + + if not is_connected(&'animation_finished', Callable(animation_system, &'animation_finished')): + var _error : int = connect(&'animation_finished', Callable(animation_system, &'animation_finished'), CONNECT_ONE_SHOT) + + +func _on_about_to_show_text(info:Dictionary) -> void: + full_clear = !info.append + + +func _on_textbox_new_text() -> void: + if DialogicUtil.autoload().Inputs.auto_skip.enabled: + return + + if animation_new_text == AnimationsNewText.NONE: + return + + var animation_system : Node = DialogicUtil.autoload().get(&'Animation') + animation_system.call(&'start_animating') + if full_clear: + get_dialog().text = "" + match animation_new_text: + AnimationsNewText.WIGGLE: + play("new_text") + + if not is_connected(&'animation_finished', Callable(animation_system, &'animation_finished')): + var _error : int = connect(&'animation_finished', Callable(animation_system, &'animation_finished'), CONNECT_ONE_SHOT) diff --git a/Dialogs/VisualNovelTextbox/autoadvance_indicator.gd b/Dialogs/VisualNovelTextbox/autoadvance_indicator.gd new file mode 100644 index 0000000..fa8bbff --- /dev/null +++ b/Dialogs/VisualNovelTextbox/autoadvance_indicator.gd @@ -0,0 +1,13 @@ +extends Range + +var enabled : bool = true + +func _process(_delta : float) -> void: + if !enabled: + hide() + return + if DialogicUtil.autoload().Inputs.auto_advance.get_progress() < 0: + hide() + else: + show() + value = DialogicUtil.autoload().Inputs.auto_advance.get_progress() diff --git a/Dialogs/VisualNovelTextbox/custom_vn_textbox_layer.tscn b/Dialogs/VisualNovelTextbox/custom_vn_textbox_layer.tscn new file mode 100644 index 0000000..8bbbd7f --- /dev/null +++ b/Dialogs/VisualNovelTextbox/custom_vn_textbox_layer.tscn @@ -0,0 +1,342 @@ +[gd_scene load_steps=17 format=3 uid="uid://brorxy0ukjs2g"] + +[ext_resource type="Script" path="res://Dialogs/VisualNovelTextbox/vn_textbox_layer.gd" id="1_bpydr"] +[ext_resource type="Script" path="res://Dialogs/VisualNovelTextbox/animations.gd" id="2_xy7a2"] +[ext_resource type="Script" path="res://addons/dialogic/Modules/Text/node_dialog_text.gd" id="3_4634k"] +[ext_resource type="StyleBox" uid="uid://dkv1pl1c1dq6" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Textbox/vn_textbox_default_panel.tres" id="3_ssa84"] +[ext_resource type="Script" path="res://addons/dialogic/Modules/Text/node_type_sound.gd" id="4_ma5mw"] +[ext_resource type="Script" path="res://addons/dialogic/Modules/Text/node_next_indicator.gd" id="5_40a50"] +[ext_resource type="Script" path="res://Dialogs/VisualNovelTextbox/autoadvance_indicator.gd" id="6_07xym"] +[ext_resource type="Texture2D" uid="uid://b0rpqfg4fhebk" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Textbox/next.svg" id="6_uch03"] +[ext_resource type="Script" path="res://addons/dialogic/Modules/Text/node_name_label.gd" id="7_bi7sh"] +[ext_resource type="StyleBox" uid="uid://m7gyepkysu83" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Textbox/vn_textbox_name_label_panel.tres" id="9_yg8ig"] + +[sub_resource type="Animation" id="Animation_au0a2"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Anchor/AnimationParent:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(0, 0)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Anchor/AnimationParent:rotation") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [0.0] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Anchor/AnimationParent:scale") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(1, 1)] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Anchor/AnimationParent:modulate") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 1)] +} +tracks/4/type = "bezier" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("Anchor/AnimationParent/Sizer/DialogTextPanel:rotation") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} + +[sub_resource type="Animation" id="Animation_6kbwc"] +resource_name = "new_text" +length = 0.4 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Anchor/AnimationParent/Sizer/DialogTextPanel:rotation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(3, 3, 3, 3, 3), +"points": PackedFloat32Array(0, -0.025, 0, 0.025, 0, 0.005, -0.025, 0, 0.025, 0, -0.005, -0.025, 0, 0.025, 0, 0.005, -0.025, 0, 0.025, 0, 0, -0.025, 0, 0.025, 0), +"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4) +} + +[sub_resource type="Animation" id="Animation_g6k55"] +resource_name = "textbox_fade_up" +length = 0.7 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Anchor/AnimationParent:position") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.3, 0.7), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 0, +"values": [Vector2(0, 50), Vector2(0, 19.6793), Vector2(0, 0)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Anchor/AnimationParent:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0.1, 0.6), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Anchor/AnimationParent:rotation") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [0.0] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Anchor/AnimationParent:scale") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(1, 1)] +} + +[sub_resource type="Animation" id="Animation_htbgc"] +resource_name = "textbox_pop" +length = 0.3 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Anchor/AnimationParent:position") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(0, 0)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Anchor/AnimationParent:rotation") +tracks/1/interp = 2 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.2, 0.3), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 0, +"values": [-0.0899883, 0.0258223, 0.0] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Anchor/AnimationParent:scale") +tracks/2/interp = 2 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0, 0.2, 0.3), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 0, +"values": [Vector2(0.793957, 0.778082), Vector2(0.937299, 1.14248), Vector2(1, 1)] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Anchor/AnimationParent:modulate") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0, 0.3), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_c14kh"] +_data = { +"RESET": SubResource("Animation_au0a2"), +"new_text": SubResource("Animation_6kbwc"), +"textbox_fade_up": SubResource("Animation_g6k55"), +"textbox_pop": SubResource("Animation_htbgc") +} + +[sub_resource type="FontVariation" id="FontVariation_v8y64"] + +[node name="VN_TextboxLayer" type="Control"] +process_mode = 3 +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +script = ExtResource("1_bpydr") +box_panel = "res://Dialogs/VisualNovelTextbox/vn_textbox_default_panel.tres" +box_size = Vector2(550, 150) +name_label_box_panel = "res://Dialogs/VisualNovelTextbox/vn_textbox_name_label_panel.tres" +name_label_box_modulate = Color(0, 0, 0, 1) + +[node name="Animations" type="AnimationPlayer" parent="."] +unique_name_in_owner = true +libraries = { +"": SubResource("AnimationLibrary_c14kh") +} +autoplay = "RESET" +script = ExtResource("2_xy7a2") + +[node name="Anchor" type="Control" parent="."] +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 0 + +[node name="AnimationParent" type="Control" parent="Anchor"] +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 0 +mouse_filter = 2 + +[node name="Sizer" type="Control" parent="Anchor/AnimationParent"] +unique_name_in_owner = true +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -150.0 +offset_top = -50.0 +offset_right = 150.0 +grow_horizontal = 2 +grow_vertical = 0 + +[node name="DialogTextPanel" type="PanelContainer" parent="Anchor/AnimationParent/Sizer"] +unique_name_in_owner = true +self_modulate = Color(0.00784314, 0.00784314, 0.00784314, 0.843137) +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +theme_override_styles/panel = ExtResource("3_ssa84") +metadata/_edit_layout_mode = 1 + +[node name="DialogicNode_DialogText" type="RichTextLabel" parent="Anchor/AnimationParent/Sizer/DialogTextPanel" node_paths=PackedStringArray("textbox_root")] +unique_name_in_owner = true +layout_mode = 2 +mouse_filter = 1 +theme_override_colors/default_color = Color(1, 1, 1, 1) +theme_override_font_sizes/normal_font_size = 15 +theme_override_font_sizes/bold_font_size = 15 +theme_override_font_sizes/italics_font_size = 15 +theme_override_font_sizes/bold_italics_font_size = 15 +bbcode_enabled = true +text = "Some default text" +visible_characters_behavior = 1 +script = ExtResource("3_4634k") +textbox_root = NodePath("..") + +[node name="DialogicNode_TypeSounds" type="AudioStreamPlayer" parent="Anchor/AnimationParent/Sizer/DialogTextPanel/DialogicNode_DialogText"] +unique_name_in_owner = true +script = ExtResource("4_ma5mw") +play_every_character = 0 + +[node name="NextIndicator" type="Control" parent="Anchor/AnimationParent/Sizer/DialogTextPanel"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 8 +size_flags_vertical = 8 +script = ExtResource("5_40a50") +show_on_questions = true +texture = ExtResource("6_uch03") +metadata/_edit_layout_mode = 1 + +[node name="AutoAdvanceProgressbar" type="ProgressBar" parent="Anchor/AnimationParent/Sizer/DialogTextPanel"] +unique_name_in_owner = true +modulate = Color(1, 1, 1, 0.188235) +custom_minimum_size = Vector2(0, 10) +layout_mode = 2 +size_flags_vertical = 8 +max_value = 1.0 +step = 0.001 +value = 0.5 +show_percentage = false +script = ExtResource("6_07xym") + +[node name="NameLabelHolder" type="Control" parent="Anchor/AnimationParent/Sizer/DialogTextPanel"] +layout_mode = 2 +mouse_filter = 2 + +[node name="NameLabelPanel" type="PanelContainer" parent="Anchor/AnimationParent/Sizer/DialogTextPanel/NameLabelHolder"] +unique_name_in_owner = true +self_modulate = Color(0.00784314, 0.00784314, 0.00784314, 0.843137) +layout_mode = 1 +offset_top = -50.0 +offset_right = 9.0 +offset_bottom = -25.0 +theme_override_styles/panel = ExtResource("9_yg8ig") +metadata/_edit_layout_mode = 1 +metadata/_edit_use_custom_anchors = true +metadata/_edit_group_ = true + +[node name="DialogicNode_NameLabel" type="Label" parent="Anchor/AnimationParent/Sizer/DialogTextPanel/NameLabelHolder/NameLabelPanel" node_paths=PackedStringArray("name_label_root")] +unique_name_in_owner = true +layout_mode = 2 +theme_override_colors/font_color = Color(1, 1, 1, 1) +theme_override_fonts/font = SubResource("FontVariation_v8y64") +theme_override_font_sizes/font_size = 15 +text = "S" +script = ExtResource("7_bi7sh") +name_label_root = NodePath("..") diff --git a/Dialogs/VisualNovelTextbox/next.svg b/Dialogs/VisualNovelTextbox/next.svg new file mode 100644 index 0000000..ae877a2 --- /dev/null +++ b/Dialogs/VisualNovelTextbox/next.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/Dialogs/VisualNovelTextbox/next.svg.import b/Dialogs/VisualNovelTextbox/next.svg.import new file mode 100644 index 0000000..2d7283b --- /dev/null +++ b/Dialogs/VisualNovelTextbox/next.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://0uscbnti76fk" +path="res://.godot/imported/next.svg-89a4d1abb4d1d275604ee07db624369b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Dialogs/VisualNovelTextbox/next.svg" +dest_files=["res://.godot/imported/next.svg-89a4d1abb4d1d275604ee07db624369b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/Dialogs/VisualNovelTextbox/vn_textbox_default_panel.tres b/Dialogs/VisualNovelTextbox/vn_textbox_default_panel.tres new file mode 100644 index 0000000..07489b4 --- /dev/null +++ b/Dialogs/VisualNovelTextbox/vn_textbox_default_panel.tres @@ -0,0 +1,12 @@ +[gd_resource type="StyleBoxFlat" format=3 uid="uid://dkv1pl1c1dq6"] + +[resource] +content_margin_left = 15.0 +content_margin_top = 15.0 +content_margin_right = 15.0 +content_margin_bottom = 15.0 +bg_color = Color(1, 1, 1, 1) +corner_radius_top_left = 5 +corner_radius_top_right = 5 +corner_radius_bottom_right = 5 +corner_radius_bottom_left = 5 diff --git a/Dialogs/VisualNovelTextbox/vn_textbox_layer.gd b/Dialogs/VisualNovelTextbox/vn_textbox_layer.gd new file mode 100644 index 0000000..d560305 --- /dev/null +++ b/Dialogs/VisualNovelTextbox/vn_textbox_layer.gd @@ -0,0 +1,222 @@ +@tool +extends DialogicLayoutLayer + +## A layer that contains +## - a dialog_text node +## - a name_label node +## - a next_indicator node +## - a type_sound node +## +## as well as custom +## - animations +## - auto-advance progress indicator + + +enum Alignments {LEFT, CENTER, RIGHT} + +enum AnimationsIn {NONE, POP_IN, FADE_UP} +enum AnimationsOut {NONE, POP_OUT, FADE_DOWN} +enum AnimationsNewText {NONE, WIGGLE} + +@export_group("Text") +@export_subgroup("Alignment & Size") +@export var text_alignment: Alignments= Alignments.LEFT +@export var text_use_global_size: bool = true +@export var text_size: int = 15 + +@export_subgroup("Color") +@export var text_use_global_color: bool = true +@export var text_custom_color: Color = Color.WHITE + +@export_subgroup('Font') +@export var text_use_global_font: bool = true +@export_file('*.ttf') var normal_font:String = "" +@export_file('*.ttf') var bold_font:String = "" +@export_file('*.ttf') var italic_font:String = "" +@export_file('*.ttf') var bold_italic_font:String = "" + +@export_group("Box") +@export_subgroup("Panel") +@export_file("*.tres") var box_panel: String = this_folder.path_join("vn_textbox_default_panel.tres") +@export_subgroup("Color") +@export var box_color_use_global: bool = true +@export var box_color_custom: Color = Color.BLACK +@export_subgroup("Size & Position") +@export var box_size: Vector2 = Vector2(550, 110) +@export var box_margin_bottom: int = 15 +@export_subgroup("Animation") +@export var box_animation_in: AnimationsIn = AnimationsIn.FADE_UP +@export var box_animation_out: AnimationsOut = AnimationsOut.FADE_DOWN +@export var box_animation_new_text: AnimationsNewText = AnimationsNewText.NONE + +@export_group("Name Label") +@export_subgroup('Color') +@export var name_label_use_global_color: bool= true +@export var name_label_use_character_color: bool = true +@export var name_label_custom_color: Color = Color.WHITE +@export_subgroup('Font') +@export var name_label_use_global_font: bool = true +@export_file('*.ttf') var name_label_font: String = "" +@export var name_label_use_global_font_size: bool = true +@export var name_label_custom_font_size: int = 15 +@export_subgroup('Box') +@export_file("*.tres") var name_label_box_panel: String = this_folder.path_join("vn_textbox_name_label_panel.tres") +@export var name_label_box_use_global_color: bool = true +@export var name_label_box_modulate: Color = box_color_custom +@export_subgroup('Alignment') +@export var name_label_alignment: Alignments = Alignments.LEFT +@export var name_label_box_offset: Vector2 = Vector2.ZERO + +@export_group("Indicators") +@export_subgroup("Next Indicator") +@export var next_indicator_enabled: bool = true +@export var next_indicator_show_on_questions: bool = true +@export var next_indicator_show_on_autoadvance: bool = false +@export_enum('bounce', 'blink', 'none') var next_indicator_animation: int = 0 +@export_file("*.png","*.svg","*.tres") var next_indicator_texture: String = '' +@export var next_indicator_size: Vector2 = Vector2(25,25) + +@export_subgroup("Autoadvance") +@export var autoadvance_progressbar: bool = true + +@export_group('Sounds') +@export_subgroup('Typing Sounds') +@export var typing_sounds_enabled: bool = true +@export var typing_sounds_mode: DialogicNode_TypeSounds.Modes = DialogicNode_TypeSounds.Modes.INTERRUPT +@export_dir var typing_sounds_sounds_folder: String = "res://addons/dialogic/Example Assets/sound-effects/" +@export_file("*.wav", "*.ogg", "*.mp3") var typing_sounds_end_sound: String = "" +@export_range(1, 999, 1) var typing_sounds_every_nths_character: int = 1 +@export_range(0.01, 4, 0.01) var typing_sounds_pitch: float = 1.0 +@export_range(0.0, 3.0) var typing_sounds_pitch_variance: float = 0.0 +@export_range(-80, 24, 0.01) var typing_sounds_volume: float = -10 +@export_range(0.0, 10) var typing_sounds_volume_variance: float = 0.0 +@export var typing_sounds_ignore_characters: String = " .,!?" + + +func _apply_export_overrides() -> void: + if !is_inside_tree(): + await ready + + ## FONT SETTINGS + var dialog_text: DialogicNode_DialogText = %DialogicNode_DialogText + dialog_text.alignment = text_alignment as DialogicNode_DialogText.Alignment + + if text_use_global_size: + text_size = get_global_setting(&'font_size', text_size) + dialog_text.add_theme_font_size_override(&"normal_font_size", text_size) + dialog_text.add_theme_font_size_override(&"bold_font_size", text_size) + dialog_text.add_theme_font_size_override(&"italics_font_size", text_size) + dialog_text.add_theme_font_size_override(&"bold_italics_font_size", text_size) + + if text_use_global_color: + dialog_text.add_theme_color_override(&"default_color", get_global_setting(&'font_color', text_custom_color) as Color) + else: + dialog_text.add_theme_color_override(&"default_color", text_custom_color) + + if text_use_global_font and get_global_setting(&'font', false): + dialog_text.add_theme_font_override(&"normal_font", load(get_global_setting(&'font', '') as String) as Font) + elif !normal_font.is_empty(): + dialog_text.add_theme_font_override(&"normal_font", load(normal_font) as Font) + if !bold_font.is_empty(): + dialog_text.add_theme_font_override(&"bold_font", load(bold_font) as Font) + if !italic_font.is_empty(): + dialog_text.add_theme_font_override(&"italitc_font", load(italic_font) as Font) + if !bold_italic_font.is_empty(): + dialog_text.add_theme_font_override(&"bold_italics_font", load(bold_italic_font) as Font) + + ## BOX SETTINGS + var dialog_text_panel: PanelContainer = %DialogTextPanel + if ResourceLoader.exists(box_panel): + dialog_text_panel.add_theme_stylebox_override(&'panel', load(box_panel) as StyleBox) + + if box_color_use_global: + dialog_text_panel.self_modulate = get_global_setting(&'bg_color', box_color_custom) + else: + dialog_text_panel.self_modulate = box_color_custom + + var sizer: Control = %Sizer + sizer.size = box_size + sizer.position = box_size * Vector2(-0.5, -1)+Vector2(0, -box_margin_bottom) + + ## BOX ANIMATIONS + var animations: AnimationPlayer = %Animations + animations.set(&'animation_in', box_animation_in) + animations.set(&'animation_out', box_animation_out) + animations.set(&'animation_new_text', box_animation_new_text) + + ## NAME LABEL SETTINGS + var name_label: DialogicNode_NameLabel = %DialogicNode_NameLabel + if name_label_use_global_font_size: + name_label.add_theme_font_size_override(&"font_size", get_global_setting(&'font_size', name_label_custom_font_size) as int) + else: + name_label.add_theme_font_size_override(&"font_size", name_label_custom_font_size) + + if name_label_use_global_font and get_global_setting(&'font', false): + name_label.add_theme_font_override(&'font', load(get_global_setting(&'font', '') as String) as Font) + elif not name_label_font.is_empty(): + name_label.add_theme_font_override(&'font', load(name_label_font) as Font) + + if name_label_use_global_color: + name_label.add_theme_color_override(&"font_color", get_global_setting(&'font_color', name_label_custom_color) as Color) + else: + name_label.add_theme_color_override(&"font_color", name_label_custom_color) + + name_label.use_character_color = name_label_use_character_color + + var name_label_panel: PanelContainer = %NameLabelPanel + if ResourceLoader.exists(name_label_box_panel): + name_label_panel.add_theme_stylebox_override(&'panel', load(name_label_box_panel) as StyleBox) + else: + name_label_panel.add_theme_stylebox_override(&'panel', load(this_folder.path_join("vn_textbox_name_label_panel.tres")) as StyleBox) + + if name_label_box_use_global_color: + name_label_panel.self_modulate = get_global_setting(&'bg_color', name_label_box_modulate) + else: + name_label_panel.self_modulate = name_label_box_modulate + + name_label_panel.position = name_label_box_offset+Vector2(0, -40) + name_label_panel.position -= Vector2( + dialog_text_panel.get_theme_stylebox(&'panel', &'PanelContainer').content_margin_left, + dialog_text_panel.get_theme_stylebox(&'panel', &'PanelContainer').content_margin_top) + name_label_panel.anchor_left = name_label_alignment/2.0 + name_label_panel.anchor_right = name_label_alignment/2.0 + name_label_panel.grow_horizontal = [1, 2, 0][name_label_alignment] + + ## NEXT INDICATOR SETTINGS + var next_indicator: DNextIndicator = %NextIndicator + next_indicator.enabled = next_indicator_enabled + + if next_indicator_enabled: + next_indicator.animation = next_indicator_animation + if FileAccess.file_exists(next_indicator_texture): + next_indicator.texture = load(next_indicator_texture) + next_indicator.show_on_questions = next_indicator_show_on_questions + next_indicator.show_on_autoadvance = next_indicator_show_on_autoadvance + next_indicator.texture_size = next_indicator_size + + ## OTHER + var progress_bar: ProgressBar = %AutoAdvanceProgressbar + progress_bar.set(&'enabled', autoadvance_progressbar) + + #### SOUNDS + + ## TYPING SOUNDS + var type_sounds: DialogicNode_TypeSounds = %DialogicNode_TypeSounds + type_sounds.enabled = typing_sounds_enabled + type_sounds.mode = typing_sounds_mode + if not typing_sounds_sounds_folder.is_empty(): + type_sounds.sounds = DialogicNode_TypeSounds.load_sounds_from_path(typing_sounds_sounds_folder) + else: + type_sounds.sounds.clear() + if not typing_sounds_end_sound.is_empty(): + type_sounds.end_sound = load(typing_sounds_end_sound) + else: + type_sounds.end_sound = null + + type_sounds.play_every_character = typing_sounds_every_nths_character + type_sounds.base_pitch = typing_sounds_pitch + type_sounds.base_volume = typing_sounds_volume + type_sounds.pitch_variance = typing_sounds_pitch_variance + type_sounds.volume_variance = typing_sounds_volume_variance + type_sounds.ignore_characters = typing_sounds_ignore_characters + diff --git a/Dialogs/VisualNovelTextbox/vn_textbox_name_label_panel.tres b/Dialogs/VisualNovelTextbox/vn_textbox_name_label_panel.tres new file mode 100644 index 0000000..cc88fd9 --- /dev/null +++ b/Dialogs/VisualNovelTextbox/vn_textbox_name_label_panel.tres @@ -0,0 +1,12 @@ +[gd_resource type="StyleBoxFlat" format=3 uid="uid://m7gyepkysu83"] + +[resource] +content_margin_left = 10.0 +content_margin_top = 5.0 +content_margin_right = 10.0 +content_margin_bottom = 5.0 +bg_color = Color(1, 1, 1, 1) +corner_radius_top_left = 5 +corner_radius_top_right = 5 +corner_radius_bottom_right = 5 +corner_radius_bottom_left = 5 diff --git a/Dialogs/alpha-sign.dch b/Dialogs/alpha-sign.dch deleted file mode 100644 index 57978b0..0000000 --- a/Dialogs/alpha-sign.dch +++ /dev/null @@ -1,19 +0,0 @@ -{ -"@path": "res://addons/dialogic/Resources/character.gd", -"@subpath": NodePath(""), -"_translation_id": "12", -"color": Color(1, 1, 1, 1), -"custom_info": { -"sound_mood_default": "", -"sound_moods": {}, -"style": "" -}, -"default_portrait": "", -"description": "", -"display_name": "alpha-sign", -"mirror": false, -"nicknames": [""], -"offset": Vector2(0, 0), -"portraits": {}, -"scale": 1.0 -} \ No newline at end of file diff --git a/Dialogs/alpha-sign.dtl b/Dialogs/alpha-sign.dtl deleted file mode 100644 index a6ec4ec..0000000 --- a/Dialogs/alpha-sign.dtl +++ /dev/null @@ -1 +0,0 @@ -Welcome to Alpha! #id:11 diff --git a/Dialogs/panel.tres b/Dialogs/panel.tres new file mode 100644 index 0000000..7f0334e --- /dev/null +++ b/Dialogs/panel.tres @@ -0,0 +1,12 @@ +[gd_resource type="StyleBoxFlat" format=3 uid="uid://dh8pk62vmxdrf"] + +[resource] +content_margin_left = 5.0 +content_margin_top = 5.0 +content_margin_right = 5.0 +content_margin_bottom = 5.0 +bg_color = Color(1, 1, 1, 1) +corner_radius_top_left = 5 +corner_radius_top_right = 5 +corner_radius_bottom_right = 5 +corner_radius_bottom_left = 5 diff --git a/Dialogs/sign.tres b/Dialogs/sign.tres index 6ba3d7d..d886188 100644 --- a/Dialogs/sign.tres +++ b/Dialogs/sign.tres @@ -3,7 +3,7 @@ [ext_resource type="PackedScene" uid="uid://c1k5m0w3r40xf" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_FullBackground/full_background_layer.tscn" id="1_p87lh"] [ext_resource type="Script" path="res://addons/dialogic/Resources/dialogic_style_layer.gd" id="2_lxhqr"] [ext_resource type="PackedScene" uid="uid://cy1y14inwkplb" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Portraits/vn_portrait_layer.tscn" id="3_rgd8m"] -[ext_resource type="PackedScene" uid="uid://bquja8jyk8kbr" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Textbox/vn_textbox_layer.tscn" id="4_4p2ej"] +[ext_resource type="PackedScene" uid="uid://brorxy0ukjs2g" path="res://Dialogs/VisualNovelTextbox/custom_vn_textbox_layer.tscn" id="4_wm0x6"] [ext_resource type="PackedScene" uid="uid://cn674foxwedqu" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_Input/full_advance_input_layer.tscn" id="5_moqv1"] [ext_resource type="PackedScene" uid="uid://dsbwnp5hegnu3" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_Glossary/glossary_popup_layer.tscn" id="6_f0yxf"] [ext_resource type="PackedScene" uid="uid://dhk6j6eb6e3q" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Choices/vn_choice_layer.tscn" id="7_kexg8"] @@ -14,7 +14,9 @@ [sub_resource type="Resource" id="Resource_te4vy"] script = ExtResource("2_lxhqr") scene = ExtResource("1_p87lh") -overrides = {} +overrides = { +"disabled": "true" +} [sub_resource type="Resource" id="Resource_76v7p"] script = ExtResource("2_lxhqr") @@ -23,11 +25,11 @@ overrides = {} [sub_resource type="Resource" id="Resource_s78c1"] script = ExtResource("2_lxhqr") -scene = ExtResource("4_4p2ej") +scene = ExtResource("4_wm0x6") overrides = { -"box_margin_bottom": "10.0", -"box_panel": "\"vn_textbox_default_panel.tres\"", -"box_size": "Vector2(5, 5)", +"box_margin_bottom": "5.0", +"box_panel": "\"res://Dialogs/panel.tres\"", +"box_size": "Vector2(200, 35)", "next_indicator_size": "Vector2(5, 5)", "text_alignment": "1", "text_size": "8.0", @@ -37,7 +39,9 @@ overrides = { [sub_resource type="Resource" id="Resource_f5n0s"] script = ExtResource("2_lxhqr") scene = ExtResource("5_moqv1") -overrides = {} +overrides = { +"disabled": "true" +} [sub_resource type="Resource" id="Resource_bah1v"] script = ExtResource("2_lxhqr") @@ -64,4 +68,4 @@ script = ExtResource("10_ginwr") name = "sign" base_overrides = {} layers = Array[ExtResource("2_lxhqr")]([SubResource("Resource_te4vy"), SubResource("Resource_76v7p"), SubResource("Resource_s78c1"), SubResource("Resource_f5n0s"), SubResource("Resource_bah1v"), SubResource("Resource_nvm0p"), SubResource("Resource_rg2lt"), SubResource("Resource_f6fwr")]) -metadata/_latest_layer = 2 +metadata/_latest_layer = -1 -- cgit v1.2.3