2023-10-19 17:09:57 +08:00
|
|
|
package memory
|
2023-11-02 15:50:03 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"joylink.club/bj-rtsts-server/dto/request_proto"
|
|
|
|
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
|
2023-11-06 10:53:06 +08:00
|
|
|
"joylink.club/rtsssimulation/component/component_proto"
|
2023-11-02 15:50:03 +08:00
|
|
|
"joylink.club/rtsssimulation/fi"
|
|
|
|
)
|
|
|
|
|
|
|
|
// 处理道岔操作
|
|
|
|
func HandlePsdOperation(simulation *VerifySimulation, req *request_proto.PsdOperationReq) error {
|
|
|
|
uid := QueryUidByMidAndComId(req.MapId, req.DeviceId, &graphicData.ScreenDoor{})
|
|
|
|
switch req.Operation {
|
|
|
|
case request_proto.Psd_Km4:
|
|
|
|
return fi.SetInterlockKm4(simulation.World, uid)
|
|
|
|
case request_proto.Psd_CancelKm4:
|
|
|
|
return fi.CancelInterlockKm4(simulation.World, uid)
|
|
|
|
case request_proto.Psd_Km8:
|
|
|
|
return fi.SetInterlockKm8(simulation.World, uid)
|
|
|
|
case request_proto.Psd_CancelKm8:
|
|
|
|
return fi.CancelInterlockKm8(simulation.World, uid)
|
|
|
|
case request_proto.Psd_Gm:
|
|
|
|
return fi.SetInterlockGm(simulation.World, uid)
|
|
|
|
case request_proto.Psd_CancelGm:
|
|
|
|
return fi.CancelInterlockGm(simulation.World, uid)
|
|
|
|
case request_proto.Psd_ForceKm4:
|
|
|
|
case request_proto.Psd_ForceKm8:
|
|
|
|
case request_proto.Psd_ForceGm:
|
2023-11-06 13:54:04 +08:00
|
|
|
case request_proto.Psd_CancelForce:
|
2023-11-06 10:53:06 +08:00
|
|
|
case request_proto.Psd_AsdCannotClose:
|
|
|
|
return fi.SetPsdFault(simulation.World, uid, component_proto.Psd_AsdCannotClose, req.AsdCodes)
|
|
|
|
case request_proto.Psd_CancelAsdCannotClose:
|
|
|
|
return fi.CancelPsdFault(simulation.World, uid, component_proto.Psd_AsdCannotClose, req.AsdCodes)
|
|
|
|
case request_proto.Psd_AsdCannotOpen:
|
|
|
|
return fi.SetPsdFault(simulation.World, uid, component_proto.Psd_AsdCannotOpen, req.AsdCodes)
|
|
|
|
case request_proto.Psd_CancelAsdCannotOpen:
|
|
|
|
return fi.CancelPsdFault(simulation.World, uid, component_proto.Psd_AsdCannotOpen, req.AsdCodes)
|
2023-11-09 10:53:32 +08:00
|
|
|
case request_proto.Psd_QDTC:
|
|
|
|
return fi.SetQDTC(simulation.World, uid)
|
|
|
|
case request_proto.Psd_CancelQDTC:
|
|
|
|
return fi.CancelQDTC(simulation.World, uid)
|
|
|
|
case request_proto.Psd_TZTC:
|
|
|
|
return fi.SetTZTC(simulation.World, uid)
|
|
|
|
case request_proto.Psd_CancelTZTC:
|
|
|
|
return fi.CancelTZTC(simulation.World, uid)
|
2023-11-02 15:50:03 +08:00
|
|
|
default:
|
|
|
|
panic(fmt.Sprintf("未知的道岔操作:%s", req.Operation))
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|