Improve array recent menu

This commit is contained in:
don-tnowe 2022-09-24 00:47:42 +03:00
parent 31a14f4aaf
commit fdbdca1101
5 changed files with 25 additions and 7 deletions

View File

@ -9,8 +9,9 @@ func set_value(node : Control, value):
if value is bool:
_set_value_internal(node, value)
else:
_set_value_internal(node, !node.text.begins_with("O"))
# Does not work properly with new text input system
# else:
# _set_value_internal(node, !node.text.begins_with("O"))
func _set_value_internal(node, value):

View File

@ -71,6 +71,7 @@ func _add_recent(value):
var node := Button.new()
node.text = str(value)
node.self_modulate = Color(value.hash()) + Color(0.25, 0.25, 0.25, 1.0)
node.connect("pressed", self, "_on_recent_clicked", [node, value])
recent_container.add_child(node)
@ -113,3 +114,9 @@ func _on_String_pressed():
func _on_Variant_pressed():
_add_value(str2var(value_input.text))
func _on_AddRecentFromSel_pressed():
for x in sheet.get_edited_cells_values():
for y in x:
_add_recent(y)

View File

@ -187,21 +187,31 @@ margin_bottom = 52.0
size_flags_horizontal = 3
[node name="Label" type="Label" parent="HBoxContainer/Control2/HBoxContainer/HFlowContainer"]
margin_top = 3.0
margin_top = 4.0
margin_right = 48.0
margin_bottom = 17.0
margin_bottom = 18.0
text = "Recent:"
[node name="OptionButton" type="OptionButton" parent="HBoxContainer/Control2/HBoxContainer/HFlowContainer"]
margin_left = 52.0
margin_right = 106.0
margin_bottom = 20.0
margin_bottom = 22.0
text = "Add"
items = [ "Add", null, false, 0, null, "Erase", null, false, 1, null, "Delete From Recent", null, false, 2, null ]
selected = 0
[node name="AddRecentFromSel" type="Button" parent="HBoxContainer/Control2/HBoxContainer/HFlowContainer"]
margin_left = 110.0
margin_right = 138.0
margin_bottom = 22.0
hint_tooltip = "Copy Selection into this List"
icon = SubResource( 2 )
script = ExtResource( 2 )
icon_name = "ListSelect"
[connection signal="pressed" from="HBoxContainer/HBoxContainer/Control/VBoxContainer/HBoxContainer/String" to="." method="_on_String_pressed"]
[connection signal="pressed" from="HBoxContainer/HBoxContainer/Control/VBoxContainer/HBoxContainer/Int" to="." method="_on_Int_pressed"]
[connection signal="pressed" from="HBoxContainer/HBoxContainer/Control/VBoxContainer/HBoxContainer/Float" to="." method="_on_Float_pressed"]
[connection signal="pressed" from="HBoxContainer/HBoxContainer/Control/VBoxContainer/HBoxContainer/Variant" to="." method="_on_Variant_pressed"]
[connection signal="pressed" from="HBoxContainer/HBoxContainer/Control/VBoxContainer/HBoxContainer/Remove" to="." method="_on_Remove_pressed"]
[connection signal="pressed" from="HBoxContainer/Control2/HBoxContainer/HFlowContainer/AddRecentFromSel" to="." method="_on_AddRecentFromSel_pressed"]

View File

@ -9,7 +9,7 @@ resource_name = "Weapon: Chaos Blast"
script = ExtResource( 1 )
color1 = Color( 1, 1, 0.2, 1 )
max_duplicates = 1
tags = [ "weapon", "magic", "projectile" ]
tags = [ "weapon", "magic", "projectile", "legendary" ]
icon = ExtResource( 2 )
custom_scene = ExtResource( 3 )
color2 = Color( 0.40631, 0.190945, 0.832031, 1 )

View File

@ -9,7 +9,7 @@ resource_name = "Weapon: Giga Sword"
script = ExtResource( 1 )
color1 = Color( 1, 1, 0.2, 1 )
max_duplicates = 1
tags = [ "weapon", "strength", "melee" ]
tags = [ "weapon", "strength", "melee", "legendary" ]
icon = ExtResource( 2 )
custom_scene = ExtResource( 3 )
color2 = Color( 0.988235, 0.93848, 0.192157, 1 )