diff --git a/scenes/tilemap/Control.gd b/scenes/tilemap/Control.gd new file mode 100644 index 00000000..4b5c358f --- /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 00000000..a2178f3b --- /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/настройки/GridContainer.gd b/scenes/настройки/GridContainer.gd new file mode 100644 index 00000000..41bed780 --- /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 00000000..4dd57e8a --- /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 00000000..087beec2 --- /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 d439ea00..84bc34f3 100644 --- a/scenes/работа/работа.gd +++ b/scenes/работа/работа.gd @@ -159,6 +159,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): @@ -186,15 +187,15 @@ func on_threat_update(th): var bip = get_node('%d' % th.id) bip.update() map_threat_to_bip(th, bip) - + ## Обработчик выбора помехи для цели. 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 +203,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) @@ -213,6 +218,13 @@ func on_interfer_off_all(): bip.set_track_visible(false) fs_active.clear() 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() ## Обработчик сигнала обнаружения цели. @@ -229,7 +241,6 @@ func on_threat_lost(th) -> void: remove_child(bip) bip.free() - ## обработчик нажатия на цель на экране. func on_bip_pressed(th_id, _ecm_btns): if btn_select == BtnSel.THREAT: @@ -419,7 +430,6 @@ func update_fs_colors(): fs_colors[key] = color_select $canvas.set_band_colors(fs_colors) - func unsel_fs_all(need_btns_off: bool): fs_selected.clear() update_fs_colors() @@ -474,3 +484,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/scripts/interfer.gd b/scripts/interfer.gd index 63208d84..672e2c57 100644 --- a/scripts/interfer.gd +++ b/scripts/interfer.gd @@ -112,7 +112,10 @@ 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)) + ## Проверяет состояние отправки пакета и если не доставлен, повторяет отправку. func on_timer_check_state(unit, ecms, resend_timeout): @@ -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 @@ -247,6 +262,16 @@ func on_interfer_off_all(unit, ecms): push_id(ecm.ispp) 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(): diff --git a/scripts/signaller.gd b/scripts/signaller.gd index e6408961..8a9a874b 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 00ebf117..d991962c 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)) @@ -72,12 +76,14 @@ func on_timer_check_lost(time_lost: int, threats: Dictionary): call_deferred('emit_signal', 'threat_lost', th) if sz != threats.size(): 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/table/editl.tscn b/table/editl.tscn new file mode 100644 index 00000000..3a9aa788 --- /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 00000000..25fa862c --- /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 00000000..ad4e6fb7 --- /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 00000000..823de949 --- /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