Доработка. Деактивация показа функциональной схемы при смене режима. Снятие выделения с прибора при нажатии на пустое место в окне.

This commit is contained in:
lepshiy
2025-11-24 15:30:18 +03:00
parent fe10598005
commit 4d59833026

View File

@@ -62,6 +62,7 @@ func on_serv_changed(u, pribor_node, _pribor_meta): pribor_node.state = int(u.se
func on_mode_changed():
clean_pribor_items()
reset_pribor_buttons()
$chk_show_functional.disabled = true
func reset_pribor_buttons():
@@ -165,6 +166,20 @@ func on_update_uf_serviceability(uf_serviceaability: bool, uf_pribor: Node)-> vo
func _on_chk_show_functional_toggled(toggled_on: bool) -> void:
if cur_pribor_node:
cur_pribor_node.show_functional = toggled_on
func _on_gui_input(event: InputEvent) -> void:
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
if cur_pribor_node:
cur_pribor_node.show_functional = false
var pribor_buttons := get_tree().get_nodes_in_group('pribor_buttons')
for node in pribor_buttons:
node.button_pressed = false
clean_pribor_items()
cur_pribor_node = null
$chk_show_functional.button_pressed = false
$chk_show_functional.disabled = true
$lbl_header.text = \"\"
"
[sub_resource type="SpriteFrames" id="SpriteFrames_foasq"]
@@ -437,6 +452,14 @@ offset_bottom = 830.0
scale = Vector2(0.97094, 0.97094)
texture = ExtResource("9_qe1go")
[node name="connect_pribor2" type="AnimatedSprite2D" parent="pribor_prd_n_1"]
light_mask = 3
position = Vector2(35, -10)
scale = Vector2(0.625, 0.625)
sprite_frames = SubResource("SpriteFrames_foasq")
frame_progress = 0.72355
script = ExtResource("11_u7tym")
[node name="pribor_uf" type="TextureButton" parent="." groups=["pribor_buttons"]]
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
@@ -457,7 +480,6 @@ metadata/unit_name = ["уарэп-эмс"]
metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_uf"]
self_modulate = Color(0, 1, 0, 1)
layout_mode = 0
offset_left = 15.0
offset_top = -34.0
@@ -546,16 +568,6 @@ patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
[node name="label2" type="Label" parent="pribor_rtr"]
layout_mode = 0
offset_left = 12.0
offset_top = -54.0
offset_right = 95.0
offset_bottom = -35.0
text = "РТР"
horizontal_alignment = 1
vertical_alignment = 1
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_rtr"]
light_mask = 3
position = Vector2(55, -15)
@@ -623,17 +635,6 @@ patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
[node name="label2" type="Label" parent="pribor_afsp_1"]
layout_mode = 0
offset_left = 165.0
offset_top = -245.0
offset_right = 262.0
offset_bottom = -225.0
scale = Vector2(5, 5)
text = "АФСП 1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_afsp_1"]
light_mask = 3
position = Vector2(415, -40)
@@ -702,17 +703,6 @@ patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
[node name="label2" type="Label" parent="pribor_afsp_2"]
layout_mode = 0
offset_left = 200.0
offset_top = -240.0
offset_right = 297.0
offset_bottom = -220.0
scale = Vector2(5, 5)
text = "АФСП 2"
horizontal_alignment = 1
vertical_alignment = 1
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_afsp_2"]
light_mask = 3
position = Vector2(425, -40)
@@ -927,6 +917,14 @@ offset_bottom = 676.0
scale = Vector2(0.96888, 0.96888)
texture = ExtResource("9_qe1go")
[node name="connect_pribor2" type="AnimatedSprite2D" parent="pribor_prd_n_2"]
light_mask = 3
position = Vector2(35, -10)
scale = Vector2(0.625, 0.625)
sprite_frames = SubResource("SpriteFrames_foasq")
frame_progress = 0.72355
script = ExtResource("11_u7tym")
[node name="pribor_prd_k_2" type="TextureButton" parent="." groups=["pribor_buttons"]]
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
@@ -1632,6 +1630,7 @@ disabled = true
text = "Показть функциональную схему Э2"
flat = true
[connection signal="gui_input" from="." to="." method="_on_gui_input"]
[connection signal="toggled" from="pribor_prd_n_1" to="pribor_prd_n_1" method="_on_toggled"]
[connection signal="toggled" from="pribor_uf" to="pribor_uf" method="_on_toggled"]
[connection signal="toggled" from="pribor_rtr" to="pribor_rtr" method="_on_toggled"]