2023-10-09 15:48:58 +08:00
|
|
|
|
package fi
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"joylink.club/ecs"
|
|
|
|
|
"joylink.club/rtsssimulation/component"
|
|
|
|
|
"joylink.club/rtsssimulation/entity"
|
|
|
|
|
)
|
|
|
|
|
|
2023-10-09 16:22:29 +08:00
|
|
|
|
// signal 3xh2 接口:点灯操作、开通列车信号、开通引导信号、开通禁止信号
|
|
|
|
|
|
2023-10-09 17:58:29 +08:00
|
|
|
|
// DriveSignal3XH2Dd 点灯操作
|
2023-10-09 15:48:58 +08:00
|
|
|
|
// dd : true-物理点灯;false-物理灭灯
|
2023-10-09 17:58:29 +08:00
|
|
|
|
func DriveSignal3XH2Dd(w ecs.World, signalId string, dd bool) {
|
2023-10-09 15:48:58 +08:00
|
|
|
|
w.Execute(func() {
|
|
|
|
|
wd := entity.GetWorldData(w)
|
|
|
|
|
signalEntry, ok := wd.EntityMap[signalId]
|
|
|
|
|
if ok {
|
2023-10-12 14:19:00 +08:00
|
|
|
|
lsq := component.Signal3XH2LsqType.Get(signalEntry)
|
|
|
|
|
lsq.Z3XH2_DDJ_Q = !dd
|
2023-10-09 15:48:58 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-09 17:58:29 +08:00
|
|
|
|
// DriveSignal3XH2Lx 开通列车信号(绿灯亮)
|
|
|
|
|
func DriveSignal3XH2Lx(w ecs.World, signalId string) {
|
2023-10-09 15:48:58 +08:00
|
|
|
|
w.Execute(func() {
|
|
|
|
|
wd := entity.GetWorldData(w)
|
|
|
|
|
signalEntry, ok := wd.EntityMap[signalId]
|
|
|
|
|
if ok {
|
2023-10-12 14:19:00 +08:00
|
|
|
|
lsq := component.Signal3XH2LsqType.Get(signalEntry)
|
|
|
|
|
lsq.Z3XH2_LXJ_Q = true
|
|
|
|
|
lsq.Z3XH2_YXJ_Q = false
|
2023-10-09 15:48:58 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-09 17:58:29 +08:00
|
|
|
|
// DriveSignal3XH2Yx 开通引导信号(黄灯亮且红灯亮)
|
|
|
|
|
func DriveSignal3XH2Yx(w ecs.World, signalId string) {
|
2023-10-09 15:48:58 +08:00
|
|
|
|
w.Execute(func() {
|
|
|
|
|
wd := entity.GetWorldData(w)
|
|
|
|
|
signalEntry, ok := wd.EntityMap[signalId]
|
|
|
|
|
if ok {
|
2023-10-12 14:19:00 +08:00
|
|
|
|
lsq := component.Signal3XH2LsqType.Get(signalEntry)
|
|
|
|
|
lsq.Z3XH2_LXJ_Q = false
|
|
|
|
|
lsq.Z3XH2_YXJ_Q = true
|
2023-10-09 15:48:58 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-09 17:58:29 +08:00
|
|
|
|
// DriveSignal3XH2Non 开通禁止信号(红灯亮)
|
|
|
|
|
func DriveSignal3XH2Non(w ecs.World, signalId string) {
|
2023-10-09 15:48:58 +08:00
|
|
|
|
w.Execute(func() {
|
|
|
|
|
wd := entity.GetWorldData(w)
|
|
|
|
|
signalEntry, ok := wd.EntityMap[signalId]
|
|
|
|
|
if ok {
|
2023-10-12 14:19:00 +08:00
|
|
|
|
lsq := component.Signal3XH2LsqType.Get(signalEntry)
|
|
|
|
|
lsq.Z3XH2_LXJ_Q = false
|
|
|
|
|
lsq.Z3XH2_YXJ_Q = false
|
2023-10-09 15:48:58 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|