-
-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
You can now decide to use a custom slot. This can also be a variable.
- Loading branch information
1 parent
c41ecf6
commit 1a709de
Showing
4 changed files
with
104 additions
and
8 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
addons/dialogic/Editor/Events/Parts/Logic/EventPart_Save.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
tool | ||
extends "res://addons/dialogic/Editor/Events/Parts/EventPart.gd" | ||
|
||
# has an event_data variable that stores the current data!!! | ||
|
||
## node references | ||
onready var default_slot = $DefaultSlot | ||
onready var custom_slot = $CustomSlot | ||
|
||
# used to connect the signals | ||
func _ready(): | ||
default_slot.connect("toggled", self, "_on_DefaultSlot_toggled") | ||
custom_slot.connect("text_changed", self, '_on_CustomSlot_text_changed') | ||
|
||
|
||
# called by the event block | ||
func load_data(data:Dictionary): | ||
# First set the event_data | ||
.load_data(data) | ||
|
||
# Now update the ui nodes to display the data. | ||
default_slot.pressed = event_data.get('use_default_slot', true) | ||
custom_slot.text = event_data.get('custom_slot', '') | ||
|
||
custom_slot.visible = not default_slot.pressed | ||
$Label.visible = not default_slot.pressed | ||
|
||
|
||
func _on_DefaultSlot_toggled(pressed): | ||
event_data['use_default_slot'] = pressed | ||
|
||
custom_slot.visible = not pressed | ||
$Label.visible = not pressed | ||
|
||
# informs the parent about the changes! | ||
data_changed() | ||
|
||
func _on_CustomSlot_text_changed(text): | ||
event_data['custom_slot'] = text | ||
|
||
# informs the parent about the changes! | ||
data_changed() |
36 changes: 36 additions & 0 deletions
36
addons/dialogic/Editor/Events/Parts/Logic/EventPart_Save.tscn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[gd_scene load_steps=3 format=2] | ||
|
||
[ext_resource path="res://addons/dialogic/Editor/Events/Parts/Text/CustomLineEdit.tscn" type="PackedScene" id=1] | ||
[ext_resource path="res://addons/dialogic/Editor/Events/Parts/Logic/EventPart_Save.gd" type="Script" id=2] | ||
|
||
[node name="EventPart_Save" type="HBoxContainer"] | ||
margin_right = 40.0 | ||
margin_bottom = 40.0 | ||
custom_constants/separation = 9 | ||
script = ExtResource( 2 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="DefaultSlot" type="CheckBox" parent="."] | ||
margin_right = 129.0 | ||
margin_bottom = 40.0 | ||
pressed = true | ||
text = "Use default slot" | ||
|
||
[node name="Label" type="Label" parent="."] | ||
margin_left = 138.0 | ||
margin_top = 13.0 | ||
margin_right = 219.0 | ||
margin_bottom = 27.0 | ||
text = "Custom slot:" | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="CustomSlot" parent="." instance=ExtResource( 1 )] | ||
margin_left = 228.0 | ||
margin_top = 6.0 | ||
margin_right = 276.0 | ||
margin_bottom = 33.0 | ||
hint_tooltip = "Also allows for value definitions like this: [my_value_name]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters