extends Node ## 实训名称 @export var trainingName: String = "实训" ## 场景描述 @export var trainingDesc: String = "场景描述" var stepOperation = [] var handleStep = [ { "stepName": "步骤一:站务员手指:上行整列故障门门头灯亮,列车已关门。站务员口呼:上行整列关门故障,列车已关门。", "stepOperation": [], "next": false, "play": false, "playPath": "", "stepTip": true, "checkVoice": "上行整列关门故障,列车已关门。" }, { "stepName": "步骤二:用对讲机汇报值班员:值班员,上行整列站台门关门故障,操作PSL互锁解除,使列车尽快发出。", "stepOperation": [], "next": false, "play": false, "playPath": "", "stepTip": true, "checkVoice": "值班员,上行整列站台门关门故障,操作PSL互锁解除,使列车尽快发出。" }, { "stepName": "值班员回复:收到。", "stepOperation": [], "next": false, "play": true, "playPath": "res://Assets/training_speech/sd.mp3", "stepTip": false, "checkVoice": "", }, { "stepName": "步骤三:用对讲机汇报值班站长:值班站长,上行整列站台门关门故障,请派人看护故障门。", "stepOperation": [], "next": false, "play": false, "playPath": "", "stepTip": true, "checkVoice": "值班站长,上行整列站台门关门故障,请派人看护故障门。" }, { "stepName": "值班站长(机器人)自动回复:收到。", "stepOperation": [], "next": false, "play": true, "playPath": "res://Assets/training_speech/sd.mp3", "stepTip": false, "checkVoice": "", }, { "stepName": "步骤四:站务员使用互锁解除发车:将上行PSL互锁解除开关钥匙旋转至互锁解除位,互锁解除指示灯点亮,并保持互锁解除位。", "stepOperation": ["PSL","HSJC_Key","confirmUseKey","InterlockReleaseSwitchRightRotate"], "next": false, "play": false, "playPath": "", "stepTip": true, "checkVoice": "" }, { "stepName": "步骤五:确认列车车尾超过站台安全门端门。站务员口呼:列车已发出。", "stepOperation": [], "next": false, "play": false, "playPath": "", "stepTip": true, "checkVoice": "列车已发出。" }, { "stepName": "步骤六:站务员松开上行PSL互锁解除开关钥匙,并取出钥匙,互锁解除指示灯熄灭。", "stepOperation": ["InterlockReleaseSwitchLeftRotate","removeHSJCKeyOfWindowPsl"], "next": false, "play": false, "playPath": "", "stepTip": true, "checkVoice": "" }, { "stepName": "步骤七:故障未能修复,口呼:故障未修复,使用互锁解除接入进站列车。", "stepOperation": [], "next": false, "play": false, "playPath": "", "stepTip": true, "checkVoice": "故障未修复,使用互锁解除接入进站列车。" }, { "stepName": "步骤八:继续在PSL处。口呼:列车即将进站。", "stepOperation": [], "next": false, "play": false, "playPath": "", "stepTip": true, "checkVoice": "列车即将进站。" }, { "stepName": "步骤九:站务员使用互锁解除接车:将上行PSL互锁解除钥匙开关旋转至互锁解除位,互锁解除指示灯点亮,并保持互锁解除位。", "stepOperation": ["PSL","HSJC_Key","confirmUseKey","InterlockReleaseSwitchRightRotate"], "next": false, "play": false, "playPath": "", "stepTip": true, "checkVoice": "" }, { "stepName": "步骤十:确认列车停稳后,口呼:整列列车进站停稳。", "stepOperation": [], "next": false, "play": false, "playPath": "", "stepTip": true, "checkVoice": "列车即将进站。" }, { "stepName": "步骤十一:站务员松开上行PSL互锁解除开关钥匙,并取出钥匙,互锁解除指示灯熄灭。", "stepOperation": ["InterlockReleaseSwitchLeftRotate","removeHSJCKeyOfWindowPsl"], "next": false, "play": false, "playPath": "", "stepTip": true, "checkVoice": "" }, { "stepName": "整列故障门恢复正常:系统提示“整列故障门恢复正常”。", "stepOperation": [], "next": false, "play": true, "playPath": "res://Assets/training_speech/trainingTotalCloseDoorFault/zlgzmhfzc.mp3", "stepTip": false, "checkVoice": "", }, { "stepName": "步骤十二:口呼:故障门处置完毕。", "stepOperation": [], "next": false, "play": false, "playPath": "", "stepTip": true, "checkVoice": "故障门处置完毕。" }, { "stepName": "步骤十三:列车正常发出,用对讲机汇报值班员、值班站长:值班员、值班站长,上行整列故障门已处理完毕。", "stepOperation": [], "next": false, "play": false, "playPath": "", "stepTip": true, "checkVoice": "值班员、值班站长,上行整列故障门已处理完毕。" }, { "stepName": "值班员回复:收到。值班站长(机器人)自动回复:收到。", "stepOperation": [], "next": false, "checkVoice": "", "play": true, "playPath": "res://Assets/training_speech/sd.mp3", "stepTip": false, }, { "stepName": "实训已完成!", "stepOperation": [], "next": false, "checkVoice": "", "play": false, "playPath": "", "stepTip": true, }, ] ## 步骤操作执行index var stepOperationIndex = 0 ## 步骤执行index var handleStepIndex = 0 func _ready(): $TrainingDescDialog.title = trainingName $TrainingDescDialog.updateSceneDesc(trainingDesc) $TrainingDescDialog.grab_focus() stepOperationIndex = 0 handleStepIndex = 0 var allScreenDoor = [TotalScene.ScreenDoor_name.screenDoor1,TotalScene.ScreenDoor_name.screenDoor2,TotalScene.ScreenDoor_name.screenDoor3,TotalScene.ScreenDoor_name.screenDoor4] var voiceCommunication func _on_training_desc_dialog_start_training(): voiceCommunication = preload("res://Communication/voice_communication.tscn").instantiate() add_child(voiceCommunication) $total.trainComeAndOpenScreenDoor() $total.setAssignScreenDoorsCloseFault(allScreenDoor) func nextStep(): if handleStepIndex < handleStep.size(): var step = handleStep[handleStepIndex] handleStepIndex = handleStepIndex + 1 if step.stepTip == true and $total.trainingMode != TotalScene.Training_Mode.Exam: $StepTip.updateOperationTip(step.stepName) if step.stepOperation.size() > 0: initStepOperation() if step.next == true: $StepTimer.connect("timeout", nextStep) $StepTimer.start() if step.checkVoice: await voiceCommunication.speech_record_check(step.checkVoice) nextStep() if step.stepName == "步骤十二:口呼:故障门处置完毕。" : $total.removeAssignScreenDoorsFault(allScreenDoor) $total.closeScreenDoorAndTrainLeave() if step.play: var sound = load(step.playPath) await voiceCommunication.play_reply(sound) if step.stepName != "整列故障门恢复正常:系统提示“整列故障门恢复正常”。": nextStep() func setOperationNodeAndTip(): $total.currenNeedClickNode = stepOperation[stepOperationIndex] if $total.trainingMode == TotalScene.Training_Mode.Teach: $TrainTip.setTrainingTip($total.allClickEquipmentInfo[stepOperation[stepOperationIndex]]) func initStepOperation(): stepOperation = handleStep[handleStepIndex-1].stepOperation stepOperationIndex = 0 setOperationNodeAndTip() ##与站台交互点击信号 func _on_total_current_click_check_signal(isCorrect): if isCorrect: if $total.currentClickNode == 'InterlockReleaseSwitchRightRotate' and handleStepIndex<9 : $total.trainLeave(true) nextStep() elif $total.currentClickNode == 'InterlockReleaseSwitchRightRotate' : $total.trainComeAndOpenScreenDoor() $playOpenDoorMusicTimer.start() elif $total.currentClickNode == 'removeHSJCKeyOfWindowPsl' and handleStepIndex<9 : nextStep() elif $total.currentClickNode == 'removeHSJCKeyOfWindowPsl' : $maintainerTimer.start() stepOperationIndex = stepOperationIndex + 1 $StepJudgment.hideError() if stepOperationIndex < stepOperation.size(): setOperationNodeAndTip() else : $TrainTip.setTrainingTip('') else: if $total.trainingMode != TotalScene.Training_Mode.Exam: $StepJudgment.showError() ##车门开门信号 var firstOpen = true func _on_total_train_door_open_confirm_signal(trainDoor: TrainDoor) -> void: if trainDoor.name == "trainDoor1" and firstOpen: $CloseScreenDoorTimer.start() firstOpen = false elif trainDoor.name == "trainDoor1" : nextStep() ##车门关门信号 var firstClose = true func _on_total_train_door_close_confirm_signal(trainDoor: TrainDoor) -> void: if trainDoor.name == "trainDoor1" and firstClose: $FaultTipDialog.show() firstClose = false func _on_close_screen_door_timer_timeout() -> void: $total.closeScreenDoor() $AudioStreamPlayer.play() func _on_fault_tip_dialog_comfirm_signal() -> void: nextStep() func _on_maintainer_timer_timeout() -> void: nextStep() $FaultTipDialog.show() $FaultTipDialog.updateSceneDesc('整列故障门恢复正常!') func _on_play_open_door_music_timer_timeout() -> void: $AudioStreamPlayer.play() func _on_confirm_dialog_two_cancel(): get_tree().paused = false func _on_confirm_dialog_two_confirm(): get_tree().paused = false get_tree().reload_current_scene() func _on_step_tip_click_next_step() -> void: var step = handleStep[handleStepIndex-1] if step.checkVoice: voiceCommunication._reset_record_state() nextStep() if step.stepName == "步骤十二:口呼:故障门处置完毕。" : $total.removeAssignScreenDoorsFault(allScreenDoor) $total.closeScreenDoorAndTrainLeave()