Доработка. [PATCH] Движение кораблика по координатам. Экран ЭМС ТГ
This commit is contained in:
@@ -147,14 +147,13 @@ 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():
|
||||
base_url = ProjectSettings.get_setting('application/config/Шаблон адреса сервера карт', base_url)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=19 format=3 uid="uid://b276iygic5itk"]
|
||||
[gd_scene load_steps=18 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"]
|
||||
@@ -13,7 +13,6 @@
|
||||
[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"]
|
||||
[ext_resource type="Texture2D" uid="uid://c6booa8753u5t" path="res://data/состояние-исправности-2.png" id="14_ggrwd"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_5ffal"]
|
||||
resource_name = "goto"
|
||||
@@ -339,52 +338,15 @@ offset_bottom = 302.0
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "−"
|
||||
|
||||
[node name="btn_close" parent="." instance=ExtResource("8_k0iv2")]
|
||||
layout_mode = 0
|
||||
offset_left = 10.0
|
||||
offset_top = 917.0
|
||||
offset_right = 109.0
|
||||
offset_bottom = 937.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "Кнопка для выбора сектора при помощи клика мышкой"
|
||||
strips_rotation = 25.0
|
||||
text = "Сек. запрета"
|
||||
metadata/state = 0
|
||||
|
||||
[node name="btn_work" parent="." instance=ExtResource("8_k0iv2")]
|
||||
layout_mode = 2
|
||||
offset_left = 10.0
|
||||
offset_top = 890.0
|
||||
offset_right = 109.0
|
||||
offset_bottom = 910.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "Кнопка для выбора сектора при помощи клика мышкой"
|
||||
strips_rotation = 25.0
|
||||
text = "Сек. работы"
|
||||
metadata/state = 0
|
||||
|
||||
[node name="btn_all_work" type="TextureButton" parent="."]
|
||||
modulate = Color(1, 1, 1, 0.356863)
|
||||
layout_mode = 0
|
||||
offset_left = 112.0
|
||||
offset_top = 920.0
|
||||
offset_right = 336.0
|
||||
offset_bottom = 1144.0
|
||||
scale = Vector2(0.06, 0.06)
|
||||
texture_normal = ExtResource("14_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"]
|
||||
[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"]
|
||||
[connection signal="button_up" from="zoom_plus" to="tilemap" method="_on_zoom_button_up"]
|
||||
[connection signal="button_down" from="zoom_minus" to="tilemap" method="_on_zoom_minus_button_down"]
|
||||
[connection signal="button_up" from="zoom_minus" to="tilemap" method="_on_zoom_button_up"]
|
||||
[connection signal="pressed" from="btn_all_work" to="." method="_on_btn_all_work_pressed"]
|
||||
|
||||
@@ -403,7 +403,6 @@ theme_override_font_sizes/font_size = 16
|
||||
text = "Излучение"
|
||||
|
||||
[node name="Label2" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 813.0
|
||||
offset_top = 503.0
|
||||
offset_right = 861.0
|
||||
@@ -419,38 +418,47 @@ texture = ExtResource("29_5u4bk")
|
||||
|
||||
[node name="СкруглённыйПрямоугСалатный4" type="Sprite2D" parent="СкруглённыйПрямоугСалатный"]
|
||||
position = Vector2(660, 0)
|
||||
scale = Vector2(1, 1)
|
||||
texture = ExtResource("29_5u4bk")
|
||||
|
||||
[node name="СкруглённыйПрямоугСалатный5" type="Sprite2D" parent="СкруглённыйПрямоугСалатный"]
|
||||
position = Vector2(774, 0)
|
||||
scale = Vector2(1, 1)
|
||||
texture = ExtResource("29_5u4bk")
|
||||
|
||||
[node name="СкруглённыйПрямоугСалатный6" type="Sprite2D" parent="СкруглённыйПрямоугСалатный"]
|
||||
position = Vector2(546, 0)
|
||||
scale = Vector2(1, 1)
|
||||
texture = ExtResource("29_5u4bk")
|
||||
|
||||
[node name="СкруглённыйПрямоугСалатный7" type="Sprite2D" parent="СкруглённыйПрямоугСалатный"]
|
||||
position = Vector2(468, 0)
|
||||
scale = Vector2(1, 1)
|
||||
texture = ExtResource("29_5u4bk")
|
||||
|
||||
[node name="СкруглённыйПрямоугСалатный8" type="Sprite2D" parent="СкруглённыйПрямоугСалатный"]
|
||||
position = Vector2(390, 0)
|
||||
scale = Vector2(1, 1)
|
||||
texture = ExtResource("29_5u4bk")
|
||||
|
||||
[node name="СкруглённыйПрямоугСалатный9" type="Sprite2D" parent="СкруглённыйПрямоугСалатный"]
|
||||
position = Vector2(312, 0)
|
||||
scale = Vector2(1, 1)
|
||||
texture = ExtResource("29_5u4bk")
|
||||
|
||||
[node name="СкруглённыйПрямоугСалатный10" type="Sprite2D" parent="СкруглённыйПрямоугСалатный"]
|
||||
position = Vector2(234, 0)
|
||||
scale = Vector2(1, 1)
|
||||
texture = ExtResource("29_5u4bk")
|
||||
|
||||
[node name="СкруглённыйПрямоугСалатный11" type="Sprite2D" parent="СкруглённыйПрямоугСалатный"]
|
||||
position = Vector2(156, 0)
|
||||
scale = Vector2(1, 1)
|
||||
texture = ExtResource("29_5u4bk")
|
||||
|
||||
[node name="СкруглённыйПрямоугСалатный12" type="Sprite2D" parent="СкруглённыйПрямоугСалатный"]
|
||||
position = Vector2(78, 0)
|
||||
scale = Vector2(1, 1)
|
||||
texture = ExtResource("29_5u4bk")
|
||||
|
||||
[node name="Приём" type="Sprite2D" parent="СкруглённыйПрямоугСалатный"]
|
||||
|
||||
Reference in New Issue
Block a user