Merge remote-tracking branch 'origin/master'
This commit is contained in:
BIN
disconnect.png
Normal file
BIN
disconnect.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
34
disconnect.png.import
Normal file
34
disconnect.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://wh7p3t4frxf"
|
||||||
|
path="res://.godot/imported/disconnect.png-85f2a4e661088633f66b4438d8774854.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://disconnect.png"
|
||||||
|
dest_files=["res://.godot/imported/disconnect.png-85f2a4e661088633f66b4438d8774854.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
document-save-0.png
Normal file
BIN
document-save-0.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
34
document-save-0.png.import
Normal file
34
document-save-0.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://blpkoi7s8qugp"
|
||||||
|
path="res://.godot/imported/document-save-0.png-60b8d3ba0e847ee0dfdc87427675d7b1.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://document-save-0.png"
|
||||||
|
dest_files=["res://.godot/imported/document-save-0.png-60b8d3ba0e847ee0dfdc87427675d7b1.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
|
||||||
3
main.gd
3
main.gd
@@ -4,6 +4,7 @@ var sock = PacketPeerUDP.new()
|
|||||||
@onready var table_threads = get_node('tabs/threats/table_t')
|
@onready var table_threads = get_node('tabs/threats/table_t')
|
||||||
@onready var btn_add_threads = get_node('tabs/threats/btn_add')
|
@onready var btn_add_threads = get_node('tabs/threats/btn_add')
|
||||||
@onready var btn_del_threads = get_node('tabs/threats/btn_del')
|
@onready var btn_del_threads = get_node('tabs/threats/btn_del')
|
||||||
|
@onready var btn_save_threads = get_node('tabs/threats/btn_save')
|
||||||
|
|
||||||
@onready var table_pomehi = get_node('tabs/pomehi/table_p')
|
@onready var table_pomehi = get_node('tabs/pomehi/table_p')
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ var sock = PacketPeerUDP.new()
|
|||||||
func _ready():
|
func _ready():
|
||||||
sock.bind(Consts.MAIN_ADDR[1], Consts.MAIN_ADDR[0])
|
sock.bind(Consts.MAIN_ADDR[1], Consts.MAIN_ADDR[0])
|
||||||
sock.set_dest_address(Consts.DST_ADDR[0], Consts.DST_ADDR[1])
|
sock.set_dest_address(Consts.DST_ADDR[0], Consts.DST_ADDR[1])
|
||||||
Threats.init_treats(table_threads, btn_add_threads, btn_del_threads)
|
Threats.init_treats(table_threads, btn_add_threads, btn_del_threads, btn_save_threads)
|
||||||
Pomehi.init_pomehi(table_pomehi)
|
Pomehi.init_pomehi(table_pomehi)
|
||||||
var timer = Timer.new()
|
var timer = Timer.new()
|
||||||
timer.connect('timeout', Callable(self, 'on_timeout').bind())
|
timer.connect('timeout', Callable(self, 'on_timeout').bind())
|
||||||
|
|||||||
40
main.tscn
40
main.tscn
@@ -1,12 +1,14 @@
|
|||||||
[gd_scene load_steps=5 format=3 uid="uid://87gtvqd7bbje"]
|
[gd_scene load_steps=7 format=3 uid="uid://87gtvqd7bbje"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://main.gd" id="1_v038r"]
|
[ext_resource type="Script" path="res://main.gd" id="1_d0idv"]
|
||||||
[ext_resource type="Script" path="res://table/table.gd" id="2_mfyp6"]
|
[ext_resource type="Script" path="res://table/table.gd" id="2_bdb37"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cex4jiu1pcj3x" path="res://edit-add-0.png" id="3_6tmn6"]
|
[ext_resource type="Texture2D" uid="uid://cex4jiu1pcj3x" path="res://edit-add-0.png" id="3_am748"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cx746np1wexnd" path="res://edit-add-1.png" id="4_1x5i2"]
|
[ext_resource type="Texture2D" uid="uid://cx746np1wexnd" path="res://edit-add-1.png" id="4_3jxr4"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://blpkoi7s8qugp" path="res://document-save-0.png" id="5_73ry2"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://wh7p3t4frxf" path="res://disconnect.png" id="5_k2igw"]
|
||||||
|
|
||||||
[node name="main" type="Node2D"]
|
[node name="main" type="Node2D"]
|
||||||
script = ExtResource("1_v038r")
|
script = ExtResource("1_d0idv")
|
||||||
|
|
||||||
[node name="tabs" type="TabContainer" parent="."]
|
[node name="tabs" type="TabContainer" parent="."]
|
||||||
offset_right = 1594.0
|
offset_right = 1594.0
|
||||||
@@ -26,7 +28,7 @@ offset_right = 1.0
|
|||||||
offset_bottom = 10.0
|
offset_bottom = 10.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
script = ExtResource("2_mfyp6")
|
script = ExtResource("2_bdb37")
|
||||||
node_type_file = "res://ячейка-1.tscn"
|
node_type_file = "res://ячейка-1.tscn"
|
||||||
|
|
||||||
[node name="btn_add" type="TextureButton" parent="tabs/threats"]
|
[node name="btn_add" type="TextureButton" parent="tabs/threats"]
|
||||||
@@ -35,15 +37,25 @@ offset_left = 1533.0
|
|||||||
offset_top = -2.0
|
offset_top = -2.0
|
||||||
offset_right = 1581.0
|
offset_right = 1581.0
|
||||||
offset_bottom = 46.0
|
offset_bottom = 46.0
|
||||||
texture_normal = ExtResource("3_6tmn6")
|
texture_normal = ExtResource("3_am748")
|
||||||
texture_pressed = ExtResource("4_1x5i2")
|
texture_pressed = ExtResource("4_3jxr4")
|
||||||
|
|
||||||
|
[node name="btn_save" type="TextureButton" parent="tabs/threats"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 1442.0
|
||||||
|
offset_top = -1.0
|
||||||
|
offset_right = 1490.0
|
||||||
|
offset_bottom = 47.0
|
||||||
|
texture_normal = ExtResource("5_73ry2")
|
||||||
|
|
||||||
[node name="btn_del" type="TextureButton" parent="tabs/threats"]
|
[node name="btn_del" type="TextureButton" parent="tabs/threats"]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = 1487.0
|
offset_left = 1499.0
|
||||||
offset_top = 3.0
|
offset_top = 1.0
|
||||||
offset_right = 1527.0
|
offset_right = 1547.0
|
||||||
offset_bottom = 43.0
|
offset_bottom = 67.0
|
||||||
|
scale = Vector2(0.62, 0.62)
|
||||||
|
texture_normal = ExtResource("5_k2igw")
|
||||||
|
|
||||||
[node name="pomehi" type="Panel" parent="tabs"]
|
[node name="pomehi" type="Panel" parent="tabs"]
|
||||||
visible = false
|
visible = false
|
||||||
@@ -54,5 +66,5 @@ layout_mode = 0
|
|||||||
offset_top = 100.0
|
offset_top = 100.0
|
||||||
offset_right = 1587.0
|
offset_right = 1587.0
|
||||||
offset_bottom = 861.0
|
offset_bottom = 861.0
|
||||||
script = ExtResource("2_mfyp6")
|
script = ExtResource("2_bdb37")
|
||||||
node_type_file = "res://ячейка-1.tscn"
|
node_type_file = "res://ячейка-1.tscn"
|
||||||
|
|||||||
1
save.json
Normal file
1
save.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[{"aoa":10,"freq":2480,"id":1,"power":20,"tick":42438,"tmod":"pi4qpsk","width":20},{"aoa":10,"freq":2480,"freqm":"const","id":2,"power":20,"tick":42438,"width":20},{"aoa":200,"freq":2480,"freqm":"lfm","id":3,"power":20,"proto":"ltm","tick":42438,"width":20},{"aoa":10,"freq":2480,"id":5,"power":20,"proto":"j11","tick":42438,"width":20},{"aoa":10,"freq":2480,"id":4,"power":20,"tick":42438,"width":20},{"aoa":100,"freq":2480,"id":6,"power":20,"proto":"mavlink","tick":42438,"width":20},{"aoa":210,"freq":2480,"id":7,"power":20,"tick":42438,"width":20},{"aoa":360,"freq":2480,"freqm":"lfm","id":8,"power":20,"tick":42438,"tmod":"qam16","width":320},{"aoa":10,"freq":2480,"id":9,"power":20,"tick":42438,"width":20}]
|
||||||
58
threats.gd
58
threats.gd
@@ -265,12 +265,12 @@ class Threat:
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
func init_treats(table, btn_add, btn_del): # Инициализация вкладки с целями
|
func init_treats(table, btn_add, btn_del, btn_save): # Инициализация вкладки с целями
|
||||||
for i in range(ID_ARRAY_LEN): # Заполняет массив ID целей
|
for i in range(ID_ARRAY_LEN): # Заполняет массив ID целей
|
||||||
id_array.append(i+1)
|
id_array.append(i+1)
|
||||||
table.set_header(TABLE_HEADER_TYPES)
|
table.set_header(TABLE_HEADER_TYPES)
|
||||||
table.set_header_text(TABLE_HEADERS)
|
table.set_header_text(TABLE_HEADERS)
|
||||||
on_btn_add(table)
|
load_treats(table)
|
||||||
init_table(table, TABLE_COLUMN_SIZES)
|
init_table(table, TABLE_COLUMN_SIZES)
|
||||||
g_table = table
|
g_table = table
|
||||||
table.set_columns_min_size(TABLE_COLUMN_SIZES)
|
table.set_columns_min_size(TABLE_COLUMN_SIZES)
|
||||||
@@ -279,22 +279,68 @@ func init_treats(table, btn_add, btn_del): # Инициализация в
|
|||||||
table.connect_columns(self, 'item_selected', 'on_item_selected', COLUMN_OPT_BTN, [])
|
table.connect_columns(self, 'item_selected', 'on_item_selected', COLUMN_OPT_BTN, [])
|
||||||
btn_add.connect('button_up', Callable(self, 'on_btn_add').bind(table))
|
btn_add.connect('button_up', Callable(self, 'on_btn_add').bind(table))
|
||||||
btn_del.connect('button_up', Callable(self, 'on_btn_del').bind(table))
|
btn_del.connect('button_up', Callable(self, 'on_btn_del').bind(table))
|
||||||
|
btn_save.connect('button_up', Callable(self, 'on_btn_save'))
|
||||||
|
|
||||||
|
|
||||||
|
func load_treats(table):
|
||||||
|
var file = FileAccess.open('res://save.json', FileAccess.READ)
|
||||||
|
var read = file.get_as_text()
|
||||||
|
file.close()
|
||||||
|
var json_conv: = JSON.new()
|
||||||
|
if Error.OK == json_conv.parse(read):
|
||||||
|
var json_data = json_conv.get_data()
|
||||||
|
for item in json_data:
|
||||||
|
if item.has('id'):
|
||||||
|
var id = item['id']
|
||||||
|
id_array.erase(int(id))
|
||||||
|
var threat : = Threat.new(id, table.get_rows_count())
|
||||||
|
treats['%d' % id] = threat
|
||||||
|
for key in item:
|
||||||
|
threat.row[key] = [item[key], true]
|
||||||
|
var row = threat.update_rows()
|
||||||
|
table.add_row(TABLE_ROW_TYPES)
|
||||||
|
table.set_row_text(table.get_rows_count()-1, row)
|
||||||
|
table.set_node_user_data(0, table.get_rows_count()-1, threat)
|
||||||
|
init_opt_btns(table.get_rows_count()-1, table, threat)
|
||||||
|
table.connect_columns(self, 'text_submitted', 'on_edit_entry', TABLE_ENTRY_COLUMNS, [])
|
||||||
|
table.connect_columns(self, 'item_selected', 'on_item_selected', COLUMN_OPT_BTN, [])
|
||||||
|
|
||||||
|
|
||||||
|
func on_btn_save():
|
||||||
|
var file = FileAccess.open('res://save.json', FileAccess.WRITE)
|
||||||
|
var data_to_json : Array
|
||||||
|
for key in treats:
|
||||||
|
var treat = treats[key]
|
||||||
|
var data = treat.get_data()
|
||||||
|
data_to_json.append(data)
|
||||||
|
var json = JSON.new().stringify(data_to_json)
|
||||||
|
file.store_string(json)
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
|
||||||
func init_table(table: Table, sizes: Array):
|
func init_table(table: Table, sizes: Array):
|
||||||
for i_row in table.get_rows_count():
|
for i_row in table.get_rows_count():
|
||||||
#table.set_nodes_min_size(i_row, sizes)
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
func init_opt_btns(row : int, table):
|
func init_opt_btns(row : int, table, threat):
|
||||||
for item in COLUMN_OPT:
|
for item in COLUMN_OPT:
|
||||||
|
var i: int = 0
|
||||||
var i_col = item[0]
|
var i_col = item[0]
|
||||||
var opt_arr = item[1]
|
var opt_arr = item[1]
|
||||||
var cell = table.get_node2(i_col, row)
|
var cell = table.get_node2(i_col, row)
|
||||||
for opt in opt_arr:
|
for opt in opt_arr:
|
||||||
cell.add_item(opt)
|
cell.add_item(opt)
|
||||||
cell.select(0)
|
if i_col == COLUMN_TMOD:
|
||||||
|
var mode = threat.row['tmod'][0]
|
||||||
|
i = MODE_TYPES.find(mode)
|
||||||
|
if i_col == COLUMN_FREQM:
|
||||||
|
var freqm = threat.row['freqm'][0]
|
||||||
|
i = FREQM.find(freqm)
|
||||||
|
if i_col == COLUMN_PROTO:
|
||||||
|
var proto = threat.row['proto'][0]
|
||||||
|
i = M_PROTO.find(proto)
|
||||||
|
cell.select(i)
|
||||||
|
|
||||||
|
|
||||||
func on_item_selected(item_num, node):
|
func on_item_selected(item_num, node):
|
||||||
@@ -363,7 +409,7 @@ func on_btn_add(table):
|
|||||||
table.add_row(TABLE_ROW_TYPES)
|
table.add_row(TABLE_ROW_TYPES)
|
||||||
table.set_row_text(table.get_rows_count()-1, row)
|
table.set_row_text(table.get_rows_count()-1, row)
|
||||||
table.set_node_user_data(0, table.get_rows_count()-1, threat)
|
table.set_node_user_data(0, table.get_rows_count()-1, threat)
|
||||||
init_opt_btns(table.get_rows_count()-1, table)
|
init_opt_btns(table.get_rows_count()-1, table, threat)
|
||||||
table.connect_columns(self, 'text_submitted', 'on_edit_entry', TABLE_ENTRY_COLUMNS, [])
|
table.connect_columns(self, 'text_submitted', 'on_edit_entry', TABLE_ENTRY_COLUMNS, [])
|
||||||
table.connect_columns(self, 'item_selected', 'on_item_selected', COLUMN_OPT_BTN, [])
|
table.connect_columns(self, 'item_selected', 'on_item_selected', COLUMN_OPT_BTN, [])
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://ccxre8mwhndjk"]
|
[gd_scene load_steps=3 format=3 uid="uid://ccxre8mwhndjk"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://dag8n0gknjwak" path="res://индикатор-1-0.png" id="1_dgtjm"]
|
[ext_resource type="Texture2D" uid="uid://dag8n0gknjwak" path="res://индикатор-1-0.png" id="1_3cvx5"]
|
||||||
[ext_resource type="Texture2D" uid="uid://b3ext3w4ftgg2" path="res://индикатор-1-1.png" id="2_aqu5u"]
|
[ext_resource type="Texture2D" uid="uid://b3ext3w4ftgg2" path="res://индикатор-1-1.png" id="2_052gp"]
|
||||||
|
|
||||||
[node name="indicator_1" type="TextureButton"]
|
[node name="indicator_1" type="TextureButton"]
|
||||||
modulate = Color(1, 0.596078, 0.4, 1)
|
modulate = Color(1, 0.596078, 0.4, 1)
|
||||||
@@ -9,5 +9,5 @@ offset_right = 35.0
|
|||||||
offset_bottom = 29.0
|
offset_bottom = 29.0
|
||||||
toggle_mode = true
|
toggle_mode = true
|
||||||
button_mask = 0
|
button_mask = 0
|
||||||
texture_normal = ExtResource("1_dgtjm")
|
texture_normal = ExtResource("1_3cvx5")
|
||||||
texture_pressed = ExtResource("2_aqu5u")
|
texture_pressed = ExtResource("2_052gp")
|
||||||
|
|||||||
Reference in New Issue
Block a user