diff --git a/addons/godot-logger/scripts/logger.gd b/addons/godot-logger/scripts/logger.gd index 8110466..57684f0 100644 --- a/addons/godot-logger/scripts/logger.gd +++ b/addons/godot-logger/scripts/logger.gd @@ -1,3 +1,4 @@ +@tool # Copyright (c) 2020-2023 Mansur Isaev and contributors - MIT License # See `LICENSE.md` included in the source distribution for details. diff --git a/scenes/frame-ecm-list/frm-ecm-list.tscn b/scenes/frame-ecm-list/frm-ecm-list.tscn index fceb9ed..3b8c4c1 100644 --- a/scenes/frame-ecm-list/frm-ecm-list.tscn +++ b/scenes/frame-ecm-list/frm-ecm-list.tscn @@ -48,7 +48,7 @@ offset_left = 8.0 offset_top = 245.0 offset_right = 472.0 offset_bottom = 281.0 -columns = 4 +columns = 5 [node name="btn_srn" parent="grd_forced" groups=["группа-принудительно"] instance=ExtResource("4_7ys3c")] layout_mode = 2 @@ -77,10 +77,19 @@ strips_rotation = 15.0 text = "КУПД" metadata/rfi_name = "ozp1" +[node name="btn_panika" parent="grd_forced" groups=["группа-принудительно"] instance=ExtResource("4_7ys3c")] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = "Кнопка для принудительного включения группы секторов в режим КУПД" +strips_rotation = 15.0 +text = "Паника" +metadata/rfi_name = "ozp1" + [node name="btn_cancel" parent="grd_forced" groups=["прин-секторы-срн"] instance=ExtResource("4_7ys3c")] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 strips_rotation = 15.0 -text = "Отключить все" +text = "Очистить" metadata/rfi_name = "" diff --git a/scenes/grid-buttons-ecm/grid-buttons-ecm.tscn b/scenes/grid-buttons-ecm/grid-buttons-ecm.tscn index 880bd60..56a026e 100644 --- a/scenes/grid-buttons-ecm/grid-buttons-ecm.tscn +++ b/scenes/grid-buttons-ecm/grid-buttons-ecm.tscn @@ -5,7 +5,7 @@ [node name="grd_btns" type="GridContainer"] offset_right = 1096.0 offset_bottom = 54.0 -columns = 16 +columns = 15 [node name="btn_off" parent="." groups=["группа-режим-помехи"] instance=ExtResource("1_oy80h")] layout_mode = 2 @@ -17,16 +17,6 @@ disabled = true toggle_mode = true metadata/rfi_name = "off" -[node name="btn_auto_rfi" parent="." groups=["группа-режим-помехи"] instance=ExtResource("1_oy80h")] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 3 -strips_rotation = 30.0 -text = "Запрет" -disabled = true -toggle_mode = true -metadata/rfi_name = "auto" - [node name="btn_p12" parent="." groups=["группа-режим-помехи"] instance=ExtResource("1_oy80h")] layout_mode = 2 size_flags_horizontal = 3 diff --git a/scenes/pribor-prd-k/kasseta-fs-kd.tscn b/scenes/pribor-prd-k/kasseta-fs-kd.tscn index fb896b8..adeda22 100644 --- a/scenes/pribor-prd-k/kasseta-fs-kd.tscn +++ b/scenes/pribor-prd-k/kasseta-fs-kd.tscn @@ -56,7 +56,7 @@ offset_top = 33.0 offset_right = 205.0 offset_bottom = 183.0 fname = "Блок ФС-6" -rname = "A4" +rname = "A5" [node name="ref_A5" parent="." instance=ExtResource("3_kqnvt")] offset_left = 205.0 diff --git a/scenes/pribor-prd-k/pribor-prd-k.tscn b/scenes/pribor-prd-k/pribor-prd-k.tscn index f82df2d..9c9cb6b 100644 --- a/scenes/pribor-prd-k/pribor-prd-k.tscn +++ b/scenes/pribor-prd-k/pribor-prd-k.tscn @@ -1,13 +1,14 @@ -[gd_scene load_steps=9 format=3 uid="uid://m5s87q7m66lj"] +[gd_scene load_steps=10 format=3 uid="uid://m5s87q7m66lj"] [ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="1_8dmgr"] [ext_resource type="Script" path="res://scenes/контроль/прибор.gd" id="1_ufjwe"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="2_14h25"] [ext_resource type="PackedScene" uid="uid://cm5jd4gjrrpba" path="res://scenes/контроль/кассета-у-5-к.tscn" id="2_tb85r"] [ext_resource type="PackedScene" uid="uid://bkxblfoj7ejv0" path="res://scenes/контроль/блок-а.tscn" id="6_fmhtx"] -[ext_resource type="PackedScene" uid="uid://dbxdb7lo7kofv" path="res://scenes/контроль/кассета-п-1.tscn" id="7_cjjs2"] [ext_resource type="PackedScene" uid="uid://bmagw8nd0ulhj" path="res://scenes/pribor-prd-k/kasseta-fs-kd.tscn" id="7_ia27q"] +[ext_resource type="Script" path="res://scenes/контроль/кассета.gd" id="7_xpa2n"] [ext_resource type="PackedScene" uid="uid://dq31j24gv5vi4" path="res://scenes/контроль/кассета-п-2.tscn" id="8_6fdp7"] +[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="8_la5yt"] [node name="pribor_prd_k" type="Control"] layout_mode = 3 @@ -24,6 +25,7 @@ offset_left = 175.0 offset_top = 242.0 offset_right = 485.0 offset_bottom = 432.0 +fname = "Кассета У5" [node name="lbl_header" type="Label" parent="."] layout_mode = 0 @@ -43,7 +45,7 @@ offset_top = 907.0 offset_right = 645.0 offset_bottom = 949.0 fname = "MAA2000" -rname = "A22" +rname = "A27" [node name="dou2_A7" parent="." instance=ExtResource("1_8dmgr")] layout_mode = 0 @@ -61,7 +63,7 @@ offset_top = 907.0 offset_right = 168.0 offset_bottom = 949.0 fname = "MAA2000" -rname = "A23" +rname = "A28" [node name="dou2_A8" parent="." instance=ExtResource("1_8dmgr")] layout_mode = 0 @@ -351,14 +353,55 @@ offset_right = 485.0 offset_bottom = 622.0 fname = "Кассета ФС-КД" -[node name="kasseta_p_1" parent="." instance=ExtResource("7_cjjs2")] +[node name="kasseta_p_1" type="NinePatchRect" parent="."] layout_mode = 0 offset_left = 175.0 offset_top = 622.0 offset_right = 340.0 offset_bottom = 812.0 +texture = ExtResource("2_14h25") +patch_margin_left = 16 +patch_margin_top = 16 +patch_margin_right = 16 +patch_margin_bottom = 16 +script = ExtResource("7_xpa2n") fname = "Кассета П-1" +[node name="ref_A26" parent="kasseta_p_1" instance=ExtResource("8_la5yt")] +offset_left = 9.0 +offset_top = 33.0 +offset_right = 59.0 +offset_bottom = 183.0 +fname = "ИП12-50" +rname = "A26" + +[node name="ref_A23" parent="kasseta_p_1" instance=ExtResource("8_la5yt")] +offset_left = 59.0 +offset_top = 33.0 +offset_right = 109.0 +offset_bottom = 183.0 +fname = "ИП9-50" +rname = "A24" + +[node name="ref_A24" parent="kasseta_p_1" instance=ExtResource("8_la5yt")] +offset_left = 109.0 +offset_top = 33.0 +offset_right = 159.0 +offset_bottom = 183.0 +fname = "ИП9-50" +rname = "A23" + +[node name="lbl_fname" type="Label" parent="kasseta_p_1"] +self_modulate = Color(1, 1, 1, 0.62) +layout_mode = 0 +offset_left = 7.0 +offset_top = 8.0 +offset_right = 159.0 +offset_bottom = 33.0 +text = "Кассета П-1" +horizontal_alignment = 1 +vertical_alignment = 1 + [node name="kasseta_p_2" parent="." instance=ExtResource("8_6fdp7")] layout_mode = 0 offset_left = 365.0 diff --git a/scenes/pribor-prd-n/kasseta-fs-nd.tscn b/scenes/pribor-prd-n/kasseta-fs-nd.tscn index a6d27dc..6227ee9 100644 --- a/scenes/pribor-prd-n/kasseta-fs-nd.tscn +++ b/scenes/pribor-prd-n/kasseta-fs-nd.tscn @@ -39,7 +39,7 @@ offset_left = 105.0 offset_top = 32.0 offset_right = 155.0 offset_bottom = 182.0 -fname = "Блок ФС-2" +fname = "Блок ФС-3" rname = "A3" [node name="ref_A4" parent="." instance=ExtResource("2_mkgdh")] diff --git a/scenes/pribor-prd-n/pribor-prd-n.tscn b/scenes/pribor-prd-n/pribor-prd-n.tscn index e8e9d7e..c649aff 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.tscn +++ b/scenes/pribor-prd-n/pribor-prd-n.tscn @@ -4,8 +4,8 @@ [ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="2_lpj3d"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_i1no5"] [ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5-нв.tscn" id="5_ej152"] -[ext_resource type="PackedScene" uid="uid://cd5sue1e8iyrv" path="res://scenes/pribor-prd-n/kasseta-fs-nd.tscn" id="6_1p3pi"] -[ext_resource type="PackedScene" uid="uid://dbxdb7lo7kofv" path="res://scenes/контроль/кассета-п-1.tscn" id="7_klldp"] +[ext_resource type="Script" path="res://scenes/контроль/кассета.gd" id="6_b1cob"] +[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_dqc3e"] [ext_resource type="PackedScene" uid="uid://bkxblfoj7ejv0" path="res://scenes/контроль/блок-а.tscn" id="8_u7eqo"] [node name="pribor_prd_n" type="Control"] @@ -96,22 +96,113 @@ offset_right = 485.0 offset_bottom = 432.0 fname = "Кассета У5" -[node name="kasseta_FS_ND" parent="." instance=ExtResource("6_1p3pi")] +[node name="kasseta_FS_ND" type="NinePatchRect" parent="."] layout_mode = 0 offset_left = 175.0 offset_top = 432.0 offset_right = 485.0 offset_bottom = 622.0 +texture = ExtResource("4_i1no5") +patch_margin_left = 16 +patch_margin_top = 16 +patch_margin_right = 16 +patch_margin_bottom = 16 +script = ExtResource("6_b1cob") fname = "Кассета ФС-НД" +metadata/Fname = "" -[node name="kasseta_P_1" parent="." instance=ExtResource("7_klldp")] +[node name="lbl_fname" type="Label" parent="kasseta_FS_ND"] +self_modulate = Color(1, 1, 1, 0.62) +layout_mode = 0 +offset_left = 5.0 +offset_top = 7.0 +offset_right = 303.0 +offset_bottom = 33.0 +text = "Кассета ФС-НД" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="ref_A2" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] +offset_left = 55.0 +offset_top = 32.0 +offset_right = 105.0 +offset_bottom = 182.0 +fname = "Модуль ФС" +rname = "A1" + +[node name="ref_A3" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] +offset_left = 105.0 +offset_top = 32.0 +offset_right = 155.0 +offset_bottom = 182.0 +fname = "Блок ФС-2" +rname = "A3" + +[node name="ref_A4" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] +offset_left = 155.0 +offset_top = 32.0 +offset_right = 205.0 +offset_bottom = 182.0 +fname = "Модуль ФС" +rname = "A2" + +[node name="ref_A6" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] +offset_left = 205.0 +offset_top = 32.0 +offset_right = 255.0 +offset_bottom = 182.0 +fname = "Блок ФС-3" +rname = "A4" + +[node name="kasseta_P_1" type="NinePatchRect" parent="."] layout_mode = 0 offset_left = 175.0 offset_top = 622.0 offset_right = 485.0 offset_bottom = 812.0 +texture = ExtResource("4_i1no5") +patch_margin_left = 16 +patch_margin_top = 16 +patch_margin_right = 16 +patch_margin_bottom = 16 +script = ExtResource("6_b1cob") fname = "Кассета П-1" +[node name="ref_A26" parent="kasseta_P_1" instance=ExtResource("7_dqc3e")] +offset_left = 9.0 +offset_top = 33.0 +offset_right = 59.0 +offset_bottom = 183.0 +fname = "ИП9-50" +rname = "A19" + +[node name="ref_A23" parent="kasseta_P_1" instance=ExtResource("7_dqc3e")] +offset_left = 59.0 +offset_top = 33.0 +offset_right = 109.0 +offset_bottom = 183.0 +fname = "ИП9-50" +rname = "A20" + +[node name="ref_A24" parent="kasseta_P_1" instance=ExtResource("7_dqc3e")] +offset_left = 109.0 +offset_top = 33.0 +offset_right = 159.0 +offset_bottom = 183.0 +fname = "ИП12-50" +rname = "A21" + +[node name="lbl_fname" type="Label" parent="kasseta_P_1"] +self_modulate = Color(1, 1, 1, 0.62) +layout_mode = 0 +offset_left = 7.0 +offset_top = 8.0 +offset_right = 159.0 +offset_bottom = 33.0 +text = "Кассета П-1" +horizontal_alignment = 1 +vertical_alignment = 1 + [node name="um1535_A7" parent="." instance=ExtResource("8_u7eqo")] layout_mode = 0 offset_left = 485.0 @@ -212,7 +303,7 @@ value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" -rname = "A11" +rname = "A12" [node name="um1535_A13" parent="." instance=ExtResource("8_u7eqo")] layout_mode = 0 diff --git a/scenes/pribor-prd-v/pribor-prd-v.tscn b/scenes/pribor-prd-v/pribor-prd-v.tscn index 359d924..900676d 100644 --- a/scenes/pribor-prd-v/pribor-prd-v.tscn +++ b/scenes/pribor-prd-v/pribor-prd-v.tscn @@ -1,11 +1,12 @@ -[gd_scene load_steps=8 format=3 uid="uid://cvskpe1ti3p45"] +[gd_scene load_steps=9 format=3 uid="uid://cvskpe1ti3p45"] [ext_resource type="Script" path="res://scenes/контроль/прибор.gd" id="1_dl7rt"] [ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="2_xpo4b"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="3_wyy1b"] [ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5-нв.tscn" id="4_gl2bl"] [ext_resource type="PackedScene" uid="uid://cd5sue1e8iyrv" path="res://scenes/pribor-prd-n/kasseta-fs-nd.tscn" id="5_nhd2k"] -[ext_resource type="PackedScene" uid="uid://dbxdb7lo7kofv" path="res://scenes/контроль/кассета-п-1.tscn" id="6_d3awr"] +[ext_resource type="Script" path="res://scenes/контроль/кассета.gd" id="6_os4mt"] +[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_38u2b"] [ext_resource type="PackedScene" uid="uid://bkxblfoj7ejv0" path="res://scenes/контроль/блок-а.tscn" id="7_e22c6"] [node name="pribor_prd_n" type="Control"] @@ -104,13 +105,54 @@ offset_right = 485.0 offset_bottom = 622.0 fname = "Кассета ФС-ВД" -[node name="kasseta_P_1" parent="." instance=ExtResource("6_d3awr")] +[node name="kasseta_P_1" type="NinePatchRect" parent="."] layout_mode = 0 offset_left = 175.0 offset_top = 622.0 offset_right = 485.0 offset_bottom = 812.0 -fname = "Кассета П-1" +texture = ExtResource("3_wyy1b") +patch_margin_left = 16 +patch_margin_top = 16 +patch_margin_right = 16 +patch_margin_bottom = 16 +script = ExtResource("6_os4mt") +fname = "Кассета П-1В" + +[node name="ref_A26" parent="kasseta_P_1" instance=ExtResource("7_38u2b")] +offset_left = 9.0 +offset_top = 33.0 +offset_right = 59.0 +offset_bottom = 183.0 +fname = "ИП9-50" +rname = "A19" + +[node name="ref_A23" parent="kasseta_P_1" instance=ExtResource("7_38u2b")] +offset_left = 59.0 +offset_top = 33.0 +offset_right = 109.0 +offset_bottom = 183.0 +fname = "ИП9-50" +rname = "A20" + +[node name="ref_A24" parent="kasseta_P_1" instance=ExtResource("7_38u2b")] +offset_left = 109.0 +offset_top = 33.0 +offset_right = 159.0 +offset_bottom = 183.0 +fname = "ИП12-50" +rname = "A21" + +[node name="lbl_fname" type="Label" parent="kasseta_P_1"] +self_modulate = Color(1, 1, 1, 0.62) +layout_mode = 0 +offset_left = 7.0 +offset_top = 8.0 +offset_right = 159.0 +offset_bottom = 33.0 +text = "Кассета П-1В" +horizontal_alignment = 1 +vertical_alignment = 1 [node name="um1535_A7" parent="." instance=ExtResource("7_e22c6")] layout_mode = 0 @@ -224,7 +266,7 @@ value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" -rname = "A11" +rname = "A12" [node name="um1535_A13" parent="." instance=ExtResource("7_e22c6")] layout_mode = 0 diff --git a/scenes/pribor-uyep/spt25_view.gd b/scenes/pribor-uyep/spt25_view.gd index e64ea12..19d565b 100644 --- a/scenes/pribor-uyep/spt25_view.gd +++ b/scenes/pribor-uyep/spt25_view.gd @@ -12,12 +12,18 @@ enum STATE_VAL } -func _ready() -> void: +func _enter_tree() -> void: var unit_key = repsettings.get_unit_key(unit_name) var unit = repnetwork.units[unit_key] unit.connect('data_received', on_data_received.bind(unit)) +func _exit_tree() -> void: + var unit_key = repsettings.get_unit_key(unit_name) + var unit = repnetwork.units[unit_key] + unit.disconnect('data_received', on_data_received) + + func on_data_received(data, unit): # Неисправность, напряжение на выходе меньше номинального $block_output.state0 = STATE_VAL.GOOD if (data[4] & (1 << 0)) == 0 else STATE_VAL.ERROR diff --git a/scenes/tilemap/Control.gd b/scenes/tilemap/Control.gd new file mode 100644 index 0000000..4b5c358 --- /dev/null +++ b/scenes/tilemap/Control.gd @@ -0,0 +1,12 @@ +extends Control + +var scene_list=[] + +func node_list(node): + scene_list.append(node) + +func _enter_tree(): + get_tree().node_added.connect(self.node_list) +func _ready(): + get_tree().node_added.disconnect(self.node_list) #should be first string in _ready() + print(scene_list) diff --git a/scenes/tilemap/navig.tscn b/scenes/tilemap/navig.tscn new file mode 100644 index 0000000..a2178f3 --- /dev/null +++ b/scenes/tilemap/navig.tscn @@ -0,0 +1,3 @@ +[gd_scene format=3 uid="uid://e3sw6q228iai"] + +[node name="Navig" type="Node2D"] diff --git a/scenes/контроль/кассета-п-1.tscn b/scenes/контроль/кассета-п-1.tscn index 3a1ad51..4a1a6cd 100644 --- a/scenes/контроль/кассета-п-1.tscn +++ b/scenes/контроль/кассета-п-1.tscn @@ -5,7 +5,7 @@ [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="3_gg14a"] [node name="kasseta_p_1" type="NinePatchRect"] -offset_right = 165.0 +offset_right = 173.0 offset_bottom = 190.0 texture = ExtResource("1_sbi2k") patch_margin_left = 16 @@ -15,36 +15,36 @@ patch_margin_bottom = 16 script = ExtResource("2_7ydqi") [node name="ref_A26" parent="." instance=ExtResource("3_gg14a")] -offset_left = 7.0 -offset_top = 30.0 -offset_right = 57.0 -offset_bottom = 180.0 +offset_left = 9.0 +offset_top = 33.0 +offset_right = 59.0 +offset_bottom = 183.0 fname = "ИП12-50" -rname = "A26" +rname = "A19" [node name="ref_A23" parent="." instance=ExtResource("3_gg14a")] -offset_left = 57.0 -offset_top = 30.0 -offset_right = 107.0 -offset_bottom = 180.0 -fname = "ИП9-50" -rname = "A23" - -[node name="ref_A24" parent="." instance=ExtResource("3_gg14a")] -offset_left = 107.0 -offset_top = 30.0 -offset_right = 157.0 -offset_bottom = 180.0 +offset_left = 59.0 +offset_top = 33.0 +offset_right = 109.0 +offset_bottom = 183.0 fname = "ИП9-50" rname = "A24" +[node name="ref_A24" parent="." instance=ExtResource("3_gg14a")] +offset_left = 109.0 +offset_top = 33.0 +offset_right = 159.0 +offset_bottom = 183.0 +fname = "ИП9-50" +rname = "A23" + [node name="lbl_fname" type="Label" parent="."] self_modulate = Color(1, 1, 1, 0.62) layout_mode = 0 -offset_left = 5.0 -offset_top = 5.0 -offset_right = 157.0 -offset_bottom = 30.0 +offset_left = 7.0 +offset_top = 8.0 +offset_right = 159.0 +offset_bottom = 33.0 text = "Кассета" horizontal_alignment = 1 vertical_alignment = 1 diff --git a/scenes/контроль/кассета-у-5-к.tscn b/scenes/контроль/кассета-у-5-к.tscn index b32a91c..31b4a3b 100644 --- a/scenes/контроль/кассета-у-5-к.tscn +++ b/scenes/контроль/кассета-у-5-к.tscn @@ -63,7 +63,7 @@ offset_top = 32.0 offset_right = 255.0 offset_bottom = 182.0 fname = "УКП" -rname = "A35" +rname = "A36" [node name="ref_A36" parent="." instance=ExtResource("3_wtlpi")] offset_left = 254.0 @@ -71,4 +71,4 @@ offset_top = 32.0 offset_right = 304.0 offset_bottom = 182.0 fname = "УКП" -rname = "A36" +rname = "A35" diff --git a/scenes/контроль/кассета.gd b/scenes/контроль/кассета.gd index fb83827..a91fc7a 100644 --- a/scenes/контроль/кассета.gd +++ b/scenes/контроль/кассета.gd @@ -9,7 +9,8 @@ extends NinePatchRect @export var fname: String: set(v): fname = v - $lbl_fname.text = v + if is_inside_tree(): + $lbl_fname.text = v @export var rname: String: diff --git a/scenes/настройки/GridContainer.gd b/scenes/настройки/GridContainer.gd new file mode 100644 index 0000000..41bed78 --- /dev/null +++ b/scenes/настройки/GridContainer.gd @@ -0,0 +1 @@ +extends "res://table/table.gd" diff --git a/scenes/настройки/нас1E59.tmp b/scenes/настройки/нас1E59.tmp new file mode 100644 index 0000000..4dd57e8 --- /dev/null +++ b/scenes/настройки/нас1E59.tmp @@ -0,0 +1,102 @@ +[gd_scene load_steps=4 format=3 uid="uid://bnptm4rlp60dq"] + +[ext_resource type="Script" path="res://scenes/настройки/настройки.gd" id="1_2l3rd"] +[ext_resource type="Script" path="res://table/table.gd" id="2_ts42i"] + +[sub_resource type="GDScript" id="GDScript_anjmx"] +script/source = "extends LineEdit + +func _ready() -> void: text = ProjectSettings.get('application/config/map_server_addr') + + +func _on_text_changed(new_text: String) -> void: + ProjectSettings.set('application/config/map_server_addr', new_text) + ProjectSettings.save_custom('override.cfg') +" + +[node name="Настройки" type="Panel"] +script = ExtResource("1_2l3rd") + +[node name="table" type="GridContainer" parent="."] +layout_mode = 2 +offset_left = 32.0 +offset_top = 96.0 +offset_right = 241.0 +offset_bottom = 535.0 +columns = 2 +script = ExtResource("2_ts42i") + +[node name="Label1" type="Label" parent="."] +layout_mode = 0 +offset_left = 16.0 +offset_top = 60.0 +offset_right = 434.0 +offset_bottom = 82.0 +text = "Управление элементами в режиме с ограниченным доступом" + +[node name="Label2" type="Label" parent="."] +layout_mode = 0 +offset_left = 16.0 +offset_top = 20.0 +offset_right = 476.0 +offset_bottom = 50.0 +text = "Текущий режим доступа: полный" +vertical_alignment = 1 + +[node name="edt_mapaddr" type="LineEdit" parent="."] +layout_mode = 0 +offset_left = 660.0 +offset_top = 80.0 +offset_right = 1032.0 +offset_bottom = 110.0 +script = SubResource("GDScript_anjmx") + +[node name="Label" type="Label" parent="edt_mapaddr"] +layout_mode = 0 +offset_left = -180.0 +offset_right = -20.0 +offset_bottom = 30.0 +text = "Адрес сервера карт:" +vertical_alignment = 1 + +[node name="GridContainer2" type="GridContainer" parent="."] +layout_mode = 0 +offset_left = 478.0 +offset_top = 154.0 +offset_right = 784.0 +offset_bottom = 260.0 +columns = 2 + +[node name="external_cu_lbl" type="Label" parent="GridContainer2"] +layout_mode = 2 +text = "Внешнее целеуказание." +vertical_alignment = 1 + +[node name="external_cu_btn" type="CheckButton" parent="GridContainer2"] +layout_mode = 2 + +[node name="Label19" type="Label" parent="GridContainer2"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Кнопка «Подавление». +Отключить отображение этой кнопки, +что бы тип помех применялся сразу." + +[node name="CheckButton18" type="CheckButton" parent="GridContainer2"] +layout_mode = 2 +size_flags_horizontal = 6 +size_flags_vertical = 6 +button_pressed = true + +[node name="lbl_commit" type="Label" parent="."] +layout_mode = 0 +offset_left = 480.0 +offset_top = 20.0 +offset_right = 1040.0 +offset_bottom = 50.0 +text = "Текущая версия ПО УАРЭП:" +vertical_alignment = 1 + +[connection signal="text_changed" from="edt_mapaddr" to="edt_mapaddr" method="_on_text_changed"] +[connection signal="pressed" from="GridContainer2/external_cu_btn" to="." method="_on_external_cu_btn_pressed"] diff --git a/scenes/работа/CharacterBody2D.gd b/scenes/работа/CharacterBody2D.gd new file mode 100644 index 0000000..087beec --- /dev/null +++ b/scenes/работа/CharacterBody2D.gd @@ -0,0 +1,28 @@ +class_name characterBody extends CharacterBody2D + + +const SPEED = 300.0 +const JUMP_VELOCITY = -400.0 + +## Получить гравитацию из настроек проекта для синхронизации с узлами RigidBody. +var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") + + +func _physics_process(delta): + # Add the gravity. + if not is_on_floor(): + velocity.y += gravity * delta + + # Handle jump. + if Input.is_action_just_pressed("ui_accept") and is_on_floor(): + velocity.y = JUMP_VELOCITY + + # Get the input direction and handle the movement/deceleration. + # As good practice, you should replace UI actions with custom gameplay actions. + var direction = Input.get_axis("ui_left", "ui_right") + if direction: + velocity.x = direction * SPEED + else: + velocity.x = move_toward(velocity.x, 0, SPEED) + + move_and_slide() diff --git a/scenes/работа/работа.gd b/scenes/работа/работа.gd index d439ea0..c734647 100644 --- a/scenes/работа/работа.gd +++ b/scenes/работа/работа.gd @@ -66,13 +66,13 @@ const fs_sectors: Dictionary = { 1: [270.0, 360.0] } const fs_freq: Dictionary = { - 0: [400.0, 1200.0], - 1: [1200.0, 2000.0], - 2: [2000.0, 2800.0], - 3: [2800.0, 3600.0], - 4: [3600.0, 4400.0], - 5: [4400.0, 5200.0], - 6: [5200.0, 6000.0] } + 0: [370.0, 800.0, 200.0, 250.0], + 1: [800.0, 1065.0, 250.0, 300.0], + 2: [1065.0, 1180.0, 300.0, 350.0], + 3: [1180.0, 1450.0, 350.0, 400.0], + 4: [1450.0, 2000.0, 400.0, 450.0], + 5: [2000.0, 3500.0, 450.0, 500.0], + 6: [3500.0, 6000.0, 500.0, 550.0] } ## Размеры карты для разных режимов РТО и РЛС соответственно @@ -82,7 +82,6 @@ const map_sizes = [ var fs_band = fs_band_rto ## Текущий режим блоков ФС по частоте var fs_selected: Dictionary ## Словарь выбранных секторов var fs_active: Dictionary ## Словарь секторов назначенных на подавление - ## Состояние перетаскивания. enum DragFSM { DRAG, ## В процессе. @@ -159,6 +158,7 @@ func _ready(): signaller.connect('interfer_off_all', Callable(self, 'on_interfer_off_all')) signaller.connect('fs_selected', Callable(self, 'on_fs_selected')) interfer.connect('interfer_update', Callable(self, 'on_interfer_new')) + signaller.connect('fs_update_color', Callable(self, 'on_fs_update_color')) func get_all_nodes(root): @@ -171,14 +171,28 @@ func get_all_nodes(root): ## Производит отображение цели на диаграмму. func map_threat_to_bip(th: threats.Threat, bip: Control): - bip.position = tools.pos_calc( - th.freq, - th.aoa, - radius_center, - radius_internal, - radius_outter, - freq_low, - freq_high) - bip.size / 2 + var freq = th.freq + var sector_key = null + var sector_width = 50.0 + for key in fs_freq: + var freq_range = fs_freq[key] + var num_values = (freq_range[1]- freq_range[0]) / sector_width + if freq_range[0] <= freq and freq <= freq_range[1]: + sector_key = key + break + if sector_key!= null: + radius_internal = fs_freq[sector_key][2] + radius_outter = fs_freq[sector_key][3] + freq_low = fs_freq[sector_key][0] + freq_high = fs_freq[sector_key][1] + bip.position = tools.pos_calc( + th.freq, + th.aoa, + radius_center, + radius_internal, + radius_outter, + freq_low, + freq_high) - bip.size / 2 ## Обработчик сигнала обновления цели. @@ -191,10 +205,10 @@ func on_threat_update(th): ## Обработчик выбора помехи для цели. func on_interfer_new(ecm): if interfer.thrs.has(ecm.ispp): - if interfer.thrs.has(ecm.ispp): - var th_id = interfer.thrs[ecm.ispp] - var bip = get_node('%d' % th_id) - if ecm.krp != interfer.INTERFER_OFF: + var th_id = interfer.thrs[ecm.ispp] + var bip = get_node('%d' % th_id) + if bip!= null: + if ecm.krp!= interfer.INTERFER_OFF: bip.set_track_visible(true) if ecm.svk == 1: bip.set_ecm_visible(true) @@ -202,6 +216,10 @@ func on_interfer_new(ecm): else: bip.set_ecm_visible(false) bip.set_track_visible(false) + else: + interfer.thrs.erase(ecm.ispp) + set_fs_color(ecm) + update_fs_colors() set_fs_color(ecm) @@ -215,6 +233,13 @@ func on_interfer_off_all(): update_fs_colors() +func on_interfer_off(ecm_id): + fs_active.erase(ecm_id) + fs_selected.erase(ecm_id) + fs_active.clear() + update_fs_colors() + + ## Обработчик сигнала обнаружения цели. func on_threat_new(th) -> void: var bip = Bip.instantiate() @@ -474,3 +499,9 @@ func set_btns_disabled(value: bool, btn): btn.set_disabled(true) else: btn.set_disabled(value) + +func on_fs_update_color(ecms): + fs_active.clear() + for ecm in ecms.values(): + set_fs_color(ecm) + update_fs_colors() diff --git a/scenes/работа/работа.tscn b/scenes/работа/работа.tscn index 357d0d0..c775be4 100644 --- a/scenes/работа/работа.tscn +++ b/scenes/работа/работа.tscn @@ -21,10 +21,10 @@ col_red = Color(1, 0.568627, 0.431373, 0.239216) drag_scale_band = 0.05 drag_scale_width = 0.5 freq_high = 6000.0 -freq_low = 400.0 +freq_low = 370.0 radius_center = Vector2(560, 560) radius_internal = 200.0 -radius_outter = 350.0 +radius_outter = 200.0 strob_max_band = 15.538 strob_max_width = 90.0 strob_min_band = 0.1 diff --git a/scenes/эмс/кнопка-эмс.gd b/scenes/эмс/кнопка-эмс.gd index e8aa9c4..37bcaf7 100644 --- a/scenes/эмс/кнопка-эмс.gd +++ b/scenes/эмс/кнопка-эмс.gd @@ -4,28 +4,28 @@ extends PanelContainer @export var texture_state0: Texture2D = preload('res://data/кнопка-эмс-1.png'): - set(val): $state.set_texture(val) + set(val): $state.set_texture(val) @export var texture_state1: Texture2D = preload('res://data/кнопка-эмс-0.png'): - set(val): $state.set_texture(val) + set(val): $state.set_texture(val) @export var text: String = '': - set(val): $button.set_text(val) - get: return $button.get_text() + set(val): $button.set_text(val) + get: return $button.get_text() @export var pressed: bool = false: - set(val): $button.set_pressed(val) - get: return $button.is_pressed() + set(val): $button.set_pressed(val) + get: return $button.is_pressed() @export var toggle_mode: bool = false: - set(val): - if is_inside_tree(): - $button.set_toggle_mode(val) - get: return $button.is_toggle_mode() + set(val): + if is_inside_tree(): + $button.set_toggle_mode(val) + get: return $button.is_toggle_mode() func set_text (val: String): $button.set_text(val) @@ -33,8 +33,8 @@ func set_pressed (val: bool): $button.set_pressed(val) func set_toggle_mode (val: bool): - if is_inside_tree(): - $button.set_toggle_mode(val) + if is_inside_tree(): + $button.set_toggle_mode(val) func get_text(): return $button.get_text() @@ -43,13 +43,13 @@ func is_toggle_mode(): return $button.is_toggle_mode() func _on_button_toggled(val: bool): - if val: $state.set_texture(texture_state1) - else: $state.set_texture(texture_state0) + if val: $state.set_texture(texture_state1) + else: $state.set_texture(texture_state0) func button_connect(button_signal: String, proc: Callable): - $button.connect(button_signal, proc) + $button.connect(button_signal, proc) func _on_button_mouse_entered(): - emit_signal("mouse_entered") + emit_signal("mouse_entered") diff --git a/scripts/interfer.gd b/scripts/interfer.gd index 63208d8..834d47c 100644 --- a/scripts/interfer.gd +++ b/scripts/interfer.gd @@ -112,6 +112,9 @@ func _ready(): signaller.connect('interfer_rcv', Callable(self, 'on_interfer_rcv').bind(unit_5p28, ecms)) signaller.connect('interfer_new', Callable(self, 'send_ecm').bind(unit)) signaller.connect('interfer_off_all', Callable(self, 'on_interfer_off_all').bind(unit, ecms)) + signaller.connect('th_aoa_update', Callable(self, 'on_th_aoa_update').bind(ecms, unit)) + signaller.connect('interfer_off', Callable(self, 'on_interfer_off')) + threats.connect('threat_lost', Callable(self, 'on_threats_lost').bind(ecms, unit)) ## Проверяет состояние отправки пакета и если не доставлен, повторяет отправку. @@ -124,6 +127,18 @@ func on_timer_check_state(unit, ecms, resend_timeout): ecm.tick_tx = tick +func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit): + for thr in threats.values(): + var th_id = thr.id + for ecm_i in thrs.keys(): + if thrs[ecm_i] == th_id: + var ecm = ecms[ecm_i] + ecm.params['freq'] = thr.freq + ecm.kni = thr.aoa + send_ecm(ecm, unit) + signaller.emit_signal('fs_update_color', ecms) + + ## Производит приём состояния помех. [param unit] -> [param ecms]. func on_data_capsrpb_received(unit: capsrpb.CapsRpb, ecms: Dictionary): if not unit.json_dic.has('ts'): return @@ -248,6 +263,16 @@ func on_interfer_off_all(unit, ecms): send_ecm(ecm, unit) signaller.emit_signal('interfer_off',ecm, ecms, thrs) +func on_threats_lost(th, ecms, unit): + for key in interfer.thrs: + if interfer.thrs[key] == th.id: + var ecm_id = key + var ecm = ecms[ecm_id] + ecm.krp = INTERFER_OFF + push_id(ecm.ispp) + send_ecm(ecm, unit) + signaller.emit_signal('interfer_off',ecm, ecms, thrs) + func pop_id(): var id = 0 diff --git a/scripts/network.gd b/scripts/network.gd index cdcacc8..a5143ae 100644 --- a/scripts/network.gd +++ b/scripts/network.gd @@ -1,3 +1,4 @@ +@tool class_name rep_network extends Node diff --git a/scripts/settings.gd b/scripts/settings.gd index 26b4a9a..5e9ac36 100644 --- a/scripts/settings.gd +++ b/scripts/settings.gd @@ -1,3 +1,4 @@ +@tool class_name rep_settings extends Node ## Параметры. diff --git a/scripts/signaller.gd b/scripts/signaller.gd index e640896..8a9a874 100644 --- a/scripts/signaller.gd +++ b/scripts/signaller.gd @@ -137,3 +137,8 @@ signal map_coords_changed(lan: float, lat: float) ## Вызывается при изменении размера изображения для отображения карты.[br] ## [param mode] - Вновь установленный режим. signal map_mode_changed(mode: int) + +## Вызывается при обновлении позиции(угла) цели.[br] +signal th_aoa_update(threats: Dictionary) + +signal fs_update_color(ecms:Dictionary) diff --git a/scripts/threats.gd b/scripts/threats.gd index 00ebf11..6ee893f 100644 --- a/scripts/threats.gd +++ b/scripts/threats.gd @@ -51,11 +51,15 @@ func _ready() -> void: var unit_5p28_key = repsettings.get_unit_key('уарэп-5п28') var unit_5p28 = repnetwork.units_tcp[unit_5p28_key] var timer_check_lost: = Timer.new() + var timer_aoa_update: = Timer.new() add_child(timer_check_lost) + add_child(timer_aoa_update) unit.connect('data_received', Callable(self, 'on_data_capsrpb_received').bind(threats)) unit_5p28.connect('get_threats', Callable(self, 'on_get_threats').bind(unit_5p28, threats)) timer_check_lost.connect('timeout', Callable(self, 'on_timer_check_lost').bind(repsettings.ThreatParams.time_lost, threats)) timer_check_lost.start(repsettings.ThreatParams.time_lost / 1000.0) + timer_aoa_update.connect('timeout', Callable(self, 'on_timer_aoa_update').bind(threats)) + timer_aoa_update.start(0.25) signaller.connect('rto_threat_sel', Callable(self, 'on_rto_threat_sel').bind(threats)) signaller.connect('rto_threat_unsel', Callable(self, 'on_rto_threat_unsel').bind(threats)) signaller.connect('rto_threat_unsel_all', Callable(self, 'on_rto_threat_unsel_all').bind(threats)) @@ -74,10 +78,12 @@ func on_timer_check_lost(time_lost: int, threats: Dictionary): call_deferred('emit_signal', 'threats_resized', threats) +func on_timer_aoa_update(threats:Dictionary): + signaller.emit_signal('th_aoa_update', threats) + ## отправляет словарь целей в юнит, для запаковки и отправки в 5П28. func on_get_threats(unit, threats): unit.pack_threats(threats) - ## Снимает выделение с цели, если нажать по отметке цели. func on_rto_threat_unsel(th_id, threats): threats[th_id].selected = false diff --git a/scripts/tools.gd b/scripts/tools.gd index d19a303..beeee06 100644 --- a/scripts/tools.gd +++ b/scripts/tools.gd @@ -72,8 +72,9 @@ func get_string_slice(s_in: String, s_out: Array, i0: int, i1: int): ## Производит преобразование из декартовой в полярную систему координат. func pos_calc(freq: float, aoa: float, pos0: Vector2, r0: float, r1: float, f0: float, f1: float): - var r = ((freq - f0) / (f1 - f0)) * r1 + r0 + var r = remap(freq, f0, f1, r0, r1) var aoa_rad = radians(aoa) - PI / 2.0 + return Vector2(cos(aoa_rad), sin(aoa_rad)) * r + pos0 diff --git a/scripts/yems-boards.gd b/scripts/yems-boards.gd index 8e14f3d..1c5edb1 100644 --- a/scripts/yems-boards.gd +++ b/scripts/yems-boards.gd @@ -1,15 +1,15 @@ class_name yems_boards extends Node class EmsBoard: - var id_board: String - var in_devs: Dictionary ## Словарь с входными устройствами. - var out_devs: Dictionary ## Словарь с выходными устройствами. - var base_addr_isa: int ## Базовый адрес ячейки isa. - var in_tbl: Array - var out_tbl: Array + var id_board: String + var in_devs: Dictionary ## Словарь с входными устройствами. + var out_devs: Dictionary ## Словарь с выходными устройствами. + var base_addr_isa: int ## Базовый адрес ячейки isa. + var in_tbl: Array + var out_tbl: Array - func _init(id, base_addr, in_table, out_table): - id_board = id - in_tbl = in_table - out_tbl = out_table - base_addr_isa = base_addr + func _init(id, base_addr, in_table, out_table): + id_board = id + in_tbl = in_table + out_tbl = out_table + base_addr_isa = base_addr diff --git a/table/editl.tscn b/table/editl.tscn new file mode 100644 index 0000000..3a9aa78 --- /dev/null +++ b/table/editl.tscn @@ -0,0 +1,5 @@ +[gd_scene format=3 uid="uid://bvbvtgwps54yr"] + +[node name="Editl" type="LineEdit"] +caret_blink = true +caret_blink_interval = 0.5 diff --git a/table/empti.tscn b/table/empti.tscn new file mode 100644 index 0000000..25fa862 --- /dev/null +++ b/table/empti.tscn @@ -0,0 +1,5 @@ +[gd_scene format=3 uid="uid://bwesvho0mk6qk"] + +[node name="Empti" type="Label"] +offset_right = 48.0 +offset_bottom = 19.0 diff --git a/table/lable.tscn b/table/lable.tscn new file mode 100644 index 0000000..ad4e6fb --- /dev/null +++ b/table/lable.tscn @@ -0,0 +1,16 @@ +[gd_scene load_steps=2 format=3 uid="uid://dwphmxstaxn4v"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yign5"] +bg_color = Color(0.117647, 0.117647, 0.117647, 0.85098) +border_width_bottom = 2 +border_color = Color(0.0562916, 0.0562916, 0.0562916, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 5 + +[node name="Lable" type="Label"] +offset_right = 104.0 +offset_bottom = 24.0 +theme_override_colors/font_color = Color(1, 0.596078, 0.4, 1) +theme_override_styles/normal = SubResource("StyleBoxFlat_yign5") diff --git a/table/taggle.tscn b/table/taggle.tscn new file mode 100644 index 0000000..823de94 --- /dev/null +++ b/table/taggle.tscn @@ -0,0 +1,13 @@ +[gd_scene format=3 uid="uid://dm7hh7ibuin78"] + +[node name="Control" type="Control"] +layout_mode = 3 +anchors_preset = 0 +offset_right = 96.0 +offset_bottom = 24.0 + +[node name="CheckButton" type="CheckButton" parent="."] +layout_mode = 0 +offset_left = 30.0 +offset_right = 74.0 +offset_bottom = 24.0