Доработка, обработка нажатий на цели и выбор цели в таблице.
This commit is contained in:
@@ -26,6 +26,7 @@ class Threat:
|
||||
var tick_rx: int ## Тик время обновления цели, мс.
|
||||
var tmod: String ## Тип модуляции.
|
||||
var width: float ## Ширина занимаемого диапазона частот, МГц.
|
||||
var selected: bool ## Флаг, что цель выбрана
|
||||
|
||||
func _init(): clear_fflags()
|
||||
func _to_string() -> String: return '<Threat>: номер:%d пеленг:%0.1f частота:%0.1f МГц' % [id, aoa, freq]
|
||||
@@ -52,6 +53,8 @@ func _ready() -> void:
|
||||
unit.connect('data_received', Callable(self, 'on_data_capsrpb_received').bind(threats))
|
||||
timer_check_lost.connect('timeout', Callable(self, 'on_timer_check_lost').bind(repsettings.ThreatParams.time_lost, threats))
|
||||
timer_check_lost.start(repsettings.ThreatParams.time_lost / 1000.0)
|
||||
signaller.connect('rto_threat_sel', Callable(self, 'on_rto_threat_sel').bind(threats))
|
||||
signaller.connect('threat_selected', Callable(self, 'on_threat_selected').bind(threats))
|
||||
|
||||
|
||||
|
||||
@@ -67,6 +70,20 @@ func on_timer_check_lost(time_lost: int, threats: Dictionary):
|
||||
call_deferred('emit_signal', 'threats_resized', threats)
|
||||
|
||||
|
||||
## Выбирает цель, если нажать по отметке цели.
|
||||
func on_rto_threat_sel(bip, threats):
|
||||
for threat in threats.values():
|
||||
threat.selected = false
|
||||
threats[bip.name.to_int()].selected = true
|
||||
|
||||
|
||||
## Выбирает цель, если выбрать в таблице
|
||||
func on_threat_selected(th, threats):
|
||||
for threat in threats.values():
|
||||
threat.selected = false
|
||||
th.selected = true
|
||||
|
||||
|
||||
## Производит приём целей
|
||||
func on_data_capsrpb_received(unit: capsrpb.CapsRpb, threats: Dictionary):
|
||||
if not unit.json_dic.has('ts'): return
|
||||
|
||||
Reference in New Issue
Block a user