godot-psd-training/trainings/trainingManyOpenDoorFault/trainingManyOpenDoorFault.gd
joylink_fanyuhong 5b00560960 实训调整
2024-05-31 18:48:25 +08:00

278 lines
8.0 KiB
GDScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

extends Node
## 实训名称
@export var trainingName: String = "实训"
## 场景描述
@export var trainingDesc: String = "场景描述"
var stepOperation = []
var handleStep = [
{
"stepName": "步骤一站务员手指上行2号、3号故障门门头灯。站务员口呼多门开门故障。",
"stepOperation": [],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": "多门开门故障。"
},
{
"stepName": "步骤二站务员用对讲机汇报值班员值班员上行2号、3号门开门故障。",
"stepOperation": [],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": "值班员上行2号、3号门开门故障。"
},
{
"stepName": "值班员回复:收到。",
"stepOperation": [],
"next": false,
"checkVoice": "",
"play": true,
"playPath": "res://Assets/training_speech/sd.mp3",
"stepTip": false,
},
{
"stepName": "步骤三站务员用对讲机汇报值班站长值班站长上行2号、3号门开门故障组织乘客由1号、4号门乘降。",
"stepOperation": [],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": "值班站长上行2号、3号门开门故障组织乘客由1号、4号门乘降。"
},
{
"stepName": "值班站长(机器人)自动回复:收到。",
"stepOperation": [],
"next": false,
"checkVoice": "",
"play": true,
"playPath": "res://Assets/training_speech/sd.mp3",
"stepTip": false,
},
{
"stepName": "值班站长(机器人)通知站务员:乘客乘降完毕。",
"stepOperation": [],
"next": false,
"checkVoice": "",
"play": true,
"playPath": "res://Assets/training_speech/trainingManyOpenDoorFault/ckcjwb.mp3",
"stepTip": false,
},
{
"stepName": "步骤四:站务员回复:收到。",
"stepOperation": [],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": "收到。"
},
{
"stepName": "站台门关闭后,值班员通知站务员:上行列车未收到站台门关闭锁紧信息,请处置。",
"stepOperation": [],
"next": false,
"checkVoice": "",
"play": true,
"playPath": "res://Assets/training_speech/trainingManyOpenDoorFault/sxlcwsdztmfbsj.mp3",
"stepTip": false,
},
{
"stepName": "步骤五:站务员回复:收到。",
"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,
"checkVoice": "",
"play": true,
"playPath": "res://Assets/training_speech/trainingTotalPlatformDoorFault/gzmyxf.mp3",
"stepTip": false,
},
{
"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
func _on_training_desc_dialog_start_training():
$total.trainComeAndOpenScreenDoor()
$total.setAssignScreenDoorsOpenFault([TotalScene.ScreenDoor_name.screenDoor2,TotalScene.ScreenDoor_name.screenDoor3])
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)
if step.stepName != "步骤四:站务员回复:收到。":
nextStep()
else :
$CloseScreenDoorTimer.start()
if step.play:
var sound = load(step.playPath)
await $VoiceCommunication.play_reply(sound)
if step.stepName != "值班站长(机器人)自动回复:收到。" and step.stepName != "接到维修人员现场故障修复,即系统自动播放 “故障门已修复”。" :
nextStep()
elif step.stepName == "值班站长(机器人)自动回复:收到。" :
$peopleLeaveTimer.connect("timeout", nextStep)
$peopleLeaveTimer.start()
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 == 'removeHSJCKeyOfWindowPsl' :
$maintainerTimer.start()
elif $total.currentClickNode == 'InterlockReleaseSwitchRightRotate' :
$total.trainLeave(true)
stepOperationIndex = stepOperationIndex + 1
$StepJudgment.hideError()
if stepOperationIndex < stepOperation.size():
setOperationNodeAndTip()
elif $total.currentClickNode != 'removeHSJCKeyOfWindowPsl' :
$TrainTip.setTrainingTip('')
nextStep()
else :
$TrainTip.setTrainingTip('')
else:
if $total.trainingMode != TotalScene.Training_Mode.Exam:
$StepJudgment.showError()
##开门信号
func _on_total_screen_door_open_confirm_signal(screenDoor):
if screenDoor.name == "screenDoor1" :
nextStep()
##关门信号
func _on_total_screen_door_close_confirm_signal(screenDoor):
if screenDoor.name == "screenDoor1" :
nextStep()
func _on_close_screen_door_timer_timeout() -> void:
$total.closeScreenDoor()
func _on_fault_tip_dialog_close_requested() -> void:
$FaultTipDialog.hide()
func _on_fault_tip_dialog_comfirm_signal() -> void:
nextStep()
func _on_maintainer_timer_timeout() -> void:
nextStep()
$FaultTipDialog.show()
$FaultTipDialog.updateSceneDesc('故障门已修复')
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()