godot-psd-training/trainings/trainingGlassBreakageFault/trainingGlassBreakageFault.gd

294 lines
9.1 KiB
GDScript3
Raw Normal View History

2024-05-08 16:15:27 +08:00
extends Node
## 实训名称
@export var trainingName: String = "实训"
## 场景描述
@export var trainingDesc: String = "场景描述"
2024-05-28 15:40:46 +08:00
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": "设置安全防护栏。"
},
{
"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,
2024-05-28 17:50:24 +08:00
"playPath": "res://Assets/training_speech/trainingGlassBreakageFault/sxgqblqlwb.mp3",
2024-05-28 15:40:46 +08:00
"stepTip": false,
},
{
"stepName": "步骤十二:行值对讲机回复:上行轨行区玻璃已清理完毕,人员已出清,收到。",
"stepOperation": [],
"next": false,
"checkVoice": "",
"play": true,
2024-05-28 17:50:24 +08:00
"playPath": "res://Assets/training_speech/trainingGlassBreakageFault/sxgqblqlwbsd.mp3",
2024-05-28 15:40:46 +08:00
"stepTip": false,
},
{
"stepName": "联系并恢复 步骤一站务员用对讲机联系值班员值班员上行2号门已粘贴完毕处于隔离位现场处置完毕请恢复上行紧急停车。",
"stepOperation": [],
"next": false,
"play": false,
"playPath": "",
"stepTip": true,
"checkVoice": "值班员上行2号门已粘贴完毕处于隔离位现场处置完毕请恢复上行紧急停车。"
},
{
"stepName": "步骤二:值班员用对讲机回复站务员:收到,恢复上行紧急停车。",
"stepOperation": [],
"next": false,
"checkVoice": "",
"play": true,
2024-05-28 17:50:24 +08:00
"playPath": "res://Assets/training_speech/trainingGlassBreakageFault/sdhfsxjjtc.mp3",
2024-05-28 15:40:46 +08:00
"stepTip": false,
},
{
"stepName": "值班员的一系列操作后,实训完成!",
"stepOperation": [],
"next": false,
"checkVoice": "",
"play": false,
"playPath": "",
"stepTip": true,
},
]
## 步骤操作执行index
var stepOperationIndex = 0
## 步骤执行index
var handleStepIndex = 0
2024-05-08 16:15:27 +08:00
func _ready():
$TrainingDescDialog.title = trainingName
$TrainingDescDialog.updateSceneDesc(trainingDesc)
2024-05-28 15:40:46 +08:00
$TrainingDescDialog.grab_focus()
stepOperationIndex = 0
handleStepIndex = 0
2024-05-08 16:15:27 +08:00
func _on_training_desc_dialog_start_training():
2024-05-28 15:40:46 +08:00
$glassBreakageTimer.start()
2024-05-08 16:15:27 +08:00
2024-05-28 15:40:46 +08:00
func _on_glass_breakage_timer_timeout() -> void:
2024-05-08 16:15:27 +08:00
$total.setAssignScreenDoorsGlassBreakageFault([TotalScene.ScreenDoor_name.screenDoor2])
2024-05-28 15:40:46 +08:00
$total.setAssignTrainDoorsOpenFault([TotalScene.ScreenDoor_name.screenDoor2])
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()