165 lines
4.7 KiB
GDScript
165 lines
4.7 KiB
GDScript
extends Node3D
|
|
|
|
class_name TotalScene
|
|
|
|
##车来且开屏蔽门和车门
|
|
func trainComeAndOpenScreenDoor ()-> void:
|
|
$train.trainCome()
|
|
$BeginTimer.start()
|
|
|
|
func _on_beginTimer_timeout() -> void:
|
|
$train.openLeftTrainDoorALL()
|
|
$platform.openScreenDoorALL()
|
|
|
|
##关屏蔽门和车门且车走
|
|
func closeScreenDoorAndTrainLeave ()-> void:
|
|
closeScreenDoor()
|
|
$EndTimer.start()
|
|
|
|
func _on_end_timer_timeout() -> void:
|
|
trainLeave()
|
|
|
|
##关屏蔽门和车门
|
|
func closeScreenDoor() -> void:
|
|
$train.closeLeftTrainDoorALL()
|
|
$platform.closeScreenDoorALL()
|
|
|
|
##车走
|
|
func trainLeave() -> void:
|
|
$train.trainLeave()
|
|
|
|
|
|
## 屏蔽门名字的枚举
|
|
enum ScreenDoor_name{
|
|
screenDoor1=1,
|
|
screenDoor2,
|
|
screenDoor3,
|
|
screenDoor4,
|
|
}
|
|
|
|
##设置指定屏蔽门开门故障
|
|
func setAssignScreenDoorsOpenFault (screenDoorNames:Array)-> void:
|
|
setAssignScreenDoorsFault(screenDoorNames,ScreenDoor.ScreenDoor_Fault_State.openFault)
|
|
|
|
##设置指定屏蔽门关门故障
|
|
func setAssignScreenDoorsCloseFault (screenDoorNames:Array)-> void:
|
|
setAssignScreenDoorsFault(screenDoorNames,ScreenDoor.ScreenDoor_Fault_State.closeFault)
|
|
|
|
##设置指定屏蔽门玻璃破碎故障
|
|
func setAssignScreenDoorsGlassBreakageFault (screenDoorNames:Array)-> void:
|
|
setAssignScreenDoorsFault(screenDoorNames,ScreenDoor.ScreenDoor_Fault_State.glassBreakage)
|
|
|
|
##设置指定屏蔽门夹人故障
|
|
func setAssignScreenDoorsPinchPeopleFault (screenDoorNames:Array)-> void:
|
|
setAssignScreenDoorsFault(screenDoorNames,ScreenDoor.ScreenDoor_Fault_State.pinchPeople)
|
|
|
|
|
|
func setAssignScreenDoorsFault (screenDoorNames:Array,faultType:ScreenDoor.ScreenDoor_Fault_State)-> void:
|
|
for child in $platform.screenDoorALL:
|
|
var screenDoorName=String(child.name)
|
|
var screenDoorIndex=int(screenDoorName[screenDoorName.length() - 1])
|
|
if screenDoorIndex in screenDoorNames:
|
|
child.setScreenDoorFault(faultType)
|
|
|
|
##屏蔽门开关门到位信号
|
|
signal screenDoorOpenConfirmSignal(screenDoor:ScreenDoor)
|
|
signal screenDoorCloseConfirmSignal(screenDoor:ScreenDoor)
|
|
|
|
func emitScreenDoorOpenSignal(screenDoor:ScreenDoor) -> void:
|
|
screenDoorOpenConfirmSignal.emit(screenDoor)
|
|
|
|
func emitScreenDoorCloseSignal(screenDoor:ScreenDoor) -> void:
|
|
screenDoorCloseConfirmSignal.emit(screenDoor)
|
|
|
|
## 实训模式枚举
|
|
enum Training_Mode{
|
|
Teach,#教学模式
|
|
Practice,# 练习模式
|
|
Exam,# 考试模式
|
|
}
|
|
|
|
var trainingMode = Training_Mode.Teach
|
|
|
|
##当前点击和需要点击节点以及校验是否点击正确
|
|
var currentClickNode = null
|
|
var currenNeedClickNode = null
|
|
|
|
signal currentClickCheckSignal(isCorrect:bool)
|
|
|
|
func checkCurrentClick() -> bool:
|
|
if trainingMode == Training_Mode.Exam:
|
|
return true
|
|
else :
|
|
if currentClickNode == currenNeedClickNode:
|
|
return true
|
|
else :
|
|
return false
|
|
|
|
|
|
func _on_platform_all_click_platform_signal(equipmentName: String,equipmentInfo=null) -> void:
|
|
print(equipmentName,equipmentInfo,6666)
|
|
currentClickNode = equipmentName
|
|
var isClickCorrect = checkCurrentClick()
|
|
currentClickCheckSignal.emit(isClickCorrect)
|
|
if isClickCorrect:
|
|
print('操作正确')
|
|
else :
|
|
print('操作错误')
|
|
|
|
##所有交互操作汇总
|
|
const allClickEquipmentInfo = {
|
|
"LCB_Key1": "hhh", ##钥匙面板
|
|
"LCB_Key2": "hhh",
|
|
"LCB_Key3": "hhh",
|
|
"LCB_Key4": "hhh",
|
|
"JJTC_Key": "hhh",
|
|
"PSL_Key": "hhh",
|
|
"HSJC_Key": "hhh",
|
|
"SDJS_Key": "hhh",
|
|
"confirmUseKey": "hhh",
|
|
"LCB1": "hhh", ##LCB以及LCB面板
|
|
"LCB2": "hhh",
|
|
"LCB3": "hhh",
|
|
"LCB4": "hhh",
|
|
"LCB1LeftRotate": "hhh",
|
|
"LCB1RightRotate": "hhh",
|
|
"LCB2LeftRotate": "hhh",
|
|
"LCB2RightRotate": "hhh",
|
|
"LCB3LeftRotate": "hhh",
|
|
"LCB3RightRotate": "hhh",
|
|
"LCB4LeftRotate": "hhh",
|
|
"LCB4RightRotate": "hhh",
|
|
"removeKeyOfWindowLCB1": "hhh",
|
|
"removeKeyOfWindowLCB2": "hhh",
|
|
"removeKeyOfWindowLCB3": "hhh",
|
|
"removeKeyOfWindowLCB4": "hhh",
|
|
"PSL": "hhh", ##PSL以及PSL面板
|
|
"PSLAllow": "hhh",
|
|
"CloseDoorButton": "hhh",
|
|
"OpenDoorButton": "hhh",
|
|
"InterlockReleaseSwitch": "hhh",
|
|
"LightTestButton": "hhh",
|
|
"trainDepartsButton": "hhh",
|
|
"interconnectedCloseButton": "hhh",
|
|
"interconnectedOpenButton": "hhh",
|
|
"removePSLKeyOfWindowPsl": "hhh",
|
|
"removeHSJCKeyOfWindowPsl": "hhh",
|
|
"JJTC": "hhh", ##JJTC以及JJTC面板
|
|
"JJTCLeftRotate": "hhh",
|
|
"JJTCRightRotate": "hhh",
|
|
"JJTCButton": "hhh",
|
|
"JJTCCloseBox": "hhh",
|
|
"screenDoor1RightClick": "hhh", ##屏蔽门右键以及屏蔽门右键面板
|
|
"screenDoor2RightClick": "hhh",
|
|
"screenDoor3RightClick": "hhh",
|
|
"screenDoor4RightClick": "hhh",
|
|
"clickAdhesiveTapeOfscreenDoor1": "hhh",
|
|
"clickIsolationStripOfscreenDoor1": "hhh",
|
|
"clickAdhesiveTapeOfscreenDoor2": "hhh",
|
|
"clickIsolationStripOfscreenDoor2": "hhh",
|
|
"clickAdhesiveTapeOfscreenDoor3": "hhh",
|
|
"clickIsolationStripOfscreenDoor3": "hhh",
|
|
"clickAdhesiveTapeOfscreenDoor4": "hhh",
|
|
"clickIsolationStripOfscreenDoor4": "hhh",
|
|
}
|