2023-10-09 17:53:04 +08:00
|
|
|
package fi
|
|
|
|
|
|
|
|
import (
|
|
|
|
"joylink.club/ecs"
|
|
|
|
"joylink.club/rtsssimulation/component"
|
|
|
|
"joylink.club/rtsssimulation/entity"
|
|
|
|
)
|
|
|
|
|
|
|
|
// signal jckxh 接口:开通列车信号、开通调车信号、开通禁止信号
|
|
|
|
|
2023-10-09 17:58:29 +08:00
|
|
|
// DriveSignalJCKXHLx 开通列车信号(黄灯亮)
|
|
|
|
func DriveSignalJCKXHLx(w ecs.World, signalId string) {
|
2023-10-09 17:53:04 +08:00
|
|
|
w.Execute(func() {
|
|
|
|
wd := entity.GetWorldData(w)
|
|
|
|
signalEntry, ok := wd.EntityMap[signalId]
|
|
|
|
if ok {
|
2023-10-12 17:33:20 +08:00
|
|
|
lsq := component.SignalJCKXHLsqType.Get(signalEntry)
|
|
|
|
lsq.JCKXH_LXJ_Q = true
|
|
|
|
lsq.JCKXH_DXJ_Q = false
|
2023-10-09 17:53:04 +08:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-10-09 17:58:29 +08:00
|
|
|
// DriveSignalJCKXHDx 开通调车信号(白灯亮)
|
|
|
|
func DriveSignalJCKXHDx(w ecs.World, signalId string) {
|
2023-10-09 17:53:04 +08:00
|
|
|
w.Execute(func() {
|
|
|
|
wd := entity.GetWorldData(w)
|
|
|
|
signalEntry, ok := wd.EntityMap[signalId]
|
|
|
|
if ok {
|
2023-10-12 17:33:20 +08:00
|
|
|
lsq := component.SignalJCKXHLsqType.Get(signalEntry)
|
|
|
|
lsq.JCKXH_LXJ_Q = false
|
|
|
|
lsq.JCKXH_DXJ_Q = true
|
2023-10-09 17:53:04 +08:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-10-09 17:58:29 +08:00
|
|
|
// DriveSignalJCKXHNon 开通禁止信号(红灯亮)
|
|
|
|
func DriveSignalJCKXHNon(w ecs.World, signalId string) {
|
2023-10-09 17:53:04 +08:00
|
|
|
w.Execute(func() {
|
|
|
|
wd := entity.GetWorldData(w)
|
|
|
|
signalEntry, ok := wd.EntityMap[signalId]
|
|
|
|
if ok {
|
2023-10-12 17:33:20 +08:00
|
|
|
lsq := component.SignalJCKXHLsqType.Get(signalEntry)
|
|
|
|
lsq.JCKXH_LXJ_Q = false
|
|
|
|
lsq.JCKXH_DXJ_Q = false
|
2023-10-09 17:53:04 +08:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|