Доработка прогресс бара для УФ

This commit is contained in:
TotMaxim
2025-12-09 19:42:49 +03:00
parent c0018044a5
commit f34984872e
4 changed files with 71 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=20 format=3 uid="uid://3slb0i3pvowc"]
[gd_scene load_steps=19 format=3 uid="uid://3slb0i3pvowc"]
[ext_resource type="Script" uid="uid://bvo6tcreqyuex" path="res://scenes/tabs-switch/tab-switch.gd" id="1_fg0vd"]
[ext_resource type="PackedScene" uid="uid://b276iygic5itk" path="res://scenes/работа/работа.tscn" id="2_u7p16"]
@@ -22,16 +22,13 @@
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_o1r22"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nmdfd"]
bg_color = Color(0.061, 100, 0.051, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_cw2ss"]
bg_color = Color(0.473976, 0.473976, 0.473976, 1)
bg_color = Color(0.47451, 0.47451, 0.47451, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nmdfd"]
bg_color = Color(0, 100, 0, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_41d34"]
bg_color = Color(0.39, 100, 0.327, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_imu1q"]
[node name="panel" type="Panel"]
offset_right = 1600.0
@@ -100,12 +97,10 @@ offset_bottom = 27.0
tooltip_text = "Задействовать режим Тренаж"
focus_mode = 0
theme_override_colors/font_hover_pressed_color = Color(0, 0, 0, 1)
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_colors/font_pressed_color = Color(0, 0, 0, 1)
theme_override_styles/hover_pressed = SubResource("StyleBoxFlat_nmdfd")
theme_override_styles/hover = SubResource("StyleBoxFlat_cw2ss")
theme_override_styles/pressed = SubResource("StyleBoxFlat_41d34")
theme_override_styles/normal = SubResource("StyleBoxFlat_imu1q")
theme_override_styles/pressed = SubResource("StyleBoxFlat_nmdfd")
theme_override_styles/normal = SubResource("StyleBoxFlat_41d34")
toggle_mode = true
text = "Тренаж"
script = ExtResource("9_41d34")

View File

@@ -122,7 +122,7 @@ func _ready():
signaller.conn(signaller.режим_журнал, on_mode_changed)
signaller.conn(signaller.режим_настройки, on_mode_changed)
signaller.conn(signaller.режим_эмс, on_mode_changed)
signaller.connect('debag_control_pressed', Callable(self, 'on_control_button_pressed'))
signaller.connect('debag_control_pressed', Callable(self, 'on_debag_button_pressed'))
func online_change_arr(_u, conn_node, pribor_meta):
@@ -187,8 +187,36 @@ func _on_control_prd_pressed() -> void:
for pribor in get_tree().get_nodes_in_group('pribor_buttons'):
pribor.state = 0 # NONE
signaller.emit_signal('start_contol_device')
# Показываем прогресс бар
$pribor_uf/control_progress.visible = true
$pribor_uf/control_progress.value = 0
# Создаем твин для анимации с плавным началом и концом
var tween = create_tween()
tween.tween_property($pribor_uf/control_progress, \"value\", 100, 2.0)\\
.set_trans(Tween.TRANS_SINE)\\
.set_ease(Tween.EASE_IN_OUT)
tween.tween_callback(func():
$pribor_uf/control_progress.visible = false
$pribor_uf.state = uf_control.serviceability_uf
)
func on_debag_button_pressed(state: bool) -> void:
ctl_btn_state = state
update_pribor_items_visibility()
func update_pribor_items_visibility():
var pribor_items = get_tree().get_nodes_in_group('pribor_items')
for pribor in pribor_items:
for child_name in ['input_0', 'output_0', 'input_1', 'output_1', 'input_2', 'output_2']:
if pribor.has_node(child_name):
pribor.get_node(child_name).visible = ctl_btn_state
#region Управление прогресс барами в контроле
func on_update_progress(value_progress: float, pribor_node: Node) -> void:
pribor_node.progress_value = value_progress
pribor_node.progress_visible = value_progress > 0
@@ -196,6 +224,7 @@ func on_update_progress(value_progress: float, pribor_node: Node) -> void:
func on_update_max_value_progress(max_value_progress: int, pribor_node: Node) -> void:
pribor_node.progress_max_value = max_value_progress
#endregion
func on_control_is_over(pribor_name: String) -> void:
@@ -224,19 +253,6 @@ func _on_gui_input(event: InputEvent) -> void:
cur_pribor_node = null
$frame_button/chk_show_functional.button_pressed = false
$frame_button/chk_show_functional.disabled = true
func on_control_button_pressed(state: bool) -> void:
ctl_btn_state = state
update_pribor_items_visibility()
func update_pribor_items_visibility():
var pribor_items = get_tree().get_nodes_in_group('pribor_items')
for pribor in pribor_items:
for child_name in ['input_0', 'output_0', 'input_1', 'output_1', 'input_2', 'output_2']:
if pribor.has_node(child_name):
pribor.get_node(child_name).visible = ctl_btn_state
"
[sub_resource type="SpriteFrames" id="SpriteFrames_foasq"]
@@ -265,6 +281,7 @@ border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
border_color = Color(0.6, 0.6, 0.6, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_l5wui"]
bg_color = Color(0.47451, 0.47451, 0.47451, 1)
@@ -616,6 +633,28 @@ offset_bottom = 311.0
scale = Vector2(0.789429, 0.789429)
texture = ExtResource("11_gjf0t")
[node name="control_progress" type="TextureProgressBar" parent="pribor_uf"]
visible = false
offset_left = 9.0
offset_top = 191.0
offset_right = 102.0
offset_bottom = 201.0
size_flags_horizontal = 3
size_flags_vertical = 3
tooltip_text = "
Текущее: 0.00"
mouse_filter = 0
max_value = 30.0
nine_patch_stretch = true
stretch_margin_left = 5
stretch_margin_top = 5
stretch_margin_right = 5
stretch_margin_bottom = 5
texture_under = ExtResource("9_w6m6a")
texture_progress = ExtResource("10_lbx5w")
tint_under = Color(1, 1, 1, 0.419608)
tint_progress = Color(0.890196, 0.486275, 0.196078, 1)
[node name="pribor_rtr" type="TextureButton" parent="." groups=["pribor_buttons"]]
editor_description = "Кнопка для выбора прибора."
layout_mode = 0
@@ -1938,9 +1977,9 @@ vertical_alignment = 1
[node name="frame_button" type="Panel" parent="."]
layout_mode = 0
offset_left = 1040.0
offset_top = 12.0
offset_top = 16.0
offset_right = 1416.0
offset_bottom = 52.0
offset_bottom = 56.0
theme_override_styles/panel = SubResource("StyleBoxFlat_6hcgs")
[node name="chk_show_functional" type="CheckButton" parent="frame_button"]
@@ -1954,6 +1993,7 @@ theme_override_font_sizes/font_size = 22
disabled = true
text = "Функциональная схема Э2"
flat = true
alignment = 1
[node name="connect_legend0" type="AnimatedSprite2D" parent="."]
light_mask = 3

View File

@@ -149,8 +149,14 @@ func on_settings_changed():
color_emit_sel *= Color(1.0, 1.0, 1.0, 0.2)
color_closed *= Color(1.0, 1.0, 1.0, 0.0)
color_closed_emit *= Color(1.0, 1.0, 1.0, 1.0)
col_btn_act = ProjectSettings.get_setting('application/config/%s' % 'Цвет кнопки \"Подавление\"', Color.WHITE)
var act_value = ProjectSettings.get_setting('application/config/%s' % 'Цвет кнопки \"Подавление\"', Color.WHITE)
if act_value is Array and act_value.size() >= 4:
col_btn_act = Color(act_value[0], act_value[1], act_value[2], act_value[3])
elif act_value is Color:
col_btn_act = act_value
else:
col_btn_act = Color.WHITE # значение по умолчанию
push_warning("Некорректный тип цвета: %s" % str(act_value))
## Обработчик сигнала изменения списка целей.

View File

@@ -380,7 +380,6 @@ texture_normal = ExtResource("14_ggrwd")
[connection signal="drag_continue" from="." to="." method="_on_drag_continue"]
[connection signal="toggled" from="btn_view" to="." method="on_button_view_toggled"]
[connection signal="toggled" from="chk_auto" to="." method="on_value_changed"]
[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate"]
[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate_toggled"]
[connection signal="toggled" from="btn_center" to="." method="on_btn_center_toggled"]
[connection signal="button_down" from="zoom_plus" to="tilemap" method="_on_zoom_plus_button_down"]