diff --git a/scenes/count-danger/count_danger_pad.tscn b/scenes/count-danger/count_danger_pad.tscn index 03b5559..8f4dd4e 100644 --- a/scenes/count-danger/count_danger_pad.tscn +++ b/scenes/count-danger/count_danger_pad.tscn @@ -13,7 +13,7 @@ horizontal_alignment = 1 vertical_alignment = 1 [node name="count_danger" type="Label" parent="."] -modulate = Color(0.8, 0.533333, 0.27451, 1) +modulate = Color(0.890196, 0.486275, 0.196078, 1) layout_mode = 0 offset_right = 92.0 offset_bottom = 63.0 diff --git a/scenes/pribor-uyep/sch3-view.gd b/scenes/pribor-uyep/sch3-view.gd index 59891f3..c3cc215 100644 --- a/scenes/pribor-uyep/sch3-view.gd +++ b/scenes/pribor-uyep/sch3-view.gd @@ -36,7 +36,7 @@ func on_line_changed_sch3(unit_sch3): regs_input.clear() switches_sync = false $margin/vbox/grid1/lbl_freq.text = '<нет данных>' - $margin/vbox/grid1/lbl_freq.self_modulate = Color.CADET_BLUE + $margin/vbox/grid1/lbl_freq.self_modulate = Color(settings.C_BLUE) $margin/vbox/grid1/state_freq.texture = textures[STATE_VAL.NONE] $margin/vbox/grid/state.texture = textures[STATE_VAL.NONE] diff --git a/scenes/tabs-switch/tab-switch.tscn b/scenes/tabs-switch/tab-switch.tscn index b534326..44dafe7 100644 --- a/scenes/tabs-switch/tab-switch.tscn +++ b/scenes/tabs-switch/tab-switch.tscn @@ -28,22 +28,23 @@ theme_override_styles/panel = SubResource("StyleBoxEmpty_tidwt") [node name="tab_switch" type="TabContainer" parent="."] layout_mode = 0 +offset_top = 23.0 offset_right = 1600.0 -offset_bottom = 1200.0 +offset_bottom = 1223.0 tooltip_text = "Переключает режимы работы программы" theme_override_styles/tab_focus = SubResource("StyleBoxEmpty_41d34") theme_override_styles/tab_disabled = SubResource("StyleBoxEmpty_cw2ss") theme_override_styles/tabbar_background = SubResource("StyleBoxEmpty_nmdfd") theme_override_styles/panel = SubResource("StyleBoxEmpty_vap7n") -current_tab = 0 +current_tab = 1 script = ExtResource("1_fg0vd") [node name="Работа" parent="tab_switch" instance=ExtResource("2_u7p16")] +visible = false layout_mode = 2 metadata/_tab_index = 0 [node name="Контроль" parent="tab_switch" instance=ExtResource("3_txp0s")] -visible = false layout_mode = 2 metadata/_tab_index = 1 diff --git a/scenes/tilemap/ship.png b/scenes/tilemap/ship.png new file mode 100644 index 0000000..25e3830 Binary files /dev/null and b/scenes/tilemap/ship.png differ diff --git a/scenes/tilemap/ship.png.import b/scenes/tilemap/ship.png.import new file mode 100644 index 0000000..e7819c4 --- /dev/null +++ b/scenes/tilemap/ship.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bry3qqgbuvpdt" +path="res://.godot/imported/ship.png-1e5b46229cc4c1adf618fcb5da01fb4c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/tilemap/ship.png" +dest_files=["res://.godot/imported/ship.png-1e5b46229cc4c1adf618fcb5da01fb4c.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/ship1.png b/scenes/tilemap/ship1.png new file mode 100644 index 0000000..e2057b1 Binary files /dev/null and b/scenes/tilemap/ship1.png differ diff --git a/scenes/tilemap/ship1.png.import b/scenes/tilemap/ship1.png.import new file mode 100644 index 0000000..850c04e --- /dev/null +++ b/scenes/tilemap/ship1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dct2op842kyxo" +path="res://.godot/imported/ship1.png-fb0d0fe319583fdccb34710f90651bfb.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/tilemap/ship1.png" +dest_files=["res://.godot/imported/ship1.png-fb0d0fe319583fdccb34710f90651bfb.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/ship2.png b/scenes/tilemap/ship2.png new file mode 100644 index 0000000..74acd04 Binary files /dev/null and b/scenes/tilemap/ship2.png differ diff --git a/scenes/tilemap/ship2.png.import b/scenes/tilemap/ship2.png.import new file mode 100644 index 0000000..cb7b68f --- /dev/null +++ b/scenes/tilemap/ship2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b3i0dm4vk3fvu" +path="res://.godot/imported/ship2.png-dfba13504c314fdc4446dacd0ce91bc5.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/tilemap/ship2.png" +dest_files=["res://.godot/imported/ship2.png-dfba13504c314fdc4446dacd0ce91bc5.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/ship_mark.tscn b/scenes/tilemap/ship_mark.tscn new file mode 100644 index 0000000..580f3a0 --- /dev/null +++ b/scenes/tilemap/ship_mark.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=2 format=3 uid="uid://c2523fcn14gn4"] + +[ext_resource type="Texture2D" uid="uid://b3i0dm4vk3fvu" path="res://scenes/tilemap/ship2.png" id="1_o15fj"] + +[node name="Ship_mark" type="Sprite2D"] +position = Vector2(2.38419e-07, -1.19209e-07) +scale = Vector2(0.496428, 0.496429) +texture = ExtResource("1_o15fj") diff --git a/scenes/tilemap/threat.png b/scenes/tilemap/threat.png new file mode 100644 index 0000000..bfa952e Binary files /dev/null and b/scenes/tilemap/threat.png differ diff --git a/scenes/tilemap/threat.png.import b/scenes/tilemap/threat.png.import new file mode 100644 index 0000000..9d8f51c --- /dev/null +++ b/scenes/tilemap/threat.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://mobingoxskg1" +path="res://.godot/imported/threat.png-602b9c318dc5f1342d23490e047ca526.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/tilemap/threat.png" +dest_files=["res://.godot/imported/threat.png-602b9c318dc5f1342d23490e047ca526.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/threat.tscn b/scenes/tilemap/threat.tscn new file mode 100644 index 0000000..e430ebc --- /dev/null +++ b/scenes/tilemap/threat.tscn @@ -0,0 +1,9 @@ +[gd_scene load_steps=2 format=3 uid="uid://cv342kc1jj5hb"] + +[ext_resource type="Texture2D" uid="uid://mobingoxskg1" path="res://scenes/tilemap/threat.png" id="1_pvxsy"] + +[node name="Threat" type="Node2D"] + +[node name="Threat" type="Sprite2D" parent="."] +scale = Vector2(0.171358, 0.171358) +texture = ExtResource("1_pvxsy") diff --git a/scenes/tilemap/tilemap.gd b/scenes/tilemap/tilemap.gd index 4e4ec18..3814051 100644 --- a/scenes/tilemap/tilemap.gd +++ b/scenes/tilemap/tilemap.gd @@ -22,10 +22,17 @@ class_name MercatorTileMap @export_range(0, 20, 1) var min_zoom_level: int = 0 @export_range(0, 20, 1) var max_zoom_level_server: int = 20 @export_color_no_alpha() var back_color: = Color.BLACK +@onready var scale_label: String +@onready var coordinates_label: String +@onready var threat_mark: PackedScene = load("res://scenes/tilemap/threat.tscn") +@onready var ship_mark: PackedScene = load("res://scenes/tilemap/ship_mark.tscn") +var ship_id := 9999 +var ship_instance: Node2D = null const default_size: = 400.0 var is_centered: = false var is_out_border1: = true var is_out_border2: = true +var threat_markers := {} @export var animation_time: float = 0.1: set(val): @@ -94,6 +101,7 @@ signal map_server_online() ## Вызывается при отсутствии ответа от сервера карт signal map_server_offline() + const image_load_proc_names = { 'png': 'load_png_from_buffer', 'jpg': 'load_jpg_from_buffer', @@ -131,6 +139,9 @@ func _ready() -> void: var unit_nav = network.units[key] unit_nav.connect('data_received', on_data_received) ProjectSettings.connect('settings_changed', _settings_changed) + threats.connect('threat_new', Callable(self, '_on_threat_new')) + threats.connect('threat_lost', Callable(self, '_on_threat_lost')) + threats.connect('threat_update', Callable(self, '_on_threat_update')) func _settings_changed(): @@ -150,7 +161,7 @@ func _on_resize() -> void: $canvas/spr_mask.scale = $canvas.size / default_size -## Создаёт новую отметку из координат экрана +## Создаёт новую отметку из координат экранаa func add_mark_from_screen_pos(id: int, scr_xy: Vector2, mark: Node) -> bool: if _marks.has(id): return false @@ -238,6 +249,7 @@ func _input(e) -> void: func multiply_zoom(multiplier: float, pivot: Vector2) -> void: var p1: = screen_to_world(_xyz, pivot) _xyz.z = clampf(_xyz.z * multiplier, min_zoom_level, max_zoom_level) + update_scale_label() var p2: = screen_to_world(_xyz, pivot) _xyz.x -= p2.x - p1.x _xyz.y -= p2.y - p1.y @@ -279,6 +291,7 @@ func _draw() -> void: var scr_pos = world_to_screen(dot.position) scr_pos.x = posmod(scr_pos.x, dx) dot.mark.position = scr_pos + dot.mark.visible = is_mark_visible(dot) dot.mark.visible = c.distance_to(scr_pos) < (r - dot.gap_size) visible_marks_count += int(dot.mark.visible) # Рисование границ @@ -349,6 +362,8 @@ func _process(delta) -> void: push_error('запрос \"%s\" не отправлен' % tile.url) if _queue.is_empty(): emit_signal('load_completed') + + update_scale_label() func _response(result, code, _headers: Array, body: PackedByteArray, req, tile: Tile) -> void: @@ -552,8 +567,9 @@ func get_tile(x: int, y: int, z: int) -> Tile: var req = get_node_or_null(NodePath(str(idx))) if req: tile = req.get_meta('tile') - tile.t = now - return tile + if tile != null: + tile.t = now + return tile tile = _cache.get(idx) if tile: @@ -670,8 +686,49 @@ func set_coordinates(lon: float, lat: float) -> void: anim.track_insert_key(0, animation_time, new_pos.x) anim.track_insert_key(1, animation_time, new_pos.y) $player.play('goto') + update_coordinates_label(lon, lat) + if not _marks.has(ship_id): + ship_instance = ship_mark.instantiate() + add_mark_from_lon_lat(ship_id, lon, lat, ship_instance, 0.0) + else: + _marks[ship_id].position = lonlat_to_world(lon, lat) func blend_mask(val: bool) -> void: $canvas/spr_mask.visible = val queue_redraw() + + +func update_coordinates_label(lon: float, lat: float) -> void: + coordinates_label = "Координаты:\nNS:%f\nEW: %f" % [lat, lon] + signaller.emit_signal('update_coordinates_map', coordinates_label) + + +func update_scale_label() -> void: + scale_label = "Масштаб: " + str(round(_xyz.z)) + signaller.emit_signal('update_scale_map', scale_label) + + +func _on_threat_new(th) -> void: + var bip_instance = threat_mark.instantiate() + if bip_instance: + bip_instance.name = str(th.id) + bip_instance.position = lonlat_to_world(th.lon, th.lat) + add_mark_from_lon_lat(th.id, th.lon, th.lat, bip_instance, 32) + + +func _on_threat_update(th) -> void: + var target = get_parent().get_node(str(th.id)) + if not target: + return + var new_position = lonlat_to_world(th.lon, th.lat) + if _marks.has(th.id): + _marks[th.id].position = new_position + if new_position != target.position: + target.position = new_position + + +func _on_threat_lost(th) -> void: + var target = get_parent().get_node(str(th.id)) + if target: + target.queue_free() diff --git a/scenes/tilemap/tilemap.tscn b/scenes/tilemap/tilemap.tscn index 40e8eb5..aee2951 100644 --- a/scenes/tilemap/tilemap.tscn +++ b/scenes/tilemap/tilemap.tscn @@ -28,8 +28,6 @@ size = Vector2(400, 400) [node name="tilemap" type="CanvasGroup" groups=["gui_items"]] script = ExtResource("1_l64tp") -border_scene = "uid://bumg0moa26skt" -zoom_step = 0.1 [node name="canvas" type="TextureRect" parent="." groups=["gui_items"]] clip_contents = true diff --git a/scenes/настройки/настройки.gd b/scenes/настройки/настройки.gd index 6f262cd..4e07d7e 100644 --- a/scenes/настройки/настройки.gd +++ b/scenes/настройки/настройки.gd @@ -165,11 +165,12 @@ func setting_tab(): var tootip_text = tbl_row[3] name_to_line_index[param_name] = i $scroll_set/table.add_row([node_label, node_value]) - var label_instance = $scroll_set/table.get_node2(0, i) + var label_instance = $scroll_set/table.get_node2(0, i) label_instance.text = param_name label_instance.tooltip_text = tootip_text $scroll_set/table.set_node_editable(0, i, false) var node_values = $scroll_set/table.get_node2(1, i).get_children() + var edit_node = $scroll_set/table.get_node2(1, i) if node_values.size(): var child = node_values[0] if child is CheckButton: @@ -181,15 +182,15 @@ func setting_tab(): var val = settings_data[param_name] if typeof(val) == TYPE_STRING: $scroll_set/table.get_node2(1, i).text = settings_data[param_name] - + if edit_node: + if edit_node is LineEdit: + $scroll_set/table.set_node_control(1, i, true) $scroll_set/table.set_node_editable(1, COMMIT, false) $scroll_set/table.set_columns_min_size([600, 950]) $scroll_set/table.set_columns_alignments(ALIGNMENT) $scroll_set/table.connect('row_pressed', Callable(self, 'on_row_pressed')) - var commit_instance = $scroll_set/table.get_node2(1, COMMIT) commit_instance.text = '%s' % commit.VCS_HEAD - for i in SETTING_TABLE.size(): var param_name = SETTING_TABLE[i][0] if not settings.UnitProfiles.has(param_name): diff --git a/scenes/работа/работа.gd b/scenes/работа/работа.gd index 1d07491..a6f78ac 100644 --- a/scenes/работа/работа.gd +++ b/scenes/работа/работа.gd @@ -31,6 +31,7 @@ var strob_dir_begin: float ## Направление антенны var strob_width_begin: float ## Ширина строба по углу в момент начала перетаскивания. var view_mode: MapViewMode ## Режим отображения карты + signal drag_begin ## Вызывается в момент начала перетаскивания. signal drag_continue ## Вызывается во время продолжения перетаскивания. signal drag_end ## Вызывается в момент завершения перетаскивания. @@ -140,6 +141,8 @@ func _ready(): signaller.connect('interfer_prinuditelno', Callable(self, 'on_chk_interfer_prinuditelno')) signaller.connect('fs_update_state', Callable(self, 'on_fs_update_state')) signaller.connect('map_user_panning', Callable(self, 'on_user_panning')) + signaller.connect('update_coordinates_map', Callable(self, 'on_update_coordinates_label')) + signaller.connect('update_scale_map', Callable(self, 'on_update_scale_label')) on_btn_center_toggled(true) on_btn_activate_toggled(false) @@ -509,4 +512,12 @@ func on_btn_center_toggled(toggled_on: bool) -> void: func on_btn_activate_toggled(toggled_on: bool) -> void: - $btn_activate.tooltip_text = 'Включает падавление (%s)' % ('включено' if toggled_on else 'отключено') + $btn_activate.tooltip_text = 'Включает подавление (%s)' % ('включено' if toggled_on else 'отключено') + + +func on_update_coordinates_label(coordinates_label) -> void: + $coordinates_map.text = str(coordinates_label) + + +func on_update_scale_label(scale_label) -> void: + $scale_map.text = str(scale_label) diff --git a/scenes/работа/работа.tscn b/scenes/работа/работа.tscn index 1b179b1..4bb6358 100644 --- a/scenes/работа/работа.tscn +++ b/scenes/работа/работа.tscn @@ -284,6 +284,22 @@ button_pressed = true texture_normal = ExtResource("12_5ffal") texture_pressed = ExtResource("13_ggrwd") +[node name="coordinates_map" type="Label" parent="."] +layout_mode = 0 +offset_left = 1000.0 +offset_top = 128.0 +offset_right = 1112.0 +offset_bottom = 147.0 +text = "Координаты:" + +[node name="scale_map" type="Label" parent="."] +layout_mode = 0 +offset_left = 1000.0 +offset_top = 192.0 +offset_right = 1110.0 +offset_bottom = 213.0 +text = "Масштаб:" + [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"] diff --git a/scripts/signaller.gd b/scripts/signaller.gd index b3a6597..d6c9b97 100644 --- a/scripts/signaller.gd +++ b/scripts/signaller.gd @@ -179,3 +179,13 @@ signal ems2_hide_pressed(state) ## Вызывается при нажатии на кнопку экранной клавиатуры ## [param state] - состояние скрытия кнопки ЭМС2 signal emit_changed(state) + + +## Вызывается при изменении детализации карты.[br] +## [param new_scale] - обновленное значение масштаба ([b]true[/b] +signal update_scale_map(new_scale) + + +## Вызывается при изменении текущих координат.[br] +## [param new_coordinates] - обновленное значение координат ([b]true[/b] +signal update_coordinates_map(new_coordinates) diff --git a/table/table.gd b/table/table.gd index d096da1..4d6e220 100644 --- a/table/table.gd +++ b/table/table.gd @@ -599,6 +599,17 @@ func set_node_frame(i_col: int, i_row: int, node_name: String, val: int) -> void func set_node_editable(i_col: int, i_row: int, val: bool) -> void: var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row) nodes[key].editable = val + + +## Устанавливает контекстное меню для ячейки таблицы. Ячейка должна иметь свойство [param context_menu].[br] +## [param i_col] - Индекс колонки.[br] +## [param i_row] - Индекс ряда.[br] +## [param val] - Включить или отключить контекстное меню. +func set_node_control(i_col: int, i_row: int, val: bool) -> void: + var key: = get_node_key(NODE_KEY_FORMAT, i_col, i_row) + nodes[key].shortcut_keys_enabled = val + nodes[key].selecting_enabled = val + nodes[key].deselect_on_focus_loss_enabled = val ## Разрешает редактирование ряда. Ячейки ряда должны иметь свойство [param editable].[br]