diff --git a/data/navi-center-0.png b/data/navi-center-0.png new file mode 100644 index 00000000..26310f3b Binary files /dev/null and b/data/navi-center-0.png differ diff --git a/data/navi-center-0.png.import b/data/navi-center-0.png.import new file mode 100644 index 00000000..fa7f019f --- /dev/null +++ b/data/navi-center-0.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://0sk43ticjaxk" +path="res://.godot/imported/navi-center-0.png-02d34317f6221b4e6c30f22dca21f6a5.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://data/navi-center-0.png" +dest_files=["res://.godot/imported/navi-center-0.png-02d34317f6221b4e6c30f22dca21f6a5.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/data/navi-center-1.png b/data/navi-center-1.png new file mode 100644 index 00000000..dc7008c7 Binary files /dev/null and b/data/navi-center-1.png differ diff --git a/data/navi-center-1.png.import b/data/navi-center-1.png.import new file mode 100644 index 00000000..101b7a49 --- /dev/null +++ b/data/navi-center-1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bk4ssfho1murp" +path="res://.godot/imported/navi-center-1.png-20b61a3832e74b7df9a0a6227e5328d7.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://data/navi-center-1.png" +dest_files=["res://.godot/imported/navi-center-1.png-20b61a3832e74b7df9a0a6227e5328d7.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/scenes/tilemap/tilemap.gd b/scenes/tilemap/tilemap.gd index 4e0a5536..8e1f1e79 100644 --- a/scenes/tilemap/tilemap.gd +++ b/scenes/tilemap/tilemap.gd @@ -102,6 +102,14 @@ func _ready(): $canvas.connect('mouse_exited', func(): _rollover = false) _on_resize() image_type = 'png' + var key = settings.get_unit_key('навигация') + var unit_nav = network.units[key] + unit_nav.connect('data_received', on_data_received) + + +func on_data_received(coords: Dictionary): + if coords.has_all(['latitude', 'longitude']): + set_coordinates(coords['longitude'], coords['latitude']) func _on_resize() -> void: diff --git a/scenes/работа/работа.gd b/scenes/работа/работа.gd index f072984a..c127a890 100644 --- a/scenes/работа/работа.gd +++ b/scenes/работа/работа.gd @@ -131,6 +131,9 @@ func _ready(): interfer.connect('interfer_update', Callable(self, 'on_interfer_new')) signaller.connect('interfer_prinuditelno', Callable(self, 'on_chk_interfer_prinuditelno')) signaller.connect('fs_update_state', Callable(self, 'on_fs_update_state')) + on_btn_center_toggled(false) + on_btn_activate_toggled(false) + func on_chk_interfer_prinuditelno(_interfer_sectors): $chk_auto.set_pressed_no_signal(false) @@ -508,5 +511,13 @@ func on_interfer_prinuditelno (prenuditelno_sectors, btns): ## Вызывается при получении информации о состоянии модулей ФС от КАПС РПБ. -func on_fs_update_state(fs_dict: Dictionary): +func on_fs_update_state(_fs_dict: Dictionary): pass + + +func on_btn_center_toggled(toggled_on: bool) -> void: + $btn_center.tooltip_text = 'Центрирует карту на текущие координаты (%s)' % ('включено' if toggled_on else 'отключено') + + +func on_btn_activate_toggled(toggled_on: bool) -> void: + $btn_activate.tooltip_text = 'Включает падавление (%s)' % ('включено' if toggled_on else 'отключено') diff --git a/scenes/работа/работа.tscn b/scenes/работа/работа.tscn index cfd6547e..2ee5b4b1 100644 --- a/scenes/работа/работа.tscn +++ b/scenes/работа/работа.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=13 format=3 uid="uid://b276iygic5itk"] +[gd_scene load_steps=15 format=3 uid="uid://b276iygic5itk"] [ext_resource type="Script" uid="uid://daudc0s3oox3i" path="res://scenes/работа/работа.gd" id="1_niok4"] [ext_resource type="PackedScene" uid="uid://nl1vklubr5kr" path="res://scenes/bip/bip.tscn" id="2_br3s6"] @@ -11,6 +11,8 @@ [ext_resource type="PackedScene" uid="uid://ceknxxfu1loo5" path="res://scenes/tilemap/tilemap.tscn" id="10_gtwyg"] [ext_resource type="PackedScene" uid="uid://b5kjdyxuwsot5" path="res://scenes/diagram/diagram.tscn" id="11_b6su4"] [ext_resource type="Texture2D" uid="uid://csdw3q5dtvu4w" path="res://data/power-1.png" id="11_xp4y6"] +[ext_resource type="Texture2D" uid="uid://0sk43ticjaxk" path="res://data/navi-center-0.png" id="12_5ffal"] +[ext_resource type="Texture2D" uid="uid://bk4ssfho1murp" path="res://data/navi-center-1.png" id="13_ggrwd"] [sub_resource type="Gradient" id="Gradient_cnr1s"] offsets = PackedFloat32Array(0.181818, 0.751623) @@ -228,8 +230,22 @@ text = "Подавление" horizontal_alignment = 1 vertical_alignment = 1 +[node name="btn_center" type="TextureButton" parent="."] +layout_mode = 0 +offset_left = 898.0 +offset_top = 1005.0 +offset_right = 1030.0 +offset_bottom = 1121.0 +scale = Vector2(0.5, 0.5) +toggle_mode = true +button_pressed = true +texture_normal = ExtResource("12_5ffal") +texture_pressed = ExtResource("13_ggrwd") + [connection signal="drag_begin" from="." to="." method="_on_drag_begin"] [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_toggled"] [connection signal="toggled" from="btn_activate" to="." method="on_btn_activate"] +[connection signal="toggled" from="btn_center" to="." method="on_btn_center_toggled"] diff --git a/scripts/navigation.gd b/scripts/navigation.gd index 3e9a198b..01c6d61d 100644 --- a/scripts/navigation.gd +++ b/scripts/navigation.gd @@ -25,7 +25,7 @@ class NaviSource extends unit.Unit: if not online: online = true emit_signal('line_changed', self) - if rx_data.size() < 28: + if rx_data.size() < 26: emit_signal('parse_failed', self) return false var flags: = rx_data.decode_u16(24)