diff --git a/examples/test1/main.go b/examples/test1/main.go index b2160b3..56b3765 100644 --- a/examples/test1/main.go +++ b/examples/test1/main.go @@ -15,10 +15,8 @@ import ( // 具体共享模型仓库key var StorageKeyXaV1 = tstorages.StorageKey{LineId: "xa-1", Version: "0.1"} -func init() { - initShareModels() -} func main() { + initShareModels() // 通过共享仓库生成具体仿真world的模型仓库 woldModelStorage := tstorages.ShareStoragesMapper.CreateWorldStorageWithShare(StorageKeyXaV1, initLinkModels()) // @@ -118,7 +116,7 @@ func testPsdCellOpt(w ecs.World) { } func testSwitchTurn(w ecs.World) { operate.FireSwitchFcj(w, "switch1") - time.Sleep(8 * time.Second) + time.Sleep(3 * time.Second) operate.FireSwitchDcj(w, "switch1") } diff --git a/examples/test1/tstorages/storage_manager.go b/examples/test1/tstorages/storage_manager.go index df80105..f662bd9 100644 --- a/examples/test1/tstorages/storage_manager.go +++ b/examples/test1/tstorages/storage_manager.go @@ -53,11 +53,11 @@ type WorldModelStorage struct { // 根据模型的复合id获取模型数据 func (me *WorldModelStorage) FindById(id string) umi.IDeviceModel { md := me.Links.FindModelById(id) - if md != md { + if md != nil { return md } md = me.Share.FindModelById(id) - if md != md { + if md != nil { return md } return nil diff --git a/system/switch_system.go b/system/switch_system.go index c6188e0..67d0d99 100644 --- a/system/switch_system.go +++ b/system/switch_system.go @@ -18,8 +18,6 @@ const ( // 道岔系统操作 type SwitchSystem struct { - //道岔定反操控制查询 - queryDfc *ecs.Query } func NewSwitchSystem() *SwitchSystem { @@ -65,10 +63,6 @@ func (me *SwitchSystem) Update(w ecs.World) { // 获取道岔转动耗时ms func getSwitchTurnTime(world ecs.World, switchId string) int64 { dcModel := WorldModelStorage(world).FindById(switchId) - if nil != dcModel { - var dc umi.ISwitchModel = dcModel.(umi.ISwitchModel) - return dc.TurningTime() - } - //不存在返回默认值 - return 5000 + var dc umi.ISwitchModel = dcModel.(umi.ISwitchModel) + return dc.TurningTime() }