Merge remote-tracking branch 'origin/master' into sasha80

This commit is contained in:
sasha80
2023-08-18 09:47:39 +03:00
4 changed files with 31 additions and 24 deletions

View File

@@ -1,12 +1,10 @@
extends Node2D
var sock = PacketPeerUDP.new()
@onready var header_threads = get_node('tabs/threats/header_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_del_threads = get_node('tabs/threats/btn_del')
@onready var header_pomehi = get_node('tabs/pomehi/header_p')
@onready var table_pomehi = get_node('tabs/pomehi/table_p')
# Called when the node enters the scene tree for the first time.

View File

@@ -1,12 +1,12 @@
[gd_scene load_steps=5 format=3 uid="uid://87gtvqd7bbje"]
[ext_resource type="Script" path="res://main.gd" id="1_s3ohn"]
[ext_resource type="Script" path="res://table/table.gd" id="2_vjhtn"]
[ext_resource type="Texture2D" uid="uid://cex4jiu1pcj3x" path="res://edit-add-0.png" id="3_2ohxr"]
[ext_resource type="Texture2D" uid="uid://cx746np1wexnd" path="res://edit-add-1.png" id="4_i0tam"]
[ext_resource type="Script" path="res://main.gd" id="1_1ftv4"]
[ext_resource type="Script" path="res://table/table.gd" id="2_7svpe"]
[ext_resource type="Texture2D" uid="uid://cex4jiu1pcj3x" path="res://edit-add-0.png" id="3_furhm"]
[ext_resource type="Texture2D" uid="uid://cx746np1wexnd" path="res://edit-add-1.png" id="4_h0btf"]
[node name="main" type="Node2D"]
script = ExtResource("1_s3ohn")
script = ExtResource("1_1ftv4")
[node name="tabs" type="TabContainer" parent="."]
offset_right = 1594.0
@@ -26,7 +26,7 @@ offset_right = 1.0
offset_bottom = 10.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("2_vjhtn")
script = ExtResource("2_7svpe")
node_type_file = "res://ячейка-1.tscn"
[node name="btn_add" type="TextureButton" parent="tabs/threats"]
@@ -35,8 +35,8 @@ offset_left = 1533.0
offset_top = -2.0
offset_right = 1581.0
offset_bottom = 46.0
texture_normal = ExtResource("3_2ohxr")
texture_pressed = ExtResource("4_i0tam")
texture_normal = ExtResource("3_furhm")
texture_pressed = ExtResource("4_h0btf")
[node name="btn_del" type="TextureButton" parent="tabs/threats"]
layout_mode = 0
@@ -54,5 +54,5 @@ layout_mode = 0
offset_top = 100.0
offset_right = 1587.0
offset_bottom = 861.0
script = ExtResource("2_vjhtn")
script = ExtResource("2_7svpe")
node_type_file = "res://ячейка-1.tscn"

View File

@@ -15,7 +15,7 @@ const TableCellType6 = preload('res://кнопка-5.tscn')
const TableHeader = preload('res://table/header.tscn')
# Индекс колонки: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
const TABLE_HEADERS = ['ID Цели', 'Курc.град', 'Частота', 'Ш. диап.', 'Ампл.', 'T обнар.', 'Мод.', 'Реж. см. F', 'Ск. пер.', 'Протокол', 'Ст. дол.', 'Ст. шир.', 'Cт. выс.', 'Тек. дол.', 'Тек. шир.', 'Тек. выс.', ]
const TABLE_HEADERS = ['ID Цели', 'Курc.град', 'Частота', 'Ш. диап.', 'Ампл.', 'T обновл.', 'Мод.', 'Реж. см. F', 'Ск. пер.', 'Протокол', 'Ст. дол.', 'Ст. шир.', 'Cт. выс.', 'Тек. дол.', 'Тек. шир.', 'Тек. выс.', ]
const TABLE_HEADER_TYPES = [ TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader, TableHeader]
const TABLE_HEADER_ALIGNMENTS = [ HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER]
const TABLE_ROW_TYPES = [ TableCellType1, TableCellType5, TableCellType5, TableCellType5, TableCellType5, TableCellType5, TableCellType6, TableCellType6, TableCellType5, TableCellType6, TableCellType5, TableCellType5, TableCellType5, TableCellType5, TableCellType5, TableCellType5]
@@ -90,17 +90,17 @@ const ID_ARRAY_LEN = 100 # Размер пула номеров целей
# Цель
class Threat:
# параметры цели, второе значение, разрешение отправки.
var row : Dictionary = {
var row: Dictionary = {
'id':[0,true],
'aoa':[10.0,true],
'freq':[2480.0,true],
'width':[20.0,true],
'power':[20.0,true],
'tick':[10,true],
'tmod':['',false],
'freqm':['',false],
'tmod':['<неопр.>',false],
'freqm':['<неопр.>',false],
'baud':[0.0,false],
'proto':['',false],
'proto':['<неопр.>',false],
'slon':[0.0,false],
'slat':[0.0,false],
'salt':[0.0,false],
@@ -108,9 +108,11 @@ class Threat:
'lon':[0.0,false],
'alt':[0.0,false],
}
var row_id: int
func _init(th_id : int):
func _init(th_id : int, row_i: int):
row.id[0] = th_id
row_id = row_i
func get_data():
var data_to_send : Dictionary
@@ -355,7 +357,7 @@ func on_row_pressed(i_row: int, table):
func on_btn_add(table):
var id = pop_id()
var threat : = Threat.new(id)
var threat : = Threat.new(id, table.get_rows_count())
treats['%d' % id] = threat
var row = threat.update_rows()
table.add_row(TABLE_ROW_TYPES)
@@ -394,9 +396,16 @@ func get_threats_data():
data_to_json['msvk'] = []
data_to_json['mis'] = []
for key in treats:
var data = treats[key].get_data()
var treat = treats[key]
set_ticks(treat)
var data = treat.get_data()
data_to_json['mis'].append(data)
var json = JSON.new().stringify(data_to_json)
print_debug(json)
var pac = json.to_utf8_buffer()
return pac
func set_ticks(treat):
var tick = Time.get_ticks_msec()
var cell = g_table.get_node2(COLUMN_TICK,treat.row_id)
cell.text = str(treat.set_tick(str(tick%60000)))

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://ccxre8mwhndjk"]
[ext_resource type="Texture2D" uid="uid://dag8n0gknjwak" path="res://индикатор-1-0.png" id="1_qvf8a"]
[ext_resource type="Texture2D" uid="uid://b3ext3w4ftgg2" path="res://индикатор-1-1.png" id="2_1f6tt"]
[ext_resource type="Texture2D" uid="uid://dag8n0gknjwak" path="res://индикатор-1-0.png" id="1_bo5pc"]
[ext_resource type="Texture2D" uid="uid://b3ext3w4ftgg2" path="res://индикатор-1-1.png" id="2_b0mq6"]
[node name="indicator_1" type="TextureButton"]
modulate = Color(1, 0.596078, 0.4, 1)
@@ -9,5 +9,5 @@ offset_right = 35.0
offset_bottom = 29.0
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("1_qvf8a")
texture_pressed = ExtResource("2_1f6tt")
texture_normal = ExtResource("1_bo5pc")
texture_pressed = ExtResource("2_b0mq6")