Merge branch 'master' of https://git.code.tencent.com/jl-framework/rtss_simulation
This commit is contained in:
commit
78a7e174e7
55
fi/section.go
Normal file
55
fi/section.go
Normal file
@ -0,0 +1,55 @@
|
||||
package fi
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/entity"
|
||||
)
|
||||
|
||||
// DriveAxleSectionTrainIn 测试:计轴区段中车轴进入
|
||||
func DriveAxleSectionTrainIn(w ecs.World, axleSectionId string) {
|
||||
w.Execute(func() {
|
||||
wd := entity.GetWorldData(w)
|
||||
sectionEntry, ok := wd.EntityMap[axleSectionId]
|
||||
if ok {
|
||||
rt := component.AxleSectionRuntimeType.Get(sectionEntry)
|
||||
rt.Count = 1
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// DriveAxleSectionTrainOut 测试:计轴区段中车轴离开
|
||||
func DriveAxleSectionTrainOut(w ecs.World, axleSectionId string) {
|
||||
w.Execute(func() {
|
||||
wd := entity.GetWorldData(w)
|
||||
sectionEntry, ok := wd.EntityMap[axleSectionId]
|
||||
if ok {
|
||||
rt := component.AxleSectionRuntimeType.Get(sectionEntry)
|
||||
rt.Count = 0
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// DriveAxleSectionDrst 测试:设置计轴区段直接复位
|
||||
func DriveAxleSectionDrst(w ecs.World, axleSectionId string, drst bool) {
|
||||
w.Execute(func() {
|
||||
wd := entity.GetWorldData(w)
|
||||
sectionEntry, ok := wd.EntityMap[axleSectionId]
|
||||
if ok {
|
||||
device := component.AxleSectionDeviceType.Get(sectionEntry)
|
||||
device.Drst = drst
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// DriveAxleSectionPdrst 测试:设置计轴区段预复位
|
||||
func DriveAxleSectionPdrst(w ecs.World, axleSectionId string, pdrst bool) {
|
||||
w.Execute(func() {
|
||||
wd := entity.GetWorldData(w)
|
||||
sectionEntry, ok := wd.EntityMap[axleSectionId]
|
||||
if ok {
|
||||
device := component.AxleSectionDeviceType.Get(sectionEntry)
|
||||
device.Pdrst = pdrst
|
||||
}
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user