com set
This commit is contained in:
parent
57deaec338
commit
ad3d83fee2
@ -58,9 +58,9 @@ func operateSwitch(world ecs.World, dcId string) {
|
|||||||
// 初始化memory
|
// 初始化memory
|
||||||
func initMemoryModel(world ecs.World) {
|
func initMemoryModel(world ecs.World) {
|
||||||
memoryEntry := world.Create(simulation.ComSimMemory)
|
memoryEntry := world.Create(simulation.ComSimMemory)
|
||||||
simulation.ComSimMemory.SetValue(memoryEntry, *simulation.NewSimMemory())
|
//simulation.ComSimMemory.SetValue(memoryEntry, *simulation.NewSimMemory())
|
||||||
//
|
simMemory := simulation.NewSimMemory()
|
||||||
simMemory := simulation.ComSimMemory.Get(memoryEntry)
|
simulation.ComSimMemory.Set(memoryEntry, simMemory)
|
||||||
createModelsRelation(simMemory)
|
createModelsRelation(simMemory)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ func initSwitchState(world ecs.World) {
|
|||||||
for _, switchModel := range simMemory.Switchs {
|
for _, switchModel := range simMemory.Switchs {
|
||||||
dc1 := &state.SwitchState{Id: switchModel.GetId(), Normal: true, Reverse: false}
|
dc1 := &state.SwitchState{Id: switchModel.GetId(), Normal: true, Reverse: false}
|
||||||
dc1Entry := world.Create(simulation.ComSwitchState, simulation.ComSwitchOperating)
|
dc1Entry := world.Create(simulation.ComSwitchState, simulation.ComSwitchOperating)
|
||||||
simulation.ComSwitchState.SetValue(dc1Entry, *dc1)
|
simulation.ComSwitchState.Set(dc1Entry, dc1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ func initLinkState(world ecs.World) {
|
|||||||
for _, linkModel := range simMemory.Links {
|
for _, linkModel := range simMemory.Links {
|
||||||
linkState := &state.LinkState{Id: linkModel.GetId(), Occupied: false}
|
linkState := &state.LinkState{Id: linkModel.GetId(), Occupied: false}
|
||||||
linkEntry := world.Create(simulation.ComLinkState)
|
linkEntry := world.Create(simulation.ComLinkState)
|
||||||
simulation.ComLinkState.SetValue(linkEntry, *linkState)
|
simulation.ComLinkState.Set(linkEntry, linkState)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ func initLinkState(world ecs.World) {
|
|||||||
func initTrainState(world ecs.World, trainId string, linkLocation iwayside.LinkLocation, up bool) {
|
func initTrainState(world ecs.World, trainId string, linkLocation iwayside.LinkLocation, up bool) {
|
||||||
train := &state.TrainState{Id: trainId, LinkId: linkLocation.LinkId, LinkOffset: linkLocation.LinkOffset, Up: up}
|
train := &state.TrainState{Id: trainId, LinkId: linkLocation.LinkId, LinkOffset: linkLocation.LinkOffset, Up: up}
|
||||||
trainEntry := world.Create(simulation.ComTrainState)
|
trainEntry := world.Create(simulation.ComTrainState)
|
||||||
simulation.ComTrainState.SetValue(trainEntry, *train)
|
simulation.ComTrainState.Set(trainEntry, train)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建模型关系
|
// 构建模型关系
|
||||||
|
Loading…
Reference in New Issue
Block a user