extends Node ## 实训名称 @export var trainingName: String = "实训" ## 场景描述 @export var trainingDesc: String = "场景描述" var stepOperation = [] var handleStep = [{"stepName": "步骤一:站务员用对讲机汇报值班员:值班员,上行3号门开门故障,使用LCB开启站台门。", "stepOperation": [],}, {"stepName": "步骤二:值班员回复:收到。", "stepOperation": []}, {"stepName": "步骤三:站务员用LCB打开3号故障门:用 LCB钥匙(1号)将故障门(3号门)的LCB转至“开门”位置。", "stepOperation": ["LCB3","LCB_Key1","confirmUseKey","LCB3RightRotate","LCB3RightRotate"]}, {"stepName": "步骤四:站台门打开后,站务员口呼:请有序下车。", "stepOperation": []}, {"stepName": "步骤五:站务员用LCB关闭3号故障门:停站时间到,乘客乘降完毕后,用 LCB钥匙(1号)将故障门(3号门)的LCB转至“关门”位置。", "stepOperation": ["LCB3LeftRotate"]}, {"stepName": "步骤六:故障门处置完毕。", "stepOperation": []}, {"stepName": "步骤七:列车出清站台后,站务员用 LCB钥匙(1号)将故障门(3号门)的LCB转至“自动”位置,取出钥匙。", "stepOperation": ["LCB3LeftRotate","removeKeyOfWindowLCB3"]}, {"stepName": "步骤八:站务员用对讲机汇报值班员:值班员,上行3号门故障已处理完毕。", "stepOperation": []}, {"stepName": "步骤九:值班员回复:收到。", "stepOperation": []}, ] var stepOperationIndex = 0 var handleStepIndex = 0 func _ready(): $TrainingDescDialog.title = trainingName $TrainingDescDialog.updateSceneDesc(trainingDesc) $TrainingDescDialog.grab_focus() $StepTip.visible = false func _on_training_desc_dialog_start_training(): $total.trainComeAndOpenScreenDoor() $total.setAssignScreenDoorsOpenFault([TotalScene.ScreenDoor_name.screenDoor3]) ##开门信号 func _on_total_screen_door_open_confirm_signal(screenDoor): if screenDoor.name == "screenDoor1": if $total.trainingMode != TotalScene.Training_Mode.Exam: $StepTip.visible = true $StepTip.updateOperationTip(handleStep[0].stepName) handleStepIndex = 0 await $VoiceCommunication.speech_record_check("值班员,上行3号门开门故障,使用LCB开启站台门") elif screenDoor.name == "screenDoor3": if $total.trainingMode != TotalScene.Training_Mode.Exam: $StepTip.updateOperationTip(handleStep[3].stepName) handleStepIndex = 3 await $VoiceCommunication.speech_record_check("请有序下车") func depart(): $total.closeScreenDoor() ##关门信号 func _on_total_screen_door_close_confirm_signal(screenDoor): if screenDoor.name == "screenDoor3": $total.trainLeave() if $total.trainingMode != TotalScene.Training_Mode.Exam: $StepTip.updateOperationTip(handleStep[5].stepName) handleStepIndex = 5 await $VoiceCommunication.speech_record_check("故障门处置完毕") elif screenDoor.name == "screenDoor1": if $total.trainingMode != TotalScene.Training_Mode.Exam: $StepTip.updateOperationTip(handleStep[4].stepName) stepOperationIndex = 0 stepOperation = handleStep[4].stepOperation $total.currenNeedClickNode = stepOperation[stepOperationIndex] if $total.trainingMode == TotalScene.Training_Mode.Teach: $TrainTip.setTrainingTip($total.allClickEquipmentInfo[handleStep[4].stepOperation[0]]) func _on_total_current_click_check_signal(isCorrect): if isCorrect: stepOperationIndex = stepOperationIndex + 1 $StepJudgment.hideError() if stepOperationIndex < stepOperation.size(): $total.currenNeedClickNode = stepOperation[stepOperationIndex] if $total.trainingMode == TotalScene.Training_Mode.Teach: $TrainTip.setTrainingTip($total.allClickEquipmentInfo[stepOperation[stepOperationIndex]]) else: $TrainTip.setTrainingTip('') else: if $total.trainingMode != TotalScene.Training_Mode.Exam: $StepJudgment.showError() ##回复收到 var sound = load("res://Assets/training_speech/sd.mp3") func _on_voice_communication_speech_recognition_successed() -> void: if handleStepIndex == 0 : await $VoiceCommunication.play_reply(sound) if $total.trainingMode != TotalScene.Training_Mode.Exam: $StepTip.updateOperationTip(handleStep[2].stepName) $total.currenNeedClickNode = handleStep[2].stepOperation[0] if $total.trainingMode == TotalScene.Training_Mode.Teach: stepOperation = handleStep[2].stepOperation $TrainTip.setTrainingTip($total.allClickEquipmentInfo[handleStep[2].stepOperation[0]]) elif handleStepIndex == 3 : $DepartTimer.connect("timeout", depart) $DepartTimer.start() elif handleStepIndex == 5 : if $total.trainingMode != TotalScene.Training_Mode.Exam: $StepTip.updateOperationTip(handleStep[6].stepName) stepOperationIndex = 0 stepOperation = handleStep[6].stepOperation if $total.trainingMode == TotalScene.Training_Mode.Teach: $TrainTip.setTrainingTip($total.allClickEquipmentInfo[handleStep[6].stepOperation[0]]) elif handleStepIndex == 7 : await $VoiceCommunication.play_reply(sound) 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()