package system import ( "fmt" "github.com/yohamta/donburi/filter" "joylink.club/ecs" "joylink.club/rtsssimulation/components" ) // 调试时显示一些信息 type DebugSystem struct { } func NewDebugSystem() *DebugSystem { return &DebugSystem{} } // world 执行 func (me *DebugSystem) Update(w ecs.World) { debugSwitch(w) } // 显示道岔状态 func debugSwitch(w ecs.World) { switchesQuery := ecs.NewQuery(filter.Contains(components.ComDeviceIdentity, components.ComSwitchState, components.ComSwitchTurnOperating)) switchesQuery.Each(w, func(e *ecs.Entry) { id := components.ComDeviceIdentity.Get(e).Id state := components.ComSwitchState.Get(e) operating := components.ComSwitchTurnOperating.Get(e) fmt.Println("==>>道岔[", id, "]", ", 定位=", state.Normal, ",反位=", state.Reverse, " , 正在转换道岔=", operating.TurningTime > 0) }) }