This commit is contained in:
xzb 2023-09-22 09:31:41 +08:00
commit b551d8ffa0

View File

@ -32,8 +32,6 @@ 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.PercentageDeviceState1Component)
components = append(components, system.PercentageDeviceState2Component)
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)
@ -41,12 +39,6 @@ func CreateTurnoutEntries(world ecs.World, turnouts []*repository.Turnout, syste
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.NewPercentageDeviceStateM() //定位
system.PercentageDeviceState1Component.Set(entry, j1)
//J2
j2 := system.NewPercentageDeviceStateM() //定位
system.PercentageDeviceState2Component.Set(entry, j2)
if loadZdj9Double { if loadZdj9Double {
system.Switch2jZdj9StateComponent.Set(entry, system.NewSwitch2jZdj9State()) system.Switch2jZdj9StateComponent.Set(entry, system.NewSwitch2jZdj9State())
} }