实训调整

This commit is contained in:
joylink_zhaoerwei 2024-05-20 14:29:47 +08:00
parent 5724f72185
commit 9b3a155d93
2 changed files with 41 additions and 26 deletions

View File

@ -17,6 +17,7 @@ var handleStep = [{"stepName": "步骤一:站务员用对讲机汇报值班员
{"stepName": "步骤九:值班员回复:收到。", "stepOperation": []},
]
var stepIndex = 0
var handleStepIndex = 0
func _ready():
$TrainingDescDialog.title = trainingName
@ -33,13 +34,16 @@ func _on_training_desc_dialog_start_training():
##开门信号
func _on_total_screen_door_open_confirm_signal(screenDoor):
if screenDoor.name == "screenDoor1":
$StepTip.visible = true
$StepTip.updateOperationTip(handleStep[0].stepName)
$textVoice.connect("timeout", replyReceived)
$textVoice.start()
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":
$DepartTimer.connect("timeout", depart)
$DepartTimer.start()
if $total.trainingMode != TotalScene.Training_Mode.Exam:
$StepTip.updateOperationTip(handleStep[3].stepName)
handleStepIndex = 3
await $VoiceCommunication.speech_record_check("请有序下车")
func depart():
@ -49,13 +53,13 @@ func depart():
func _on_total_screen_door_close_confirm_signal(screenDoor):
if screenDoor.name == "screenDoor3":
$total.trainLeave()
$StepTip.updateOperationTip(handleStep[6].stepName)
stepIndex = 0
currentStep = handleStep[6].stepOperation
if $total.trainingMode == TotalScene.Training_Mode.Teach:
$TrainTip.setTrainingTip($total.allClickEquipmentInfo[handleStep[6].stepOperation[0]])
if $total.trainingMode != TotalScene.Training_Mode.Exam:
$StepTip.updateOperationTip(handleStep[5].stepName)
handleStepIndex = 5
await $VoiceCommunication.speech_record_check("故障门处置完毕")
elif screenDoor.name == "screenDoor1":
$StepTip.updateOperationTip(handleStep[4].stepName)
if $total.trainingMode != TotalScene.Training_Mode.Exam:
$StepTip.updateOperationTip(handleStep[4].stepName)
stepIndex = 0
currentStep = handleStep[4].stepOperation
$total.currenNeedClickNode = currentStep[stepIndex]
@ -77,16 +81,6 @@ func _on_total_current_click_check_signal(isCorrect):
if $total.trainingMode != TotalScene.Training_Mode.Exam:
$StepJudgment.showError()
##回复收到
func replyReceived() :
var sound = load_mp3("res://Assets/training_speech/sd.mp3")
await $VoiceCommunication.play_reply(sound)
$StepTip.updateOperationTip(handleStep[2].stepName)
$total.currenNeedClickNode = handleStep[2].stepOperation[0]
if $total.trainingMode == TotalScene.Training_Mode.Teach:
currentStep = handleStep[2].stepOperation
$TrainTip.setTrainingTip($total.allClickEquipmentInfo[handleStep[2].stepOperation[0]])
func load_mp3(path):
var file = FileAccess.open(path, FileAccess.READ)
@ -94,6 +88,30 @@ func load_mp3(path):
sound.data = file.get_buffer(file.get_length())
return sound
##回复收到
var sound = load_mp3("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:
currentStep = 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)
stepIndex = 0
currentStep = 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

View File

@ -36,14 +36,11 @@ visible = false
[node name="StepTip" parent="." instance=ExtResource("9_i1htc")]
[node name="textVoice" type="Timer" parent="."]
wait_time = 3.0
one_shot = true
[connection signal="StartTraining" from="TrainingDescDialog" to="." method="_on_training_desc_dialog_start_training"]
[connection signal="close_requested" from="TrainingDescDialog" to="TrainingDescDialog" method="_on_close_requested"]
[connection signal="currentClickCheckSignal" from="total" to="." method="_on_total_current_click_check_signal"]
[connection signal="screenDoorCloseConfirmSignal" from="total" to="." method="_on_total_screen_door_close_confirm_signal"]
[connection signal="screenDoorOpenConfirmSignal" from="total" to="." method="_on_total_screen_door_open_confirm_signal"]
[connection signal="speech_recognition_successed" from="VoiceCommunication" to="." method="_on_voice_communication_speech_recognition_successed"]
[connection signal="two_cancel" from="ConfirmDialog" to="." method="_on_confirm_dialog_two_cancel"]
[connection signal="two_confirm" from="ConfirmDialog" to="." method="_on_confirm_dialog_two_confirm"]