Доработка контроля - выделение и выбор прибора по стрелкам

This commit is contained in:
kira-a-k
2025-11-08 16:54:29 +03:00
parent 9daae7b6b9
commit f3ee8965c0
3 changed files with 91 additions and 63 deletions

View File

@@ -47,15 +47,15 @@ theme_override_styles/tab_focus = SubResource("StyleBoxEmpty_41d34")
theme_override_styles/tab_disabled = SubResource("StyleBoxEmpty_cw2ss")
theme_override_styles/tabbar_background = SubResource("StyleBoxEmpty_nmdfd")
theme_override_styles/panel = SubResource("StyleBoxEmpty_vap7n")
current_tab = 0
current_tab = 1
script = ExtResource("1_fg0vd")
[node name="Работа" parent="tab_switch" instance=ExtResource("2_u7p16")]
visible = false
layout_mode = 2
metadata/_tab_index = 0
[node name="Контроль" parent="tab_switch" instance=ExtResource("3_txp0s")]
visible = false
layout_mode = 2
metadata/_tab_index = 1

View File

@@ -1,16 +1,44 @@
@tool
extends TextureButton
@export var state_colors: Array
func _on_toggled(toggled_on): $frame.visible = toggled_on
func _enter_tree() -> void: $label.self_modulate = state_colors[state]
@export var state: int:
set(v):
v = 0 if v < 0 else v % state_colors.size()
state = v
if is_inside_tree():
if is_inside_tree() and has_node("label"):
$label.self_modulate = state_colors[v]
func _ready():
toggle_mode = true
focus_mode = Control.FOCUS_ALL
connect("toggled", _on_toggled)
connect("focus_entered", _on_focus_entered)
connect("focus_exited", _on_focus_exited)
func _on_toggled(toggled_on):
if has_node("frame"):
$frame.visible = toggled_on
func _on_focus_entered():
button_pressed = true
enter_press()
func _on_focus_exited():
pass
func enter_press():
var enter_event = InputEventAction.new()
enter_event.action = "ui_accept"
enter_event.pressed = true
Input.parse_input_event(enter_event)
func _enter_tree() -> void:
if has_node("label"):
$label.self_modulate = state_colors[state]

View File

@@ -366,9 +366,9 @@ metadata/unit_name = ["уарэп-яу07-1н"]
[node name="label" type="Label" parent="pribor_prd_n_1"]
layout_mode = 0
offset_left = 8.0
offset_top = -38.0
offset_top = -40.0
offset_right = 60.0
offset_bottom = -19.0
offset_bottom = -21.0
text = "ПРД Н1"
horizontal_alignment = 1
vertical_alignment = 1
@@ -419,9 +419,9 @@ metadata/online_proc = "on_line_changed"
self_modulate = Color(0, 1, 0, 1)
layout_mode = 0
offset_left = 15.0
offset_top = -34.0
offset_top = -44.0
offset_right = 91.0
offset_bottom = -15.0
offset_bottom = -25.0
text = "УФ"
horizontal_alignment = 1
vertical_alignment = 1
@@ -470,10 +470,10 @@ metadata/online_proc = "online_change_arr"
[node name="label" type="Label" parent="pribor_rtr"]
layout_mode = 0
offset_left = 12.0
offset_top = -54.0
offset_right = 95.0
offset_bottom = -35.0
offset_left = 11.0
offset_top = -49.0
offset_right = 94.0
offset_bottom = -30.0
text = "РТР"
horizontal_alignment = 1
vertical_alignment = 1
@@ -495,17 +495,17 @@ 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
offset_left = 11.0
offset_top = -49.0
offset_right = 94.0
offset_bottom = -30.0
text = "РТР"
horizontal_alignment = 1
vertical_alignment = 1
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_rtr"]
light_mask = 3
position = Vector2(55, -15)
position = Vector2(53, -15)
scale = Vector2(0.625, 0.625)
sprite_frames = SubResource("SpriteFrames_foasq")
frame_progress = 0.72355
@@ -533,9 +533,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_afsp_1"]
layout_mode = 0
offset_left = 165.0
offset_left = 175.0
offset_top = -245.0
offset_right = 262.0
offset_right = 272.0
offset_bottom = -225.0
scale = Vector2(5, 5)
text = "АФСП 1"
@@ -560,9 +560,9 @@ patch_margin_bottom = 16
[node name="label2" type="Label" parent="pribor_afsp_1"]
layout_mode = 0
offset_left = 165.0
offset_left = 175.0
offset_top = -245.0
offset_right = 262.0
offset_right = 272.0
offset_bottom = -225.0
scale = Vector2(5, 5)
text = "АФСП 1"
@@ -600,9 +600,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_afsp_2"]
layout_mode = 0
offset_left = 200.0
offset_left = 175.0
offset_top = -240.0
offset_right = 297.0
offset_right = 272.0
offset_bottom = -220.0
scale = Vector2(5, 5)
text = "АФСП 2"
@@ -627,9 +627,9 @@ patch_margin_bottom = 16
[node name="label2" type="Label" parent="pribor_afsp_2"]
layout_mode = 0
offset_left = 200.0
offset_left = 175.0
offset_top = -240.0
offset_right = 297.0
offset_right = 272.0
offset_bottom = -220.0
scale = Vector2(5, 5)
text = "АФСП 2"
@@ -638,7 +638,7 @@ vertical_alignment = 1
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_afsp_2"]
light_mask = 3
position = Vector2(425, -40)
position = Vector2(415, -40)
scale = Vector2(3, 3)
sprite_frames = SubResource("SpriteFrames_foasq")
frame_progress = 0.72355
@@ -665,9 +665,9 @@ metadata/online_proc = "online_change_arr"
[node name="label" type="Label" parent="pribor_uyep"]
layout_mode = 0
offset_left = 26.8566
offset_top = -38.3276
offset_top = -43.3276
offset_right = 66.8566
offset_bottom = -19.3276
offset_bottom = -24.3276
text = "У-ЭП"
horizontal_alignment = 1
vertical_alignment = 1
@@ -717,9 +717,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_prd_v_2"]
layout_mode = 0
offset_left = 14.0
offset_top = -38.0
offset_top = -42.0
offset_right = 66.0
offset_bottom = -19.0
offset_bottom = -23.0
text = "ПРД В2"
horizontal_alignment = 1
vertical_alignment = 1
@@ -769,9 +769,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_prd_n_2"]
layout_mode = 0
offset_left = 15.0
offset_top = -38.0
offset_top = -42.0
offset_right = 67.0
offset_bottom = -19.0
offset_bottom = -23.0
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 0
text = "ПРД Н2"
@@ -823,9 +823,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_prd_k_2"]
layout_mode = 0
offset_left = 17.0
offset_top = -38.0
offset_top = -42.0
offset_right = 69.0
offset_bottom = -19.0
offset_bottom = -23.0
text = "ПРД К2"
horizontal_alignment = 1
vertical_alignment = 1
@@ -857,9 +857,9 @@ script = ExtResource("11_u7tym")
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1048.0
offset_top = 802.0
offset_top = 810.0
offset_right = 1125.0
offset_bottom = 918.0
offset_bottom = 926.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -875,9 +875,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_prd_v_3"]
layout_mode = 0
offset_left = 9.0
offset_top = -38.0
offset_top = -41.0
offset_right = 61.0
offset_bottom = -19.0
offset_bottom = -22.0
text = "ПРД В3"
horizontal_alignment = 1
vertical_alignment = 1
@@ -909,9 +909,9 @@ script = ExtResource("11_u7tym")
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1323.0
offset_top = 802.0
offset_top = 810.0
offset_right = 1400.0
offset_bottom = 918.0
offset_bottom = 926.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -927,9 +927,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_prd_n_3"]
layout_mode = 0
offset_left = 8.0
offset_top = -38.0
offset_top = -43.0
offset_right = 60.0
offset_bottom = -19.0
offset_bottom = -24.0
text = "ПРД Н3"
horizontal_alignment = 1
vertical_alignment = 1
@@ -961,9 +961,9 @@ script = ExtResource("11_u7tym")
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1188.0
offset_top = 802.0
offset_top = 810.0
offset_right = 1265.0
offset_bottom = 918.0
offset_bottom = 926.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -979,9 +979,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_prd_k_3"]
layout_mode = 0
offset_left = 9.0
offset_top = -38.0
offset_top = -42.0
offset_right = 61.0
offset_bottom = -19.0
offset_bottom = -23.0
text = "ПРД К3"
horizontal_alignment = 1
vertical_alignment = 1
@@ -1013,9 +1013,9 @@ script = ExtResource("11_u7tym")
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
offset_left = 1328.0
offset_top = 198.0
offset_top = 193.0
offset_right = 1405.0
offset_bottom = 314.0
offset_bottom = 309.0
size_flags_horizontal = 15
size_flags_vertical = 15
toggle_mode = true
@@ -1031,9 +1031,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_prd_v_1"]
layout_mode = 0
offset_left = 8.0
offset_top = -38.0
offset_top = -44.0
offset_right = 60.0
offset_bottom = -19.0
offset_bottom = -25.0
text = "ПРД В1"
horizontal_alignment = 1
vertical_alignment = 1
@@ -1083,9 +1083,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_prd_k_1"]
layout_mode = 0
offset_left = 9.0
offset_top = -38.0
offset_top = -44.0
offset_right = 61.0
offset_bottom = -19.0
offset_bottom = -25.0
text = "ПРД К1"
horizontal_alignment = 1
vertical_alignment = 1
@@ -1134,9 +1134,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_prd_v_4"]
layout_mode = 0
offset_left = 17.0
offset_top = -38.0
offset_top = -41.0
offset_right = 69.0
offset_bottom = -19.0
offset_bottom = -22.0
text = "ПРД В4"
horizontal_alignment = 1
vertical_alignment = 1
@@ -1185,9 +1185,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_prd_n_4"]
layout_mode = 0
offset_left = 14.0
offset_top = -38.0
offset_top = -41.0
offset_right = 66.0
offset_bottom = -19.0
offset_bottom = -22.0
text = "ПРД Н4"
horizontal_alignment = 1
vertical_alignment = 1
@@ -1236,9 +1236,9 @@ metadata/online_proc = "on_line_changed"
[node name="label" type="Label" parent="pribor_prd_k_4"]
layout_mode = 0
offset_left = 17.0
offset_top = -38.0
offset_top = -40.0
offset_right = 69.0
offset_bottom = -19.0
offset_bottom = -21.0
text = "ПРД К4"
horizontal_alignment = 1
vertical_alignment = 1