Initial Android commit

This commit is contained in:
OleSTEEP 2024-11-10 03:34:28 +03:00
commit 1e2b80c13d
8521 changed files with 231475 additions and 0 deletions

View file

@ -0,0 +1,16 @@
tool
extends Button
export (String) var EventName = ""
func get_drag_data(position):
var preview_label = Label.new()
if (self.text != ""):
preview_label.text = text
else :
preview_label.text = "Add Event %s" % [EventName]
set_drag_preview(preview_label)
return {"source":"EventButton", "event_name":EventName}

View file

@ -0,0 +1,119 @@
tool
extends Container
export var horizontal_margin:float = 5
export var vertical_margin:float = 5
var _reported_height_at_last_minimum_size_call:float = 0
func _init()->void :
size_flags_horizontal = SIZE_EXPAND_FILL
func _ready():
pass
func _get_minimum_size()->Vector2:
var max_child_width:float = 0
for child in get_children():
if not child.has_method("get_combined_minimum_size"):
break
var requested_size:Vector2 = child.get_combined_minimum_size()
if requested_size.x > max_child_width:
max_child_width = requested_size.x
var height: = _calculate_layout(false)
_reported_height_at_last_minimum_size_call = height
return Vector2(max_child_width, height)
func _notification(what):
if (what == NOTIFICATION_SORT_CHILDREN):
var height = _calculate_layout(true)
if height != _reported_height_at_last_minimum_size_call:
_make_parent_reevaluate_our_size()
func _calculate_layout(apply:bool)->float:
var child_position:Vector2 = Vector2(0, 0)
var row_height:float = 0
var container_width:float = rect_size.x
var num_children_in_current_row:float = 0
for child in get_children():
if not child.has_method("get_combined_minimum_size"):
continue
if not child.visible:
continue
var child_min_size:Vector2 = child.get_combined_minimum_size()
if num_children_in_current_row > 0:
child_position.x += horizontal_margin
if child_position.x + child_min_size.x > container_width:
child_position = Vector2(0, child_position.y + row_height + vertical_margin)
row_height = 0
num_children_in_current_row = 0
if apply:
fit_child_in_rect(child, Rect2(child_position, child_min_size))
if child_min_size.y > row_height:
row_height = child_min_size.y
child_position.x += child_min_size.x
num_children_in_current_row += 1
return child_position.y + row_height
func _make_parent_reevaluate_our_size():
rect_min_size = Vector2(0, 20000)
rect_min_size = Vector2(0, 0)

View file

@ -0,0 +1,61 @@
tool
extends Button
export (String) var visible_name = ""
export (String) var event_id = "dialogic_099"
export (Color) var event_color = Color("#48a2a2a2")
export (Texture) var event_icon = null setget set_icon
export (int) var event_category: = 0
export (int) var sorting_index: = 0
func _ready():
self_modulate = Color(1, 1, 1)
if visible_name != "":
text = visible_name
hint_tooltip = DTS.translate(hint_tooltip)
var _scale = DialogicUtil.get_editor_scale(self)
rect_min_size = Vector2(30, 30)
rect_min_size = rect_min_size * _scale
icon = null
var t_rect = $TextureRect
var c_border = $ColorBorder
c_border.self_modulate = event_color
c_border.rect_min_size.x = 5 * _scale
c_border.rect_size.x = 5 * _scale
t_rect.margin_left = 18 * _scale
if _scale == 2 or _scale == 1.75:
t_rect.rect_scale = Vector2(1, 1)
elif _scale == 1.5:
t_rect.rect_scale = Vector2(0.8, 0.8)
elif _scale == 0.75:
t_rect.rect_scale = Vector2(0.4, 0.4)
else :
t_rect.rect_scale = Vector2(0.6, 0.6)
add_color_override("font_color", get_color("font_color", "Editor"))
add_color_override("font_color_hover", get_color("accent_color", "Editor"))
t_rect.modulate = get_color("font_color", "Editor")
func set_icon(texture):
event_icon = texture
var _scale = DialogicUtil.get_editor_scale(self)
$TextureRect.texture = texture
func get_drag_data(position):
var preview_label = Label.new()
if (self.text != ""):
preview_label.text = text
else :
preview_label.text = "Add Event %s" % [hint_tooltip]
set_drag_preview(preview_label)
return {"source":"EventButton", "event_id":event_id}

View file

@ -0,0 +1,70 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://addons/dialogic/Editor/TimelineEditor/SmallEventButton.gd" type="Script" id=1]
[sub_resource type="StyleBoxEmpty" id=3]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 1, 1, 1, 1 )
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 1, 1, 1, 0 )
corner_radius_top_left = 4
corner_radius_bottom_left = 4
[sub_resource type="StyleBoxFlat" id=2]
draw_center = false
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 0.0980392, 0.0980392, 0.0980392, 0.784314 )
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
[node name="SmallEventButton" type="Button"]
margin_right = 40.0
margin_bottom = 40.0
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_colors/font_color_hover = Color( 0, 0, 0, 1 )
custom_styles/focus = SubResource( 3 )
flat = true
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ColorBorder" type="Panel" parent="."]
self_modulate = Color( 0.635294, 0.635294, 0.635294, 0.282353 )
show_behind_parent = true
anchor_bottom = 1.0
mouse_filter = 2
custom_styles/panel = SubResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Border" type="Panel" parent="."]
show_behind_parent = true
anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 2
custom_styles/panel = SubResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TextureRect" type="TextureRect" parent="."]
modulate = Color( 0, 0, 0, 1 )
anchor_top = 0.5
anchor_bottom = 0.5
margin_left = 18.0
rect_scale = Vector2( 0.6, 0.6 )
size_flags_horizontal = 0
size_flags_vertical = 0
expand = true
stretch_mode = 4

View file

@ -0,0 +1,209 @@
tool
extends ScrollContainer
var _is_drag_receiving = false
var _last_event_button_drop_attempt = ""
var _mouse_exited = false
onready var timeline_editor = get_parent()
func _ready():
connect("mouse_entered", self, "_on_mouse_entered")
connect("mouse_exited", self, "_on_mouse_exited")
connect("gui_input", self, "_on_gui_input")
func can_drop_data(position, data):
if data != null and data is Dictionary and data.has("source"):
if data["source"] == "EventButton":
if _last_event_button_drop_attempt.empty():
timeline_editor.create_drag_and_drop_event(data["event_id"])
_is_drag_receiving = true
_last_event_button_drop_attempt = data["event_id"]
return true
return false
func cancel_drop():
_is_drag_receiving = false
_last_event_button_drop_attempt = ""
timeline_editor.cancel_drop_event()
func drop_data(position, data):
if (data["source"] == "EventButton"):
timeline_editor.drop_event()
_is_drag_receiving = false
_last_event_button_drop_attempt = ""
func _on_mouse_exited():
if _is_drag_receiving and not _mouse_exited:
var preview_label = Label.new()
preview_label.text = "Cancel"
set_drag_preview(preview_label)
_mouse_exited = true
func _on_mouse_entered():
if _is_drag_receiving and _mouse_exited:
var preview_label = Label.new()
preview_label.text = "Insert Event"
set_drag_preview(preview_label)
_mouse_exited = false
func _input(event):
if (event is InputEventMouseButton and is_visible_in_tree() and event.button_index == BUTTON_LEFT):
if (_mouse_exited and _is_drag_receiving):
cancel_drop()
func _on_gui_input(event):
if (event is InputEventMouseButton and event.button_index == BUTTON_LEFT):
if (_is_drag_receiving):
if (_last_event_button_drop_attempt != ""):
drop_data(Vector2.ZERO, {"source":"EventButton", "event_id":_last_event_button_drop_attempt})
_is_drag_receiving = false
func rendering_scale_correction(s, vector:Vector2)->Vector2:
if s == 1.25:
return vector - Vector2(3, 2)
if s == 1.5:
return vector - Vector2(6, 6)
if s == 1.75:
return vector - Vector2(6, 7)
if s == 2:
return vector - Vector2(13, 8)
return vector
func _draw():
var timeline_children = $TimeLine.get_children()
var timeline_lenght = timeline_children.size()
var line_color = Color("#4D4D4D")
var test_color = Color(1, 0, 0, 0.5)
var _scale = DialogicUtil.get_editor_scale(self)
var line_width = 3 * _scale
var pos = Vector2(32 * _scale, 51 * _scale)
pos = rendering_scale_correction(_scale, pos)
for event in $TimeLine.get_children():
if not "event_data" in event:
continue
if timeline_children[timeline_lenght - 1] == event:
return
if event.event_name == "Question" or event.event_name == "Condition":
var keep_going = true
var end_reference
for e in timeline_children:
if keep_going:
if e.get_index() > event.get_index():
if e.current_indent_level == event.current_indent_level:
if e.event_name == "End Branch":
end_reference = e
keep_going = false
if e.event_name == "Question" or event.event_name == "Condition":
keep_going = false
if keep_going == false:
if end_reference:
var line_size = 0
if event.current_indent_level > 0:
line_size = (event.indent_size * event.current_indent_level) + (4 * _scale)
draw_rect(Rect2(
Vector2(pos.x + line_size - scroll_horizontal, pos.y - scroll_vertical) + event.rect_position,
Vector2(line_width,
(end_reference.rect_global_position.y - event.rect_global_position.y) - (43 * _scale))
),
line_color, true)
var next_event = timeline_children[event.get_index() + 1]
if event.current_indent_level > 0:
var line_size = (event.indent_size * event.current_indent_level) + (4 * _scale)
if next_event.event_name != "End Branch" and event.event_name != "Choice":
if event.event_name != "Question" and next_event.event_name == "Choice":
pass
else :
draw_rect(Rect2(
Vector2(pos.x + line_size - scroll_horizontal, pos.y - scroll_vertical) + event.rect_position,
Vector2(line_width, event.rect_size.y - (40 * _scale))
),
line_color,
true)
else :
draw_rect(Rect2(
Vector2(pos.x - scroll_horizontal, pos.y - scroll_vertical) + event.rect_position,
Vector2(line_width, event.rect_size.y - (40 * _scale))
),
line_color,
true)
if event.event_name == "Choice":
var arc_start = Vector2(
(event.indent_size * (event.current_indent_level)) + (16.2 * _scale),
5
)
var arc_point_count = 12 * _scale
var arc_radius = 24 * _scale
var start_angle = 90
var end_angle = 185
if event.current_indent_level == 1:
arc_start.x = (event.indent_size * (event.current_indent_level)) + (12.5 * _scale)
arc_start = rendering_scale_correction(_scale, arc_start)
draw_arc(
Vector2(arc_start.x - scroll_horizontal, arc_start.y - scroll_vertical) + event.rect_position,
arc_radius,
deg2rad(start_angle),
deg2rad(end_angle),
arc_point_count,
line_color,
line_width - (1 * _scale),
true
)
if next_event.event_name == "Choice" or next_event.event_name == "End Branch":
continue
arc_start.x = (event.indent_size * (event.current_indent_level + 1)) + (16 * _scale)
arc_start.y = (pos.y + (8 * _scale))
arc_start = rendering_scale_correction(_scale, arc_start)
draw_arc(
Vector2(arc_start.x - scroll_horizontal, arc_start.y - scroll_vertical) + event.rect_position,
arc_radius,
deg2rad(start_angle),
deg2rad(end_angle),
arc_point_count,
line_color,
line_width - (1 * _scale),
true
)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,282 @@
[gd_scene load_steps=10 format=2]
[ext_resource path="res://addons/dialogic/Images/Tutorials/arrow-down.svg" type="Texture" id=13]
[ext_resource path="res://addons/dialogic/Editor/TimelineEditor/TimelineEditor.gd" type="Script" id=17]
[ext_resource path="res://addons/dialogic/Editor/Common/TLabel.tscn" type="PackedScene" id=21]
[ext_resource path="res://addons/dialogic/Editor/TimelineEditor/TimelineArea.gd" type="Script" id=22]
[ext_resource path="res://addons/dialogic/Editor/Theme/MainTheme.tres" type="Theme" id=28]
[ext_resource path="res://addons/dialogic/Editor/TimelineEditor/FlexContainer.gd" type="Script" id=29]
[sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 5.0
content_margin_right = 5.0
content_margin_top = 5.0
content_margin_bottom = 5.0
bg_color = Color( 0, 0, 0, 1 )
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 0.0980392, 0.113725, 0.152941, 1 )
[sub_resource type="StyleBoxFlat" id=2]
draw_center = false
border_width_left = 2
border_color = Color( 0.8, 0.8, 0.8, 0 )
[sub_resource type="StyleBoxFlat" id=3]
content_margin_right = 6.0
content_margin_top = 10.0
content_margin_bottom = 10.0
bg_color = Color( 0.94902, 1, 0.482353, 1 )
corner_radius_top_left = 5
corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
[node name="TimelineEditor" type="HSplitContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_bottom = 138.0
size_flags_horizontal = 3
size_flags_vertical = 3
theme = ExtResource( 28 )
split_offset = 7
script = ExtResource( 17 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TimelineArea" type="ScrollContainer" parent="."]
margin_right = 832.0
margin_bottom = 738.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_styles/bg = SubResource( 1 )
script = ExtResource( 22 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TimeLine" type="VBoxContainer" parent="TimelineArea"]
margin_left = 5.0
margin_top = 5.0
margin_right = 827.0
margin_bottom = 733.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="ScrollContainer" type="ScrollContainer" parent="."]
margin_left = 844.0
margin_right = 1024.0
margin_bottom = 738.0
rect_min_size = Vector2( 180, 0 )
custom_styles/bg = SubResource( 2 )
[node name="EventContainer" type="VBoxContainer" parent="ScrollContainer"]
margin_left = 2.0
margin_right = 186.0
margin_bottom = 939.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 9
__meta__ = {
"_edit_use_anchors_": false
}
[node name="EventsWarning" type="PanelContainer" parent="ScrollContainer/EventContainer"]
margin_right = 184.0
margin_bottom = 68.0
custom_styles/panel = SubResource( 3 )
[node name="HBoxContainer" type="HBoxContainer" parent="ScrollContainer/EventContainer/EventsWarning"]
margin_top = 10.0
margin_right = 178.0
margin_bottom = 58.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TextureRect" type="TextureRect" parent="ScrollContainer/EventContainer/EventsWarning/HBoxContainer"]
margin_right = 40.0
margin_bottom = 48.0
rect_min_size = Vector2( 40, 40 )
texture = ExtResource( 13 )
stretch_mode = 4
[node name="Label" type="Label" parent="ScrollContainer/EventContainer/EventsWarning/HBoxContainer"]
margin_left = 44.0
margin_right = 178.0
margin_bottom = 48.0
rect_min_size = Vector2( 100, 0 )
size_flags_horizontal = 3
size_flags_vertical = 1
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "Add an event to start building your timeline"
autowrap = true
[node name="HBoxContainer6" type="HBoxContainer" parent="ScrollContainer/EventContainer"]
margin_top = 77.0
margin_right = 184.0
margin_bottom = 91.0
[node name="TLabel" parent="ScrollContainer/EventContainer/HBoxContainer6" instance=ExtResource( 21 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 77.0
margin_bottom = 14.0
text = "Main Events"
text_key = "Main Events"
[node name="HSeparator2" type="HSeparator" parent="ScrollContainer/EventContainer/HBoxContainer6"]
margin_left = 81.0
margin_right = 184.0
margin_bottom = 14.0
size_flags_horizontal = 3
[node name="FlexContainer1" type="Container" parent="ScrollContainer/EventContainer"]
margin_top = 100.0
margin_right = 184.0
margin_bottom = 145.0
size_flags_horizontal = 3
script = ExtResource( 29 )
[node name="HBoxContainer5" type="HBoxContainer" parent="ScrollContainer/EventContainer"]
margin_top = 154.0
margin_right = 184.0
margin_bottom = 168.0
[node name="TLabel2" parent="ScrollContainer/EventContainer/HBoxContainer5" instance=ExtResource( 21 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 33.0
margin_bottom = 14.0
text = "Logic"
text_key = "Logic"
[node name="HSeparator2" type="HSeparator" parent="ScrollContainer/EventContainer/HBoxContainer5"]
margin_left = 37.0
margin_right = 184.0
margin_bottom = 14.0
size_flags_horizontal = 3
[node name="FlexContainer2" type="Container" parent="ScrollContainer/EventContainer"]
margin_top = 177.0
margin_right = 184.0
margin_bottom = 272.0
size_flags_horizontal = 3
script = ExtResource( 29 )
[node name="HBoxContainer3" type="HBoxContainer" parent="ScrollContainer/EventContainer"]
margin_top = 281.0
margin_right = 184.0
margin_bottom = 295.0
[node name="TLabel3" parent="ScrollContainer/EventContainer/HBoxContainer3" instance=ExtResource( 21 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 56.0
margin_bottom = 14.0
text = "Timeline"
text_key = "Timeline"
[node name="HSeparator2" type="HSeparator" parent="ScrollContainer/EventContainer/HBoxContainer3"]
margin_left = 60.0
margin_right = 184.0
margin_bottom = 14.0
size_flags_horizontal = 3
[node name="FlexContainer3" type="Container" parent="ScrollContainer/EventContainer"]
margin_top = 304.0
margin_right = 184.0
margin_bottom = 449.0
size_flags_horizontal = 3
script = ExtResource( 29 )
[node name="HBoxContainer4" type="HBoxContainer" parent="ScrollContainer/EventContainer"]
margin_top = 458.0
margin_right = 184.0
margin_bottom = 472.0
[node name="TLabel4" parent="ScrollContainer/EventContainer/HBoxContainer4" instance=ExtResource( 21 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 37.0
margin_bottom = 14.0
text = "Audio"
text_key = "Audio"
[node name="HSeparator2" type="HSeparator" parent="ScrollContainer/EventContainer/HBoxContainer4"]
margin_left = 41.0
margin_right = 184.0
margin_bottom = 14.0
size_flags_horizontal = 3
[node name="FlexContainer4" type="Container" parent="ScrollContainer/EventContainer"]
margin_top = 481.0
margin_right = 184.0
margin_bottom = 576.0
size_flags_horizontal = 3
script = ExtResource( 29 )
[node name="HBoxContainer" type="HBoxContainer" parent="ScrollContainer/EventContainer"]
margin_top = 585.0
margin_right = 184.0
margin_bottom = 599.0
[node name="TLabel5" parent="ScrollContainer/EventContainer/HBoxContainer" instance=ExtResource( 21 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 39.0
margin_bottom = 14.0
text = "Godot"
text_key = "Godot"
[node name="HSeparator2" type="HSeparator" parent="ScrollContainer/EventContainer/HBoxContainer"]
margin_left = 43.0
margin_right = 184.0
margin_bottom = 14.0
size_flags_horizontal = 3
[node name="FlexContainer5" type="Container" parent="ScrollContainer/EventContainer"]
margin_top = 608.0
margin_right = 184.0
margin_bottom = 678.0
size_flags_horizontal = 3
script = ExtResource( 29 )
[node name="CustomEventsHeadline" type="HBoxContainer" parent="ScrollContainer/EventContainer"]
margin_top = 687.0
margin_right = 184.0
margin_bottom = 701.0
[node name="TLabel6" parent="ScrollContainer/EventContainer/CustomEventsHeadline" instance=ExtResource( 21 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 95.0
margin_bottom = 14.0
text = "Custom Events"
text_key = "Custom Events"
[node name="HSeparator2" type="HSeparator" parent="ScrollContainer/EventContainer/CustomEventsHeadline"]
margin_left = 99.0
margin_right = 184.0
margin_bottom = 14.0
size_flags_horizontal = 3
[node name="CustomEventsContainer" type="Container" parent="ScrollContainer/EventContainer"]
margin_top = 710.0
margin_right = 184.0
margin_bottom = 830.0
size_flags_horizontal = 3
script = ExtResource( 29 )
[node name="Spacer" type="Control" parent="ScrollContainer/EventContainer"]
margin_top = 839.0
margin_right = 184.0
margin_bottom = 939.0
rect_min_size = Vector2( 0, 100 )

View file

@ -0,0 +1,13 @@
extends Node
func _ready():
var dialog = Dialogic.start(DialogicResources.get_settings_value("QuickTimelineTest", "timeline_file", ""))
dialog.connect("dialogic_signal", self, "_on_DialogNode_dialogic_signal")
dialog.connect("timeline_end", self, "_on_DialogNode_timeline_end")
add_child(dialog)
func _on_DialogNode_dialogic_signal(argument):
print("Signal recieved. Argument: ", argument)
func _on_DialogNode_timeline_end(timeline):
get_tree().quit()

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/dialogic/Editor/TimelineEditor/TimelineTestingScene.gd" type="Script" id=1]
[node name="TimelineTestingScene" type="Node"]
script = ExtResource( 1 )