Доработка. Настройки - копировать/вставлять/выделять в редактируемых полях. Работа - вывод текущих координат и масштаба цифрами, показ значком коробля текущие координаты коробля на карте, показ значком дрона текущие цели(угрозы)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
BIN
scenes/tilemap/ship.png
Normal file
BIN
scenes/tilemap/ship.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
34
scenes/tilemap/ship.png.import
Normal file
34
scenes/tilemap/ship.png.import
Normal file
@@ -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
|
||||
BIN
scenes/tilemap/ship1.png
Normal file
BIN
scenes/tilemap/ship1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
34
scenes/tilemap/ship1.png.import
Normal file
34
scenes/tilemap/ship1.png.import
Normal file
@@ -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
|
||||
BIN
scenes/tilemap/ship2.png
Normal file
BIN
scenes/tilemap/ship2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.9 KiB |
34
scenes/tilemap/ship2.png.import
Normal file
34
scenes/tilemap/ship2.png.import
Normal file
@@ -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
|
||||
8
scenes/tilemap/ship_mark.tscn
Normal file
8
scenes/tilemap/ship_mark.tscn
Normal file
@@ -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")
|
||||
BIN
scenes/tilemap/threat.png
Normal file
BIN
scenes/tilemap/threat.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
34
scenes/tilemap/threat.png.import
Normal file
34
scenes/tilemap/threat.png.import
Normal file
@@ -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
|
||||
9
scenes/tilemap/threat.tscn
Normal file
9
scenes/tilemap/threat.tscn
Normal file
@@ -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")
|
||||
@@ -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)
|
||||
# Рисование границ
|
||||
@@ -350,6 +363,8 @@ func _process(delta) -> void:
|
||||
if _queue.is_empty():
|
||||
emit_signal('load_completed')
|
||||
|
||||
update_scale_label()
|
||||
|
||||
|
||||
func _response(result, code, _headers: Array, body: PackedByteArray, req, tile: Tile) -> void:
|
||||
|
||||
@@ -552,6 +567,7 @@ 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')
|
||||
if tile != null:
|
||||
tile.t = now
|
||||
return 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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -170,6 +170,7 @@ func setting_tab():
|
||||
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):
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -601,6 +601,17 @@ func set_node_editable(i_col: int, i_row: int, val: bool) -> void:
|
||||
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]
|
||||
## [param i_row] - Индекс ряда.
|
||||
func set_row_editable(i_row: int, val: bool) -> void:
|
||||
|
||||
Reference in New Issue
Block a user