godot-psd-training/trainings/trainingGlassBreakageFault/trainingGlassBreakageFault.gd
2024-06-06 11:04:52 +08:00

304 lines
9.2 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号站台门;站务员口呼上行2号滑动门玻璃破碎。",
"stepOperation": [],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": "上行2号滑动门玻璃破碎。"
},
{
"stepName": "步骤二:站务员按下上行站台紧急停车按钮(阻止列车进站)。",
"stepOperation": ["JJTC","JJTC_Key","confirmUseKey","JJTCRightRotate","JJTCButton","JJTCCloseBox","JJTCLeftRotate"],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": ""
},
{
"stepName": "步骤三站务员用对讲机汇报值班员值班员上行2号滑动门玻璃破碎已按下上行紧急停车按钮。",
"stepOperation": [],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": "值班员上行2号滑动门玻璃破碎已按下上行紧急停车按钮。"
},
{
"stepName": "值班员回复站务员:收到。",
"stepOperation": [],
"next": false,
"checkVoice": "",
"play": true,
"playPath": "res://Assets/training_speech/sd.mp3",
"stepTip": false,
},
{
"stepName": "步骤四站务员发现有玻璃掉落轨行区影响行车汇报现场情况值班员、值班站长上行2号滑动门玻璃破碎玻璃掉落轨行区影响行车请派人处置。",
"stepOperation": [],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": "值班员、值班站长上行2号滑动门玻璃破碎玻璃掉落轨行区影响行车请派人处置。"
},
{
"stepName": "值班站长(机器人)自动回复:收到;值班员回复站务员:收到。",
"stepOperation": [],
"next": false,
"checkVoice": "",
"play": true,
"playPath": "res://Assets/training_speech/sd.mp3",
"stepTip": false,
},
{
"stepName": "步骤五站务员旁路相邻门将3号门LCB打至“开门”位泄除隧道风压。",
"stepOperation": ["LCB3","LCB_Key1","confirmUseKey","LCB3RightRotate","LCB3RightRotate"],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": ""
},
{
"stepName": "步骤六站务员隔离故障门将2号门LCB打至“隔离”位。",
"stepOperation": ["LCB2","LCB_Key2","confirmUseKey","LCB2LeftRotate"],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": ""
},
{
"stepName": "步骤七:站务员口呼:设置安全防护栏。",
"stepOperation": [],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": "设置安全防护栏。"
},
{
"stepName": "步骤八站务员设置3号门安全护栏在3号滑动门处设置安全防护栏。",
"stepOperation": ["screenDoor3RightClick","clickIsolationStripOfscreenDoor3"],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": ""
},
{
"stepName": "步骤九站务员设置2号门安全护栏在2号滑动门处设置安全防护栏。",
"stepOperation": ["screenDoor2RightClick","clickIsolationStripOfscreenDoor2"],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": ""
},
{
"stepName": "步骤十站务员口呼粘贴2号滑动门。",
"stepOperation": [],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": "粘贴2号滑动门。"
},
{
"stepName": "步骤十一站务员粘贴破碎站台门用胶带手动粘贴2号滑动门。",
"stepOperation": ["screenDoor2RightClick","clickAdhesiveTapeOfscreenDoor2"],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": ""
},
{
"stepName": "步骤十二站务员用LCB钥匙1号将3号门的LCB转至“关门”位置。",
"stepOperation": ["LCB3","LCB3LeftRotate"],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": ""
},
{
"stepName": "步骤十三3号门关闭后站务员用LCB钥匙1号将3号门的LCB转至“自动”位置取出钥匙。",
"stepOperation": ["LCB3LeftRotate","removeKeyOfWindowLCB3"],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": ""
},
{
"stepName": "步骤十四站务员撤出3号门安全护栏撤除3号滑动门处安全防护栏。",
"stepOperation": ["screenDoor3RightClick","clickIsolationStripOfscreenDoor3"],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": ""
},
{
"stepName": "值班站长(机器人)对讲机联系行值:上行轨行区玻璃已清理完毕,人员已出清。",
"stepOperation": [],
"next": false,
"checkVoice": "",
"play": true,
"playPath": "res://Assets/training_speech/trainingGlassBreakageFault/sxgqblqlwb.mp3",
"stepTip": false,
},
{
"stepName": "行值对讲机回复:上行轨行区玻璃已清理完毕,人员已出清,收到。",
"stepOperation": [],
"next": false,
"checkVoice": "",
"play": true,
"playPath": "res://Assets/training_speech/trainingGlassBreakageFault/sxgqblqlwbsd.mp3",
"stepTip": false,
},
{
"stepName": "步骤十五站务员用对讲机联系值班员值班员上行2号门已粘贴完毕处于隔离位现场处置完毕请恢复上行紧急停车。",
"stepOperation": [],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": "值班员上行2号门已粘贴完毕处于隔离位现场处置完毕请恢复上行紧急停车。"
},
{
"stepName": "值班员用对讲机回复站务员:收到,恢复上行紧急停车。",
"stepOperation": [],
"next": false,
"checkVoice": "",
"play": true,
"playPath": "res://Assets/training_speech/trainingGlassBreakageFault/sdhfsxjjtc.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 voiceCommunication
func _on_training_desc_dialog_start_training():
voiceCommunication = preload("res://Communication/voice_communication.tscn").instantiate()
add_child(voiceCommunication)
$glassBreakageTimer.start()
func _on_glass_breakage_timer_timeout() -> void:
$total.setAssignScreenDoorsGlassBreakageFault([TotalScene.ScreenDoor_name.screenDoor2])
$total.setAssignTrainDoorsOpenFault([TotalScene.TrainDoor_name.trainDoor2])
handleStepIndex = 0
nextStep()
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.play:
var sound = load(step.playPath)
await voiceCommunication.play_reply(sound)
nextStep()
if step.stepName == "值班员的一系列操作后,实训完成!":
$total.trainComeAndOpenScreenDoor ()
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:
stepOperationIndex = stepOperationIndex + 1
$StepJudgment.hideError()
if stepOperationIndex < stepOperation.size():
if stepOperation[stepOperationIndex-1] in ['screenDoor2RightClick','screenDoor3RightClick'] :
$ScreenDoorRightClickTimer.connect("timeout", setOperationNodeAndTip)
$ScreenDoorRightClickTimer.start()
else :
setOperationNodeAndTip()
else:
$TrainTip.setTrainingTip('')
if handleStepIndex != 7 and handleStepIndex != 14:
nextStep()
else:
if $total.trainingMode != TotalScene.Training_Mode.Exam:
$StepJudgment.showError()
##开门信号
func _on_total_screen_door_open_confirm_signal(screenDoor):
if screenDoor.name == "screenDoor3" :
nextStep()
##关门信号
func _on_total_screen_door_close_confirm_signal(screenDoor):
if screenDoor.name == "screenDoor3" :
nextStep()
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()