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.Signal2XH1ElectronicType))} } // Update world 执行 func (s *SignalDebugSystem) Update(w ecs.World) { s.query.Each(w, func(entry *ecs.Entry) { uid := component.UidType.Get(entry) state := component.Signal2XH1ElectronicType.Get(entry) lights := component.SignalLightsType.Get(entry) Z2XH1_L := lights.GetLightByTag(component.LdTag) Z2XH1_H := lights.GetLightByTag(component.HdTag) ld := component.BitStateType.Get(Z2XH1_L) hd := component.BitStateType.Get(Z2XH1_H) // ddj := component.BitStateType.Get(state.Z2XH1_DDJ) lxj := component.BitStateType.Get(state.Z2XH1_LXJ) lsq := component.Signal2XH1LsqType.Get(entry) lsc := component.Signal2XH1LscType.Get(entry) // slog.Debug(uid.Id, "ddjQ", lsq.Z2XH1_DDJ_Q, "lxjQ", lsq.Z2XH1_LXJ_Q, "ddjLx", lsc.Z2XH1_DDJ_Lx, "djXq", lsc.Z2XH1_DJ_Xq, "lxjXq", lsc.Z2XH1_LXJ_Xq, "ddj", ddj.Val, "lxj", lxj.Val, "绿灯", ld.Val, "红灯", hd.Val) }) }