信号机模型枚举

This commit is contained in:
xzb 2023-11-16 17:21:03 +08:00
parent 76b41c297c
commit 870a8f4b09

View File

@ -82,20 +82,36 @@ func newSignalLights(w ecs.World, lightTags ...component.DsTag) *component.Signa
return &component.SignalLights{Lights: NewLights(w, lightTags...)}
}
/*
enum Model{
HL = 0; //2XH-1 红绿
HLU_FU = 1; //2XH-1 红绿黄,封黄灯,无引导
HLU_DU_YY = 2; //3XH-1 红绿黄,不封灯,有单黄,带引导
HLU_YY = 3; //3XH-2或JDXH 红绿黄,不封灯,无单黄,带引导
HLU_FL_DU_YY = 4;//3XH-3 红绿黄,封绿灯,有单黄,带引导
HLU_DU = 5; //3XH-4 红绿黄,不封灯,有单黄,无引导
AB = 6; //DXCH 蓝白
HBU_DU = 7; //JCKXH 红白黄,不封灯,有单黄,无引导
}
*/
// 新建灯位列表
func newSignalLightsByModel(w ecs.World, sigMt proto.Signal_Model) *component.SignalLights {
switch sigMt {
case proto.Signal_HLU:
return newSignalLights(w, component.HdTag, component.LdTag, component.UdTag)
case proto.Signal_HL:
return newSignalLights(w, component.HdTag, component.LdTag)
case proto.Signal_HLU_FU:
return &component.SignalLights{Lights: []*ecs.Entry{NewLight(w, component.HdTag), NewLight(w, component.LdTag), NewLight(w, component.UdTag, component.FdTag)}}
case proto.Signal_HLU_FL:
case proto.Signal_HLU_FL_DU_YY:
return &component.SignalLights{Lights: []*ecs.Entry{NewLight(w, component.HdTag), NewLight(w, component.LdTag, component.FdTag), NewLight(w, component.UdTag)}}
case proto.Signal_HLU_DU_YY:
fallthrough
case proto.Signal_HLU_YY:
fallthrough
case proto.Signal_HLU_DU:
return newSignalLights(w, component.HdTag, component.LdTag, component.UdTag)
case proto.Signal_AB:
return newSignalLights(w, component.AdTag, component.BdTag)
case proto.Signal_HBU:
case proto.Signal_HBU_DU:
return newSignalLights(w, component.HdTag, component.BdTag, component.UdTag)
default:
panic(fmt.Sprintf("根据信号机模型来创建灯位列表,暂不支持该信号机模型[%d]", sigMt))