package sigSys import ( "joylink.club/ecs" "joylink.club/ecs/filter" "joylink.club/rtsssimulation/component" "log/slog" ) type SignalDebugSystem struct { query *ecs.Query } func NewSignalDebugSystem() *SignalDebugSystem { return &SignalDebugSystem{query: ecs.NewQuery(filter.Contains(component.Signal3XH1ElectronicType))} } // Update world 执行 func (s *SignalDebugSystem) Update(w ecs.World) { s.query.Each(w, func(entry *ecs.Entry) { uid := component.UidType.Get(entry) state := component.Signal3XH1ElectronicType.Get(entry) lights := component.SignalLightsType.Get(entry) Z3XH1_L := lights.GetLightByTag(component.LdTag) Z3XH1_H := lights.GetLightByTag(component.HdTag) Z3XH1_U := lights.GetLightByTag(component.UdTag) // ddj := component.BitStateType.Get(state.Z3XH1_DDJ) lxj := component.BitStateType.Get(state.Z3XH1_LXJ) dj := component.BitStateType.Get(state.Z3XH1_DJ) edj := component.BitStateType.Get(state.Z3XH1_2DJ) yxj := component.BitStateType.Get(state.Z3XH1_YXJ) zxj := component.BitStateType.Get(state.Z3XH1_ZXJ) ld := component.BitStateType.Get(Z3XH1_L) hd := component.BitStateType.Get(Z3XH1_H) ud := component.BitStateType.Get(Z3XH1_U) //lsq := component.Signal3XH1LsqType.Get(entry) //lsc := component.Signal3XH1LscType.Get(entry) // slog.Debug(uid.Id, "ddj", ddj.Val, "lxj", lxj.Val, "zxj", zxj.Val, "yxj", yxj.Val, "dj", dj.Val, "2dj", edj.Val, "绿灯", ld.Val, "红灯", hd.Val, "黄灯", ud.Val) }) }