diff --git a/scenes/pribor-afsp/pribor-afsp-1.tscn b/scenes/pribor-afsp/pribor-afsp-1.tscn index 1e3e72c0..e99f25c5 100644 --- a/scenes/pribor-afsp/pribor-afsp-1.tscn +++ b/scenes/pribor-afsp/pribor-afsp-1.tscn @@ -23,7 +23,6 @@ metadata/DeviceName = &"Устройство РР левого борта" [node name="request" type="HTTPRequest" parent="."] use_threads = true script = ExtResource("2_4vyhj") -request_url = null [node name="timer" type="Timer" parent="request"] autostart = true diff --git a/scenes/pribor-afsp/pribor-afsp-2.tscn b/scenes/pribor-afsp/pribor-afsp-2.tscn index 687a5730..1eae9366 100644 --- a/scenes/pribor-afsp/pribor-afsp-2.tscn +++ b/scenes/pribor-afsp/pribor-afsp-2.tscn @@ -23,7 +23,6 @@ metadata/DeviceName = &"Устройство РР правого борта" [node name="request" type="HTTPRequest" parent="."] use_threads = true script = ExtResource("2_miwrd") -request_url = null [node name="timer" type="Timer" parent="request"] autostart = true diff --git a/scenes/pribor-afsp/pribor-afsp.gd b/scenes/pribor-afsp/pribor-afsp.gd index 7437ff94..504ef8c7 100644 --- a/scenes/pribor-afsp/pribor-afsp.gd +++ b/scenes/pribor-afsp/pribor-afsp.gd @@ -10,13 +10,16 @@ class_name pribor_afsp extends 'res://scenes/контроль/прибор.gd' static var json_conv: JSON = JSON.new() static var node_maper = load('res://scenes/контроль/node-maper.gd') var ctrl_pos = 0 - +var request_url: Node +var time_req: Node # SystemName: "gen" DevList - там состояние связи с генератором по кан шине func _ready() -> void: ProjectSettings.connect('settings_changed', on_settings_chaged) on_settings_chaged() + request_url = $request + time_req = $request/timer func on_settings_chaged(): diff --git a/scenes/pribor-afsp/pribor-bpo.tscn b/scenes/pribor-afsp/pribor-bpo.tscn index 06d13c79..cae99bd9 100644 --- a/scenes/pribor-afsp/pribor-bpo.tscn +++ b/scenes/pribor-afsp/pribor-bpo.tscn @@ -202,7 +202,6 @@ fname = "Яч. связи" [node name="request1" type="HTTPRequest" parent="."] use_threads = true script = ExtResource("4_crej3") -request_url = null [node name="timer" type="Timer" parent="request1"] autostart = true diff --git a/scenes/контроль/request.gd b/scenes/контроль/request.gd index 284a8e1d..7b9522b4 100644 --- a/scenes/контроль/request.gd +++ b/scenes/контроль/request.gd @@ -21,6 +21,8 @@ const RESULT_STRINGS = { @export var request_url: String = '' +signal sending_request() ## Отправка запроса + func get_result_string(result: Result): return RESULT_STRINGS[result] if RESULT_STRINGS.has(result) else '<неизвестный код результата HTTPRequest - %d>' % result @@ -32,3 +34,4 @@ func _on_request_timer(): var rc: = request(request_url) if rc != Error.OK: push_error('%s: \"%s\"' % [error_string(rc), request_url]) + emit_signal('sending_request') diff --git a/scenes/контроль/блок-б.tscn b/scenes/контроль/блок-б.tscn index c5d3e36b..c53b9e5c 100644 --- a/scenes/контроль/блок-б.tscn +++ b/scenes/контроль/блок-б.tscn @@ -163,8 +163,6 @@ func _enter_tree() -> void: vals[2] = get_theme_constant('margin_bottom') vals[3] = get_theme_constant('margin_right') return vals - - " [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_kqhju"] diff --git a/scenes/контроль/кнопка-прибора.gd b/scenes/контроль/кнопка-прибора.gd index a6359dd2..fb222cc9 100644 --- a/scenes/контроль/кнопка-прибора.gd +++ b/scenes/контроль/кнопка-прибора.gd @@ -54,12 +54,12 @@ func _on_settings_changed(): var json_col_w = ProjectSettings.get_setting('application/config/%s' % 'Цвет фона схемы', '[0.0, 0.0, 0.0, 0.0]') var arr_col_w = JSON.parse_string(json_col_w) white_color = Color(arr_col_w[0], arr_col_w[1], arr_col_w[2], arr_col_w[3]) if arr_col_w else Color.DIM_GRAY - + var black_color = ProjectSettings.get_setting('application/config/%s' % 'Цвет схемы', Color.WHITE_SMOKE) var json_col_b = ProjectSettings.get_setting('application/config/%s' % 'Цвет схемы', '[1.0, 1.0, 1.0, 1.0]') var arr_col_b = JSON.parse_string(json_col_b) black_color = Color(arr_col_b[0], arr_col_b[1], arr_col_b[2], arr_col_b[3]) if arr_col_b else Color.WHITE_SMOKE - + $pic_functional.material.set('shader_parameter/white', white_color) $pic_functional.material.set('shader_parameter/black', black_color) @@ -108,3 +108,16 @@ func _on_settings_changed(): show_functional = v if is_inside_tree(): $pic_functional.visible = v + + +@export var timeout_tween: float: + # Создаем твин для анимации с плавным началом и концом + set(v): + $control_progress.value = 0.0 + var local_tween = create_tween() + local_tween.tween_property($control_progress, "value", v, v)\ + .set_trans(Tween.TRANS_SINE)\ + .set_ease(Tween.EASE_IN_OUT) + + local_tween.tween_callback(func(): + $control_progress.visible = false) diff --git a/scenes/контроль/контроль.tscn b/scenes/контроль/контроль.tscn index 0f3722ae..4d9e6faa 100644 --- a/scenes/контроль/контроль.tscn +++ b/scenes/контроль/контроль.tscn @@ -110,6 +110,7 @@ func _ready(): uf_control = UFControl.new('уарэп-эмс') signaller.connect('update_uf_serviceability', Callable(self, 'on_update_uf_serviceability').bind(pribor_node)) + # Пиктограммы приборов, которые отображают состояние подключения только for pribor_node in get_tree().get_nodes_in_group('pribor_pics'): var unit_name = pribor_node.get_meta('unit_name') @@ -166,14 +167,24 @@ func on_pribor_press(pribor_path, header_text, pribor_node): pribor.add_to_group('pribor_items') add_child(pribor) update_pribor_items_visibility() + if pribor_node.get_meta('unit_name')[0] == 'уарэп-афсп-левый' or pribor_node.get_meta('unit_name')[0] == 'уарэп-афсп-правый': + var req = pribor.request_url + req.connect('sending_request', Callable(self, 'on_sending_request').bind(pribor_node, pribor.time_req.wait_time)) + + +# Вызов при отправке запроса на селфтест АФСП +func on_sending_request(node: Node, time_req: float) -> void: + node.progress_max_value = time_req + node.progress_visible = true + node.timeout_tween = time_req ## Прием сигналов о текущем состояниях приборах -func on_serviceability_changed(state: int, prd_pribor_node: Node)-> void: +func on_serviceability_changed(state: int, prd_pribor_node: Node) -> void: prd_pribor_node.state = state -func on_update_uf_serviceability(uf_serviceaability: int, uf_pribor: Node)-> void: +func on_update_uf_serviceability(uf_serviceaability: int, uf_pribor: Node) -> void: uf_pribor.state = uf_serviceaability @@ -558,6 +569,7 @@ stretch_mode = 4 flip_h = true script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 0.87, 0, 1), Color(100, 0, 0, 1)] +timeout_tween = null metadata/online_proc = "on_line_changed" metadata/unit_name = ["уарэп-яу07-1н"] @@ -643,18 +655,20 @@ frame_progress = 0.72355 [node name="pribor_uf" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 -offset_left = 1183.0 -offset_top = 558.0 -offset_right = 1294.0 +offset_left = 1188.0 +offset_top = 581.0 +offset_right = 1285.0 offset_bottom = 743.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true action_mode = 0 texture_normal = ExtResource("2_0nvm1") +ignore_texture_size = true stretch_mode = 0 script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 1, 0, 1), Color(1, 0, 0, 1)] +timeout_tween = null metadata/unit_name = ["уарэп-эмс"] metadata/online_proc = "on_line_changed" @@ -753,6 +767,7 @@ texture_normal = ExtResource("3_hhadv") stretch_mode = 0 script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 1, 0, 1), Color(1, 0, 0, 1)] +timeout_tween = null metadata/unit_name = [&"уарэп-бпо-1", &"уарэп-бпо-2"] metadata/online_proc = "online_change_arr" @@ -781,16 +796,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 = 11.0 -offset_top = -49.0 -offset_right = 94.0 -offset_bottom = -30.0 -text = "РТР" -horizontal_alignment = 1 -vertical_alignment = 1 - [node name="pic_functional" type="TextureRect" parent="pribor_rtr"] visible = false z_index = 1 @@ -827,8 +832,8 @@ editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1053.0 offset_top = 425.0 -offset_right = 1886.0 -offset_bottom = 1065.0 +offset_right = 1853.0 +offset_bottom = 1025.0 scale = Vector2(0.2, 0.2) pivot_offset = Vector2(-10, -65) size_flags_horizontal = 15 @@ -836,9 +841,11 @@ size_flags_vertical = 15 toggle_mode = true action_mode = 0 texture_normal = ExtResource("9_iqgf5") +ignore_texture_size = true stretch_mode = 0 script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 1, 0, 1), Color(1, 0, 0, 1)] +timeout_tween = null metadata/unit_name = [&"уарэп-афсп-левый"] metadata/online_proc = "on_line_changed" @@ -857,9 +864,9 @@ vertical_alignment = 1 visible = false self_modulate = Color(0.890196, 0.486275, 0.196078, 1) layout_mode = 0 -offset_left = -60.0 -offset_top = -165.0 -offset_right = 130.0 +offset_left = -55.0 +offset_top = -170.0 +offset_right = 125.0 offset_bottom = 10.0 scale = Vector2(5, 5) texture = ExtResource("4_rasbe") @@ -869,17 +876,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 = 175.0 -offset_top = -245.0 -offset_right = 272.0 -offset_bottom = -225.0 -scale = Vector2(5, 5) -text = "АФСП 1" -horizontal_alignment = 1 -vertical_alignment = 1 - [node name="pic_functional" type="TextureRect" parent="pribor_afsp_1"] visible = false z_index = 1 @@ -911,13 +907,36 @@ scale = Vector2(3, 2.981) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 +[node name="control_progress" type="TextureProgressBar" parent="pribor_afsp_1"] +visible = false +offset_left = 15.0 +offset_top = 735.0 +offset_right = 815.0 +offset_bottom = 775.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = " +Текущее: 0.00" +mouse_filter = 0 +max_value = 30.0 +value = 8.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_afsp_2" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1243.0 offset_top = 425.0 -offset_right = 2076.0 -offset_bottom = 1065.0 +offset_right = 2043.0 +offset_bottom = 1025.0 scale = Vector2(0.2, 0.2) pivot_offset = Vector2(-10, -65) size_flags_horizontal = 15 @@ -925,10 +944,12 @@ size_flags_vertical = 15 toggle_mode = true action_mode = 0 texture_normal = ExtResource("9_iqgf5") +ignore_texture_size = true stretch_mode = 0 flip_h = true script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 1, 0, 1), Color(1, 0, 0, 1)] +timeout_tween = null metadata/unit_name = [&"уарэп-афсп-правый"] metadata/online_proc = "on_line_changed" @@ -948,8 +969,8 @@ visible = false self_modulate = Color(0.890196, 0.486275, 0.196078, 1) layout_mode = 0 offset_left = -50.0 -offset_top = -165.0 -offset_right = 140.0 +offset_top = -170.0 +offset_right = 130.0 offset_bottom = 10.0 scale = Vector2(5, 5) texture = ExtResource("4_rasbe") @@ -959,17 +980,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 = 175.0 -offset_top = -240.0 -offset_right = 272.0 -offset_bottom = -220.0 -scale = Vector2(5, 5) -text = "АФСП 2" -horizontal_alignment = 1 -vertical_alignment = 1 - [node name="pic_functional" type="TextureRect" parent="pribor_afsp_2"] visible = false z_index = 1 @@ -1001,21 +1011,46 @@ scale = Vector2(3, 2.981) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 +[node name="control_progress" type="TextureProgressBar" parent="pribor_afsp_2"] +visible = false +offset_left = 20.0 +offset_top = 735.0 +offset_right = 825.0 +offset_bottom = 775.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = " +Текущее: 0.00" +mouse_filter = 0 +max_value = 30.0 +value = 8.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_uyep" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1313.0 -offset_top = 558.0 -offset_right = 1407.0 +offset_top = 584.0 +offset_right = 1394.0 offset_bottom = 744.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true action_mode = 0 texture_normal = ExtResource("5_kvnex") +ignore_texture_size = true stretch_mode = 0 script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 1, 0, 1), Color(1, 0, 0, 1)] +timeout_tween = null metadata/unit_name = ["уарэп-щ3", "уарэп-спт25-1", "уарэп-спт25-2"] metadata/online_proc = "online_change_arr" @@ -1091,6 +1126,7 @@ stretch_mode = 4 flip_h = true script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 1, 0, 1), Color(1, 0, 0, 1)] +timeout_tween = null metadata/unit_name = ["уарэп-яу07-2в"] metadata/online_proc = "on_line_changed" @@ -1189,6 +1225,7 @@ stretch_mode = 4 flip_h = true script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 1, 0, 1), Color(1, 0, 0, 1)] +timeout_tween = null metadata/unit_name = ["уарэп-яу07-2н"] metadata/online_proc = "on_line_changed" @@ -1289,6 +1326,7 @@ stretch_mode = 4 flip_h = true script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 1, 0, 1), Color(1, 0, 0, 1)] +timeout_tween = null metadata/unit_name = ["уарэп-яу07-2к"] metadata/online_proc = "on_line_changed" @@ -1387,6 +1425,7 @@ stretch_mode = 4 flip_h = true script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 1, 0, 1), Color(1, 0, 0, 1)] +timeout_tween = null metadata/unit_name = ["уарэп-яу07-3в"] metadata/online_proc = "on_line_changed" @@ -1485,6 +1524,7 @@ stretch_mode = 4 flip_h = true script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 1, 0, 1), Color(1, 0, 0, 1)] +timeout_tween = null metadata/unit_name = ["уарэп-яу07-3н"] metadata/online_proc = "on_line_changed" @@ -1583,6 +1623,7 @@ stretch_mode = 4 flip_h = true script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 1, 0, 1), Color(1, 0, 0, 1)] +timeout_tween = null metadata/unit_name = ["уарэп-яу07-3к"] metadata/online_proc = "on_line_changed" @@ -1681,6 +1722,7 @@ stretch_mode = 4 flip_h = true script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 0.87, 0, 1), Color(100, 0, 0, 1)] +timeout_tween = null metadata/unit_name = ["уарэп-яу07-1в"] metadata/online_proc = "on_line_changed" @@ -1778,6 +1820,7 @@ stretch_mode = 4 flip_h = true script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 0.87, 0, 1), Color(100, 0, 0, 1)] +timeout_tween = null metadata/unit_name = ["уарэп-яу07-1к"] metadata/online_proc = "on_line_changed" @@ -1875,6 +1918,7 @@ texture_normal = ExtResource("6_i1yfn") stretch_mode = 4 script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 0.87, 0, 1), Color(0.65, 0.0715, 0.0715, 1)] +timeout_tween = null metadata/unit_name = ["уарэп-яу07-4в"] metadata/online_proc = "on_line_changed" @@ -1972,6 +2016,7 @@ texture_normal = ExtResource("6_i1yfn") stretch_mode = 4 script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 0.87, 0, 1), Color(0.65, 0.0715, 0.0715, 1)] +timeout_tween = null metadata/unit_name = ["уарэп-яу07-4н"] metadata/online_proc = "on_line_changed" @@ -2069,6 +2114,7 @@ texture_normal = ExtResource("6_i1yfn") stretch_mode = 4 script = ExtResource("3_4pt7j") state_colors = [Color(1, 1, 1, 1), Color(0, 0.87, 0, 1), Color(0.65, 0.0715, 0.0715, 1)] +timeout_tween = null metadata/unit_name = ["уарэп-яу07-4к"] metadata/online_proc = "on_line_changed"