消除报错
This commit is contained in:
parent
ffe638d20c
commit
1720d6ba5b
@ -32,27 +32,15 @@ func CreateTurnoutEntries(world ecs.World, turnouts []*repository.Turnout, syste
|
|||||||
for _, turnout := range turnouts {
|
for _, turnout := range turnouts {
|
||||||
var components []component.IComponentType
|
var components []component.IComponentType
|
||||||
components = append(components, system.EntityIdentityComponent)
|
components = append(components, system.EntityIdentityComponent)
|
||||||
components = append(components, system.MovableObject1Component)
|
|
||||||
components = append(components, system.MovableObject2Component)
|
|
||||||
loadZdj9Double := turnout.SwitchMachineType() == proto.Turnout_ZDJ9_Double && systemTypeMap[system.SWITCH_ZDJ9_2]
|
loadZdj9Double := turnout.SwitchMachineType() == proto.Turnout_ZDJ9_Double && systemTypeMap[system.SWITCH_ZDJ9_2]
|
||||||
if loadZdj9Double {
|
if loadZdj9Double {
|
||||||
components = append(components, system.Switch2jZdj9StateComponent)
|
components = append(components, system.Switch2jZdj9StateComponent)
|
||||||
components = append(components, system.Switch2jZdj9CjStateComponent)
|
|
||||||
}
|
}
|
||||||
entry := world.Create(components...)
|
entry := world.Create(components...)
|
||||||
entries = append(entries, entry)
|
entries = append(entries, entry)
|
||||||
system.EntityIdentityComponent.Set(entry, &system.EntityIdentity{Id: turnout.Id()})
|
system.EntityIdentityComponent.Set(entry, &system.EntityIdentity{Id: turnout.Id()})
|
||||||
//J1
|
|
||||||
j1 := system.NewMovableObject()
|
|
||||||
j1.Value = system.J1Range
|
|
||||||
system.MovableObject1Component.Set(entry, j1)
|
|
||||||
//J2
|
|
||||||
j2 := system.NewMovableObject()
|
|
||||||
j2.Value = system.J2Range
|
|
||||||
system.MovableObject2Component.Set(entry, j2)
|
|
||||||
if loadZdj9Double {
|
if loadZdj9Double {
|
||||||
system.Switch2jZdj9StateComponent.Set(entry, system.NewSwitch2jZdj9State())
|
system.Switch2jZdj9StateComponent.Set(entry, system.NewSwitch2jZdj9State())
|
||||||
system.Switch2jZdj9CjStateComponent.Set(entry, system.NewSwitch2jZdj9CjState())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return entries
|
return entries
|
||||||
|
Loading…
Reference in New Issue
Block a user