This commit is contained in:
xzb 2023-08-28 16:33:00 +08:00
parent 1483a494be
commit 8b2f3d25be
3 changed files with 6 additions and 14 deletions

View File

@ -15,10 +15,8 @@ import (
// 具体共享模型仓库key // 具体共享模型仓库key
var StorageKeyXaV1 = tstorages.StorageKey{LineId: "xa-1", Version: "0.1"} var StorageKeyXaV1 = tstorages.StorageKey{LineId: "xa-1", Version: "0.1"}
func init() {
initShareModels()
}
func main() { func main() {
initShareModels()
// 通过共享仓库生成具体仿真world的模型仓库 // 通过共享仓库生成具体仿真world的模型仓库
woldModelStorage := tstorages.ShareStoragesMapper.CreateWorldStorageWithShare(StorageKeyXaV1, initLinkModels()) woldModelStorage := tstorages.ShareStoragesMapper.CreateWorldStorageWithShare(StorageKeyXaV1, initLinkModels())
// //
@ -118,7 +116,7 @@ func testPsdCellOpt(w ecs.World) {
} }
func testSwitchTurn(w ecs.World) { func testSwitchTurn(w ecs.World) {
operate.FireSwitchFcj(w, "switch1") operate.FireSwitchFcj(w, "switch1")
time.Sleep(8 * time.Second) time.Sleep(3 * time.Second)
operate.FireSwitchDcj(w, "switch1") operate.FireSwitchDcj(w, "switch1")
} }

View File

@ -53,11 +53,11 @@ type WorldModelStorage struct {
// 根据模型的复合id获取模型数据 // 根据模型的复合id获取模型数据
func (me *WorldModelStorage) FindById(id string) umi.IDeviceModel { func (me *WorldModelStorage) FindById(id string) umi.IDeviceModel {
md := me.Links.FindModelById(id) md := me.Links.FindModelById(id)
if md != md { if md != nil {
return md return md
} }
md = me.Share.FindModelById(id) md = me.Share.FindModelById(id)
if md != md { if md != nil {
return md return md
} }
return nil return nil

View File

@ -18,8 +18,6 @@ const (
// 道岔系统操作 // 道岔系统操作
type SwitchSystem struct { type SwitchSystem struct {
//道岔定反操控制查询
queryDfc *ecs.Query
} }
func NewSwitchSystem() *SwitchSystem { func NewSwitchSystem() *SwitchSystem {
@ -65,10 +63,6 @@ func (me *SwitchSystem) Update(w ecs.World) {
// 获取道岔转动耗时ms // 获取道岔转动耗时ms
func getSwitchTurnTime(world ecs.World, switchId string) int64 { func getSwitchTurnTime(world ecs.World, switchId string) int64 {
dcModel := WorldModelStorage(world).FindById(switchId) dcModel := WorldModelStorage(world).FindById(switchId)
if nil != dcModel { var dc umi.ISwitchModel = dcModel.(umi.ISwitchModel)
var dc umi.ISwitchModel = dcModel.(umi.ISwitchModel) return dc.TurningTime()
return dc.TurningTime()
}
//不存在返回默认值
return 5000
} }