Add dialogic
This commit is contained in:
1 parent
89d4d3a29c
commit
2c47b309ae
603 files changed
+34501
No files matched your search
@@ -0,0 +1,117 @@
|
||||
tool
|
||||
extends "res://addons/dialogic/Editor/Events/Parts/EventPart.gd"
|
||||
|
||||
# has an event_data variable that stores the current data!!!
|
||||
export(String, "Audio", "Background", "Scene", "Resource") var Mode = "Background"
|
||||
|
||||
## node references
|
||||
onready var file_button = $FileButton
|
||||
onready var clear_button = $ClearButton
|
||||
|
||||
# until we change the background color of the pickers, the color should ignore the theme
|
||||
var default_color = Color('ccced3')
|
||||
|
||||
# used to connect the signals
|
||||
func _ready():
|
||||
editor_reference = find_parent("EditorView")
|
||||
file_button.connect("pressed", self, "_on_FileButton_pressed")
|
||||
clear_button.connect('pressed', self, "_on_ClearButton_pressed")
|
||||
file_button.add_color_override("font_color", default_color) #get_color("mono_color", "Editor"))
|
||||
clear_button.icon = get_icon("Reload", "EditorIcons")
|
||||
$FileButton/icon2.texture = get_icon("GuiSliderGrabber", "EditorIcons")
|
||||
match Mode:
|
||||
"Audio":
|
||||
$Label.text = "Play"
|
||||
$FileButton/icon.texture = get_icon("AudioStreamPlayer", "EditorIcons")
|
||||
"Background":
|
||||
$Label.text = "to"
|
||||
$FileButton/icon.texture = get_icon("Image", "EditorIcons")
|
||||
"Scene":
|
||||
$Label.text = "to"
|
||||
$FileButton/icon.texture = get_icon("PackedScene", "EditorIcons")
|
||||
"Resource":
|
||||
$Label.text = "to"
|
||||
$FileButton/icon.texture = get_icon("PackedScene", "EditorIcons")
|
||||
|
||||
|
||||
# called by the parent event part
|
||||
func load_data(event_data:Dictionary):
|
||||
|
||||
# first update the event_data
|
||||
.load_data(event_data)
|
||||
|
||||
# then the ui
|
||||
var path
|
||||
file_button.text = ""
|
||||
match Mode:
|
||||
"Audio":
|
||||
path = event_data['file']
|
||||
if path.empty():
|
||||
file_button.text = 'nothing (will stop previous)'
|
||||
"Background":
|
||||
path = event_data['background']
|
||||
if path.empty():
|
||||
file_button.text = 'nothing (will hide previous)'
|
||||
"Scene":
|
||||
path = event_data['change_scene']
|
||||
if path.empty():
|
||||
file_button.text = 'a yet to be selected scene'
|
||||
"Resource":
|
||||
path = event_data['resource_file']
|
||||
if path.empty():
|
||||
file_button.text = 'a yet to be selected resource'
|
||||
if file_button.text.empty():
|
||||
file_button.text = path.get_file()
|
||||
file_button.hint_tooltip = path
|
||||
|
||||
clear_button.visible = !path.empty()
|
||||
|
||||
func _on_FileButton_pressed():
|
||||
match Mode:
|
||||
"Audio":
|
||||
editor_reference.godot_dialog("*.wav, *.ogg, *.mp3")
|
||||
"Background":
|
||||
editor_reference.godot_dialog("*.png, *.jpg, *.jpeg, *.tga, *.svg, *.svgz, *.bmp, *.webp, *.tscn")
|
||||
"Scene":
|
||||
editor_reference.godot_dialog("*.tscn")
|
||||
"Resource":
|
||||
editor_reference.godot_dialog("*.tres, *.res")
|
||||
|
||||
editor_reference.godot_dialog_connect(self, "_on_file_selected")
|
||||
|
||||
func _on_file_selected(path, target):
|
||||
match Mode:
|
||||
"Audio":
|
||||
event_data['file'] = path
|
||||
"Background":
|
||||
event_data['background'] = path
|
||||
"Scene":
|
||||
event_data['change_scene'] = path
|
||||
"Resource":
|
||||
event_data['resource_file'] = path
|
||||
|
||||
clear_button.visible = true
|
||||
file_button.text = path.get_file()
|
||||
file_button.hint_tooltip = path
|
||||
|
||||
# informs the parent about the changes!
|
||||
data_changed()
|
||||
|
||||
func _on_ClearButton_pressed():
|
||||
match Mode:
|
||||
"Audio":
|
||||
event_data['file'] = ""
|
||||
file_button.text = 'nothing (will stop previous)'
|
||||
"Background":
|
||||
event_data['background'] = ""
|
||||
file_button.text = 'nothing (will hide previous)'
|
||||
"Scene":
|
||||
event_data['change_scene'] = ""
|
||||
file_button.text = 'a yet to be selected scene'
|
||||
"Resource":
|
||||
event_data['resource_file'] = ""
|
||||
file_button.text = 'a yet to be selected resource'
|
||||
clear_button.visible = false
|
||||
|
||||
# informs the parent about the changes!
|
||||
data_changed()
|
||||
@@ -0,0 +1,87 @@
|
||||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource path="res://addons/dialogic/Editor/Events/styles/SimpleButtonHover.tres" type="StyleBox" id=1]
|
||||
[ext_resource path="res://addons/dialogic/Editor/Events/styles/SettingsFieldBackground.tres" type="StyleBox" id=2]
|
||||
[ext_resource path="res://addons/dialogic/Editor/Events/Parts/ResourcePickers/Files/EventPart_FilePicker.gd" type="Script" id=3]
|
||||
[ext_resource path="res://addons/dialogic/Editor/Events/Parts/Text/GreyLabel.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://addons/dialogic/Editor/Events/styles/SimpleButtonNormal.tres" type="StyleBox" id=7]
|
||||
|
||||
[sub_resource type="Image" id=3]
|
||||
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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4
|
||||
flags = 4
|
||||
image = SubResource( 3 )
|
||||
size = Vector2( 16, 16 )
|
||||
|
||||
[node name="FilePicker" type="HBoxContainer"]
|
||||
margin_top = 1.0
|
||||
margin_right = 331.0
|
||||
margin_bottom = 23.0
|
||||
size_flags_vertical = 4
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label" parent="." instance=ExtResource( 4 )]
|
||||
margin_top = 5.0
|
||||
margin_right = 13.0
|
||||
margin_bottom = 19.0
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
text = "to"
|
||||
|
||||
[node name="FileButton" type="Button" parent="."]
|
||||
margin_left = 17.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 24.0
|
||||
custom_styles/hover = ExtResource( 2 )
|
||||
custom_styles/pressed = ExtResource( 2 )
|
||||
custom_styles/focus = ExtResource( 2 )
|
||||
custom_styles/normal = ExtResource( 2 )
|
||||
text = "none so far"
|
||||
|
||||
[node name="icon" type="TextureRect" parent="FileButton"]
|
||||
margin_left = 4.0
|
||||
margin_top = 5.0
|
||||
margin_right = 23.0
|
||||
margin_bottom = 24.0
|
||||
texture = SubResource( 2 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="icon2" type="TextureRect" parent="FileButton"]
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -20.9581
|
||||
margin_top = -6.63555
|
||||
margin_right = -5.95807
|
||||
margin_bottom = 8.36445
|
||||
texture = SubResource( 2 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ClearButton" type="Button" parent="."]
|
||||
margin_left = 147.0
|
||||
margin_right = 169.0
|
||||
margin_bottom = 24.0
|
||||
rect_min_size = Vector2( 22, 22 )
|
||||
custom_styles/hover = ExtResource( 1 )
|
||||
custom_styles/pressed = ExtResource( 1 )
|
||||
custom_styles/normal = ExtResource( 7 )
|
||||
icon = SubResource( 2 )
|
||||
Reference in new issue
Block a user