Доработка.

This commit is contained in:
lepshiy
2025-11-14 13:23:15 +03:00
parent 5657892887
commit 3915bd59d1
16 changed files with 245 additions and 61 deletions

View File

@@ -5,8 +5,8 @@
[ext_resource type="PackedScene" uid="uid://lwmw4egynmd1" path="res://scenes/контроль/контроль.tscn" id="3_txp0s"]
[ext_resource type="PackedScene" uid="uid://trt0q8th3bn2" path="res://scenes/журнал/журнал.tscn" id="4_cu5k8"]
[ext_resource type="PackedScene" uid="uid://dab6loryocc73" path="res://scenes/эмс/эмс.tscn" id="5_u71bh"]
[ext_resource type="PackedScene" uid="uid://musb21x2u0xs" path="res://scenes/эмс2/эмс2.tscn" id="6_41d34"]
[ext_resource type="PackedScene" uid="uid://bnptm4rlp60dq" path="res://scenes/настройки/настройки.tscn" id="6_i8iv3"]
[ext_resource type="PackedScene" uid="uid://musb21x2u0xs" path="res://scenes/эмс2/эмс2.tscn" id="6_rsg03"]
[ext_resource type="Script" uid="uid://b5ykwyk5vpi6" path="res://scenes/tabs-switch/lbl_ready.gd" id="8_tidwt"]
[ext_resource type="Script" uid="uid://roajn6c6wvc1" path="res://scenes/tabs-switch/тренаж_режим.gd" id="9_41d34"]
@@ -69,7 +69,7 @@ visible = false
layout_mode = 2
metadata/_tab_index = 3
[node name="ЭМС ТГ" parent="tab_switch" instance=ExtResource("6_rsg03")]
[node name="ЭМС ТГ" parent="tab_switch" instance=ExtResource("6_41d34")]
visible = false
layout_mode = 2
metadata/_tab_index = 4

View File

@@ -3,6 +3,5 @@
[ext_resource type="Texture2D" uid="uid://cj1f2uy6qfvki" path="res://scenes/tilemap/23900.png" id="1_v0nwa"]
[node name="23900" type="Sprite2D"]
rotation = -6.28319
scale = Vector2(0.496934, 0.496934)
texture = ExtResource("1_v0nwa")

View File

@@ -147,12 +147,11 @@ func _ready() -> void:
signaller.connect('map_centered', on_map_centered)
if not Engine.is_editor_hint():
var unit_nav = network.get_unit_instance('навигация')
unit_nav.connect('data_received', Callable(self, 'on_data_received'))
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():
@@ -196,7 +195,7 @@ func add_mark_from_lon_lat(id: int, lon: float, lat: float, mark: Node, gap_size
if _marks.has(id):
return false
var wrld_pos: Vector2 = lonlat_to_world(lon, lat)
_marks[id] = {'id': id, 'position': wrld_pos, 'mark': mark, 'gap_size': gap_size} # Добавляем ID
_marks[id] = {'position': wrld_pos, 'mark': mark, 'gap_size': gap_size}
add_child(mark)
queue_redraw()
return true
@@ -294,15 +293,20 @@ func _draw() -> void:
for tx in range(t1.x, t2.x):
for ty in range(t1.y, t2.y):
_draw_tile(tx, ty, z)
# Рисование отметок
var n: = pow(2, z)
var dx: = n * tile_width
var c: Vector2 = $canvas.size / 2.0
var r: float = c.length()
visible_marks_count = 0
for dot in _marks.values():
var screen_pos = world_to_screen(dot.position)
dot.mark.position = screen_pos
var scr_pos: Vector2 = world_to_screen(dot.position)
scr_pos.x = posmod(int(scr_pos.x), int(dx))
dot.mark.position = scr_pos
dot.mark.visible = is_mark_visible(dot)
dot.mark.visible = c.distance_to(screen_pos) < (r - dot.gap_size)
dot.mark.visible = c.distance_to(scr_pos) < (r - dot.gap_size)
visible_marks_count += int(dot.mark.visible)
# Рисование границ
var p1: Vector2 = $canvas.position
var p2: Vector2 = $canvas.size / Vector2(1, 20)
if is_out_border1 and _dragging:
@@ -376,22 +380,33 @@ func _process(delta) -> void:
update_scale_label()
func _response(result, code, _headers: Array, body: PackedByteArray, req, tile: Tile) -> void:
var unit_instance = network.get_unit_instance('уарэп-карта')
_req_count -= 1
remove_child(req)
req.queue_free()
func process_online(result):
# ERROR: res://scenes/tilemap/tilemap.gd:396 - Invalid access to property or key 'online' on a base object of type 'Nil'.
var unit_instance: = network.get_unit_instance('уарэп-карта')
if not unit_instance: return
if result != HTTPRequest.RESULT_SUCCESS:
if unit_instance.online:
unit_instance.online = false
unit_instance.emit_signal('line_changed', unit_instance)
_queue[tile.i] = tile
return
return false
unit_instance.rx_tick = Time.get_ticks_msec()
if not unit_instance.online:
unit_instance.online = true
unit_instance.emit_signal('line_changed', unit_instance)
return true
func _response(result, code, _headers: Array, body: PackedByteArray, req, tile: Tile) -> void:
_req_count -= 1
remove_child(req)
req.queue_free()
if process_online(result):
_queue[tile.i] = tile
else:
return
if code == 404:
push_error('на сервере нет \"%s\"' % tile.url)
@@ -401,11 +416,6 @@ func _response(result, code, _headers: Array, body: PackedByteArray, req, tile:
push_error('не удалось получить изображение (неверный формат?) из \"%s\"' % tile.url)
return
unit_instance.rx_tick = Time.get_ticks_msec()
if not unit_instance.online:
unit_instance.online = true
unit_instance.emit_signal('line_changed', unit_instance)
tile.texture = ImageTexture.create_from_image(image)
_cache[tile.i] = tile
@@ -707,7 +717,7 @@ func set_coordinates(lon: float, lat: float, course: float) -> void:
add_mark_from_lon_lat(ship_id, lon, lat, ship_instance, 0.0)
else:
_marks[ship_id].position = lonlat_to_world(lon, lat)
ship_instance.rotation_degrees = course
ship_instance.rotation_degrees = fmod(course, 360.0)
queue_redraw()

View File

@@ -177,7 +177,7 @@ func _ready():
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'))
signaller.connect('sector_klaster', Callable(self, 'sector_klaster'))
signaller.connect('sector_klaster', Callable(self, 'sector_klaster'))
signaller.connect('clear_klaster', Callable(self, 'clear_all_klaster'))
var unit_nav = network.get_unit_instance('навигация')
unit_nav.connect('data_received', on_navi_data_received)

View File

@@ -379,8 +379,8 @@ texture_normal = ExtResource("14_ggrwd")
[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"]
[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"]
[connection signal="button_down" from="zoom_plus" to="tilemap" method="_on_zoom_plus_button_down"]
[connection signal="button_up" from="zoom_plus" to="tilemap" method="_on_zoom_plus_button_up"]

View File

@@ -77,6 +77,7 @@ scale = Vector2(1.77945, 1.77945)
texture = ExtResource("5_yqn2y")
[node name="СостояниеРэс2" type="Sprite2D" parent="Op-63"]
visible = false
position = Vector2(281.865, 35.2331)
scale = Vector2(3.20301, 3.20301)
texture = ExtResource("6_m57px")