【继电器操作接口】
This commit is contained in:
parent
941901954f
commit
781c328e49
@ -1,25 +1,20 @@
|
||||
package memory
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/graphicData"
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/state"
|
||||
"joylink.club/bj-rtsts-server/dto"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/entity"
|
||||
"joylink.club/rtsssimulation/fi"
|
||||
)
|
||||
|
||||
// 继电器操作方法
|
||||
func ChangeRelayState(sim *VerifySimulation, mapId int32, id string, td bool) {
|
||||
uid := QueryUidByMidAndComId(mapId, id, &graphicData.Relay{})
|
||||
entry, ok := entity.GetEntityByUid(sim.World, uid)
|
||||
if !ok {
|
||||
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("不存在【comId:%s】实体", uid)})
|
||||
}
|
||||
if entry.HasComponent(component.RelayDriveType) {
|
||||
relayDrive := component.RelayDriveType.Get(entry)
|
||||
relayDrive.Td = td
|
||||
if td {
|
||||
fi.DriveRelayUp(sim.World, uid)
|
||||
} else {
|
||||
fi.DriveRelayDown(sim.World, uid)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 665adde46e266c800217bbf2033168698dafa284
|
||||
Subproject commit 3a6da100d4074c26093842f7604f68f05853822d
|
Loading…
Reference in New Issue
Block a user