Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ mono_crash.*.json
/saves/
/addons/*
!addons/gd-plug
!addons/vnkit
!addons/raku-dialogue-ui
81 changes: 81 additions & 0 deletions addons/raku-dialogue-ui/RakuDialogueUI.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
[gd_scene load_steps=7 format=2]

[ext_resource path="res://addons/advanced-text/nodes/AdvancedTextLabel.gd" type="Script" id=1]
[ext_resource path="res://addons/raku-dialogue-ui/ui/Notification.gd" type="Script" id=2]
[ext_resource path="res://addons/raku-dialogue-ui/ui/DialogueUI/MenuContainer.gd" type="Script" id=3]
[ext_resource path="res://addons/raku-dialogue-ui/themes/flat_drak_theme.tres" type="Theme" id=4]
[ext_resource path="res://addons/raku-dialogue-ui/ui/DialogueUI/DialogueUI.tscn" type="PackedScene" id=5]
[ext_resource path="res://addons/raku-dialogue-ui/ui/DialogueUI/ChoiceButton.tscn" type="PackedScene" id=8]

[node name="RakuDialogueUI" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
rect_min_size = Vector2( 1024, 600 )
theme = ExtResource( 4 )

[node name="TestBG" type="ColorRect" parent="."]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
color = Color( 0.631373, 0.121569, 0.121569, 1 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="DialogueUI" parent="." instance=ExtResource( 5 )]

[node name="MenuContainer" type="ScrollContainer" parent="."]
anchor_left = 0.119
anchor_top = 0.067
anchor_right = 0.9
anchor_bottom = 0.733
margin_left = 0.143997
margin_top = -0.200001
margin_right = 0.400024
margin_bottom = 0.200012
rect_min_size = Vector2( 800, 400 )
rect_clip_content = false
mouse_filter = 1
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 3 )
__meta__ = {
"_editor_description_": ""
}
choice_button_scene = ExtResource( 8 )

[node name="ChoicesBox" type="VBoxContainer" parent="MenuContainer"]
margin_right = 800.0
margin_bottom = 400.0
rect_min_size = Vector2( 500, 300 )
size_flags_horizontal = 3
size_flags_vertical = 3
alignment = 1

[node name="Notification" type="Popup" parent="."]
margin_right = 476.0
margin_bottom = 40.0
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Timer" type="Timer" parent="Notification"]
one_shot = true

[node name="Panel" type="Panel" parent="Notification"]
anchor_right = 1.0
anchor_bottom = 1.0

[node name="Label" type="RichTextLabel" parent="Notification/Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
bbcode_enabled = true
bbcode_text = "Notification"
text = "Notification"
script = ExtResource( 1 )
__meta__ = {
"_default_markup": "markdown",
"_edit_use_anchors_": false
}
markup_text = "Notification"
57 changes: 57 additions & 0 deletions addons/raku-dialogue-ui/fonts/AdvancedTextTheme.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[gd_resource type="Theme" load_steps=12 format=2]

[ext_resource path="res://addons/advanced-text/font/DejaVuSans-Bold.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://addons/advanced-text/font/DejaVuSans.ttf" type="DynamicFontData" id=2]
[ext_resource path="res://addons/advanced-text/font/DejaVuSans-BoldOblique.ttf" type="DynamicFontData" id=3]
[ext_resource path="res://addons/advanced-text/font/DejaVuSans-Oblique.ttf" type="DynamicFontData" id=4]
[ext_resource path="res://addons/advanced-text/font/DejaVuSansMono.ttf" type="DynamicFontData" id=5]

[sub_resource type="DynamicFont" id=6]
size = 32
use_filter = true
font_data = ExtResource( 2 )

[sub_resource type="DynamicFont" id=1]
size = 32
use_filter = true
font_data = ExtResource( 1 )

[sub_resource type="DynamicFont" id=2]
size = 32
use_filter = true
font_data = ExtResource( 3 )

[sub_resource type="DynamicFont" id=3]
size = 32
use_filter = true
font_data = ExtResource( 4 )

[sub_resource type="DynamicFont" id=4]
size = 32
use_filter = true
font_data = ExtResource( 5 )

[sub_resource type="DynamicFont" id=5]
size = 32
use_filter = true
font_data = ExtResource( 2 )

[resource]
LineEdit/fonts/font = SubResource( 6 )
RichTextLabel/colors/default_color = Color( 1, 1, 1, 1 )
RichTextLabel/colors/font_color_selected = Color( 0.49, 0.49, 0.49, 1 )
RichTextLabel/colors/font_color_shadow = Color( 0, 0, 0, 0 )
RichTextLabel/colors/selection_color = Color( 0.1, 0.1, 1, 0.8 )
RichTextLabel/constants/line_separation = 1
RichTextLabel/constants/shadow_as_outline = 0
RichTextLabel/constants/shadow_offset_x = 1
RichTextLabel/constants/shadow_offset_y = 1
RichTextLabel/constants/table_hseparation = 3
RichTextLabel/constants/table_vseparation = 3
RichTextLabel/fonts/bold_font = SubResource( 1 )
RichTextLabel/fonts/bold_italics_font = SubResource( 2 )
RichTextLabel/fonts/italics_font = SubResource( 3 )
RichTextLabel/fonts/mono_font = SubResource( 4 )
RichTextLabel/fonts/normal_font = SubResource( 5 )
RichTextLabel/styles/focus = null
RichTextLabel/styles/normal = null
7 changes: 7 additions & 0 deletions addons/raku-dialogue-ui/fonts/NamesFont.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]

[ext_resource path="res://addons/advanced-text/font/DejaVuSans-Bold.ttf" type="DynamicFontData" id=1]

[resource]
size = 40
font_data = ExtResource( 1 )
7 changes: 7 additions & 0 deletions addons/raku-dialogue-ui/plugin.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[plugin]

name="RakuDialogueUI"
description="Just Drag&Drop Rakugo Dailogue UI"
author="Jeremi Biernacki"
version="1.0"
script="plugin.gd"
11 changes: 11 additions & 0 deletions addons/raku-dialogue-ui/plugin.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
tool
extends EditorPlugin


func _enter_tree():
pass


func _exit_tree():
pass

134 changes: 134 additions & 0 deletions addons/raku-dialogue-ui/themes/flat_drak_theme.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
[gd_resource type="Theme" load_steps=22 format=2]

[ext_resource path="res://addons/advanced-text/font/DejaVuSans-Oblique.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://addons/advanced-text/font/DejaVuSans-Bold.ttf" type="DynamicFontData" id=2]
[ext_resource path="res://addons/advanced-text/font/DejaVuSans-BoldOblique.ttf" type="DynamicFontData" id=3]
[ext_resource path="res://addons/advanced-text/font/DejaVuSansMono.ttf" type="DynamicFontData" id=4]
[ext_resource path="res://addons/advanced-text/font/DejaVuSans.ttf" type="DynamicFontData" id=5]

[sub_resource type="StyleBoxFlat" id=7]
bg_color = Color( 0.72, 0.72, 0.72, 0.635294 )
corner_radius_top_left = 2
corner_radius_top_right = 2
corner_radius_bottom_right = 2
corner_radius_bottom_left = 2

[sub_resource type="StyleBoxFlat" id=8]
bg_color = Color( 0.321569, 0.580392, 0.890196, 0.494118 )
expand_margin_left = 2.0
expand_margin_right = 2.0
expand_margin_top = 2.0
expand_margin_bottom = 2.0

[sub_resource type="StyleBoxFlat" id=9]
bg_color = Color( 0.321569, 0.635294, 0.890196, 1 )
corner_radius_top_left = 2
corner_radius_top_right = 2
corner_radius_bottom_right = 2
corner_radius_bottom_left = 2

[sub_resource type="StyleBoxFlat" id=10]
bg_color = Color( 0.156863, 0.156863, 0.156863, 0.635294 )
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
border_color = Color( 0.321569, 0.580392, 0.890196, 1 )
border_blend = true
corner_radius_top_left = 2
corner_radius_top_right = 2
corner_radius_bottom_right = 2
corner_radius_bottom_left = 2

[sub_resource type="StyleBoxFlat" id=11]
bg_color = Color( 0.321569, 0.580392, 0.890196, 1 )
corner_radius_top_left = 2
corner_radius_top_right = 2
corner_radius_bottom_right = 2
corner_radius_bottom_left = 2

[sub_resource type="DynamicFont" id=6]
size = 32
use_filter = true
font_data = ExtResource( 5 )

[sub_resource type="StyleBoxFlat" id=12]
bg_color = Color( 0.156863, 0.156863, 0.156863, 0.635294 )
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
border_color = Color( 0.321569, 0.580392, 0.890196, 1 )

[sub_resource type="StyleBoxFlat" id=13]
bg_color = Color( 0.156863, 0.156863, 0.156863, 0.635294 )

[sub_resource type="StyleBoxFlat" id=14]
bg_color = Color( 0.156863, 0.156863, 0.156863, 0.635294 )

[sub_resource type="StyleBoxFlat" id=15]
bg_color = Color( 0.156863, 0.156863, 0.156863, 0.635294 )
border_width_top = 20
border_color = Color( 0.360784, 0.647059, 1, 1 )
expand_margin_top = 20.0

[sub_resource type="DynamicFont" id=1]
size = 32
use_filter = true
font_data = ExtResource( 2 )

[sub_resource type="DynamicFont" id=2]
size = 32
use_filter = true
font_data = ExtResource( 3 )

[sub_resource type="DynamicFont" id=3]
size = 32
use_filter = true
font_data = ExtResource( 1 )

[sub_resource type="DynamicFont" id=4]
size = 32
use_filter = true
font_data = ExtResource( 4 )

[sub_resource type="DynamicFont" id=5]
size = 32
use_filter = true
font_data = ExtResource( 5 )

[sub_resource type="StyleBoxFlat" id=16]
bg_color = Color( 0.156863, 0.156863, 0.156863, 0.635294 )
border_width_top = 20
border_color = Color( 0.360784, 0.647059, 1, 1 )
expand_margin_top = 20.0

[resource]
Button/styles/disabled = SubResource( 7 )
Button/styles/focus = SubResource( 8 )
Button/styles/hover = SubResource( 9 )
Button/styles/normal = SubResource( 10 )
Button/styles/pressed = SubResource( 11 )
LineEdit/fonts/font = SubResource( 6 )
LineEdit/styles/focus = SubResource( 12 )
LineEdit/styles/normal = SubResource( 13 )
Panel/styles/panel = SubResource( 14 )
PopupDialog/styles/panel = SubResource( 15 )
RichTextLabel/colors/default_color = Color( 1, 1, 1, 1 )
RichTextLabel/colors/font_color_selected = Color( 0.49, 0.49, 0.49, 1 )
RichTextLabel/colors/font_color_shadow = Color( 0, 0, 0, 0 )
RichTextLabel/colors/selection_color = Color( 0.1, 0.1, 1, 0.8 )
RichTextLabel/constants/line_separation = 1
RichTextLabel/constants/shadow_as_outline = 0
RichTextLabel/constants/shadow_offset_x = 1
RichTextLabel/constants/shadow_offset_y = 1
RichTextLabel/constants/table_hseparation = 3
RichTextLabel/constants/table_vseparation = 3
RichTextLabel/fonts/bold_font = SubResource( 1 )
RichTextLabel/fonts/bold_italics_font = SubResource( 2 )
RichTextLabel/fonts/italics_font = SubResource( 3 )
RichTextLabel/fonts/mono_font = SubResource( 4 )
RichTextLabel/fonts/normal_font = SubResource( 5 )
RichTextLabel/styles/focus = null
RichTextLabel/styles/normal = null
WindowDialog/styles/panel = SubResource( 16 )
29 changes: 29 additions & 0 deletions addons/raku-dialogue-ui/ui/DialogueUI/ChoiceButton.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://addons/advanced-text/nodes/AdvancedTextLabel.gd" type="Script" id=1]
[ext_resource path="res://addons/advanced-text/examples/AdvancedTextButton/AdvancedTextButton.gd" type="Script" id=2]

[node name="ChoiceButton" type="Button"]
margin_top = 125.0
margin_right = 500.0
margin_bottom = 175.0
rect_min_size = Vector2( 0, 50 )
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="AdvancedTextLabel" type="RichTextLabel" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 1
bbcode_enabled = true
bbcode_text = "[center]First Choice[/center]"
text = "First Choice"
scroll_active = false
script = ExtResource( 1 )
__meta__ = {
"_default_markup": "markdown",
"_edit_use_anchors_": false
}
markup_text = "[center]First Choice[/center]"
46 changes: 46 additions & 0 deletions addons/raku-dialogue-ui/ui/DialogueUI/DialogueContainer.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
extends VBoxContainer

onready var dialog_label := $DialogLabel
onready var answer_edit := $AnswerEdit

func _ready():
Rakugo.connect("say", self, "_on_say")
Rakugo.connect("ask", self, "_on_ask")
Rakugo.connect("step", self, "_on_step")
answer_edit.connect("text_entered", self, "_on_answer_entered")

func _on_say(character, text):
show()
# TODO: make line below work
# $DialogLabel.variables = Rakugo.variables
if character == null:
character = Rakugo.get_narrator()

text = "# " + character.name + "\n" + text
dialog_label.markup_text = text
# prints("dialog_label:", dialog_label.bbcode_text)

func _on_step():
dialog_label.markup_text += "\n@shake 5, 10 {Press 'Enter' to continue...}"
# hide()

func _on_ask(character:Character, question:String, default_answer:String):
_on_say(character, question)
answer_edit.show()
answer_edit.grab_focus()
answer_edit.placeholder_text = default_answer

func _on_ask_entered(answer):
answer_edit.hide()
answer_edit.placeholder_text = ""
answer_edit.text = ""
Rakugo.ask_return(answer)

func _process(delta):
var ui_accept := Input.is_action_just_pressed("ui_accept")
if Rakugo.is_waiting_step() and ui_accept:
Rakugo.do_step()




Loading