62 lines
1.5 KiB
Go
62 lines
1.5 KiB
Go
package fi
|
||
|
||
import (
|
||
"joylink.club/ecs"
|
||
"joylink.club/rtsssimulation/component"
|
||
"joylink.club/rtsssimulation/entity"
|
||
)
|
||
|
||
// signal 3xh3 接口:点灯操作、开通列车信号、开通引导信号、开通禁止信号
|
||
|
||
// DriveSignal3XH3Dd 点灯操作
|
||
// dd : true-物理点灯;false-物理灭灯
|
||
func DriveSignal3XH3Dd(w ecs.World, signalId string, dd bool) {
|
||
w.Execute(func() {
|
||
wd := entity.GetWorldData(w)
|
||
signalEntry, ok := wd.EntityMap[signalId]
|
||
if ok {
|
||
lsq := component.Signal3XH3LsqType.Get(signalEntry)
|
||
lsq.Z3XH3_DDJ_Q = !dd
|
||
}
|
||
})
|
||
}
|
||
|
||
// DriveSignal3XH3Lx 开通列车信号(黄灯亮)
|
||
func DriveSignal3XH3Lx(w ecs.World, signalId string) {
|
||
w.Execute(func() {
|
||
wd := entity.GetWorldData(w)
|
||
signalEntry, ok := wd.EntityMap[signalId]
|
||
if ok {
|
||
lsq := component.Signal3XH3LsqType.Get(signalEntry)
|
||
lsq.Z3XH3_LXJ_Q = true
|
||
lsq.Z3XH3_YXJ_Q = false
|
||
}
|
||
})
|
||
}
|
||
|
||
// DriveSignal3XH3Yx 开通引导信号(黄灯亮且红灯亮)
|
||
func DriveSignal3XH3Yx(w ecs.World, signalId string) {
|
||
w.Execute(func() {
|
||
wd := entity.GetWorldData(w)
|
||
signalEntry, ok := wd.EntityMap[signalId]
|
||
if ok {
|
||
lsq := component.Signal3XH3LsqType.Get(signalEntry)
|
||
lsq.Z3XH3_LXJ_Q = false
|
||
lsq.Z3XH3_YXJ_Q = true
|
||
}
|
||
})
|
||
}
|
||
|
||
// DriveSignal3XH3Non 开通禁止信号(红灯亮)
|
||
func DriveSignal3XH3Non(w ecs.World, signalId string) {
|
||
w.Execute(func() {
|
||
wd := entity.GetWorldData(w)
|
||
signalEntry, ok := wd.EntityMap[signalId]
|
||
if ok {
|
||
lsq := component.Signal3XH3LsqType.Get(signalEntry)
|
||
lsq.Z3XH3_LXJ_Q = false
|
||
lsq.Z3XH3_YXJ_Q = false
|
||
}
|
||
})
|
||
}
|