46 lines
1.4 KiB
Go
46 lines
1.4 KiB
Go
package device_sys
|
|
|
|
import (
|
|
"joylink.club/ecs"
|
|
"joylink.club/ecs/filter"
|
|
"joylink.club/rtsssimulation/component"
|
|
)
|
|
|
|
type BaliseSystem struct {
|
|
baliseQuery *ecs.Query
|
|
}
|
|
|
|
func NewBaliseSystem() *BaliseSystem {
|
|
return &BaliseSystem{baliseQuery: ecs.NewQuery(filter.Contains(component.UidType, component.BaliseFixedTelegramType))}
|
|
}
|
|
func (s *BaliseSystem) Update(w ecs.World) {
|
|
s.baliseQuery.Each(w, func(entry *ecs.Entry) {
|
|
s.updateValidTelegram(w, entry)
|
|
})
|
|
}
|
|
|
|
// 更新应答器有效报文
|
|
func (s *BaliseSystem) updateValidTelegram(w ecs.World, entry *ecs.Entry) {
|
|
//wd := entity.GetWorldData(w)
|
|
//id := component.UidType.Get(entry).Id
|
|
//baliseState := component.BaliseFixedTelegramType.Get(entry)
|
|
//if entry.HasComponent(component.BaliseFB) { //固定应答器
|
|
// if len(baliseState.FixedTelegram) == 0 {
|
|
// baliseModel := wd.Repo.FindTransponder(id)
|
|
// telegram := baliseModel.FixedTelegram()
|
|
// if len(telegram) == 0 { //测试用
|
|
// telegram = []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
|
|
// }
|
|
// baliseState.FixedTelegram = telegram
|
|
// }
|
|
//} else if entry.HasComponent(component.BaliseDB) { //休眠唤醒应答器
|
|
//
|
|
//} else if entry.HasComponent(component.BaliseIB) { //预告应答器
|
|
//
|
|
//} else if entry.HasComponent(component.BaliseVB) { //主信号应答器
|
|
//
|
|
//} else if entry.HasComponent(component.BaliseWB) { //轮径校正应答器
|
|
//
|
|
//}
|
|
}
|