96 lines
3.6 KiB
GDScript
96 lines
3.6 KiB
GDScript
extends Node
|
||
|
||
## 实训名称
|
||
@export var trainingName: String = "实训"
|
||
## 场景描述
|
||
@export var trainingDesc: String = "列车关门作业,突发单个站台门未正常关闭。"
|
||
|
||
var currentStep = []
|
||
|
||
var handleStep = [{"stepName": "步骤一:站务员用对讲机汇报值班员:值班员,上行2号门关门故障,使用LCB关闭站台门。", "stepOperation": [],},
|
||
{"stepName": "步骤二:值班员回复:收到。", "stepOperation": []},
|
||
{"stepName": "步骤三:站务员用LCB钥匙(1号)将故障门(2号门)的LCB转至“关门”位置。", "stepOperation": ["LCB2","LCB_Key1","confirmUseKey","LCB2RightRotate"]},
|
||
{"stepName": "步骤四:站务员确认故障门关闭。站务员手指:上行2号门门头灯和上行2号站台门。", "stepOperation": []},
|
||
{"stepName": "步骤五:站务员口呼:门头灯熄灭,关门成功。", "stepOperation": ["LCB3LeftRotate"]},
|
||
{"stepName": "步骤六:站务员口呼:故障门处置完毕。", "stepOperation": []},
|
||
{"stepName": "步骤七:列车出清站台后,站务员用LCB钥匙(1号)将故障门(2号门)的LCB转至“自动”位置,取出钥匙。", "stepOperation": ["LCB2LeftRotate","removeKeyOfWindowLCB2"]},
|
||
{"stepName": "步骤八:站务员用对讲机汇报值班员:值班员,上行2号门故障已处理完毕。", "stepOperation": []},
|
||
{"stepName": "步骤九:值班员回复:收到。", "stepOperation": []},
|
||
]
|
||
|
||
var stepIndex = 0
|
||
|
||
func _ready():
|
||
$TrainingDescDialog.title = trainingName
|
||
$TrainingDescDialog.updateSceneDesc(trainingDesc)
|
||
stepIndex = 0
|
||
|
||
|
||
func _on_training_desc_dialog_start_training():
|
||
$total.trainComeAndOpenScreenDoor()
|
||
$total.setAssignScreenDoorsCloseFault([TotalScene.ScreenDoor_name.screenDoor2])
|
||
$DepartTimer.wait_time = 15
|
||
$DepartTimer.one_shot = true
|
||
$DepartTimer.connect("timeout", depart)
|
||
$DepartTimer.start()
|
||
|
||
|
||
func depart():
|
||
$total.closeScreenDoor()
|
||
|
||
|
||
func load_mp3(path):
|
||
var file = FileAccess.open(path, FileAccess.READ)
|
||
var sound = AudioStreamMP3.new()
|
||
sound.data = file.get_buffer(file.get_length())
|
||
return sound
|
||
|
||
|
||
func _on_total_screen_door_close_confirm_signal(screenDoor):
|
||
if screenDoor.name == "screenDoor1":
|
||
$StepTip.updateOperationTip(handleStep[0].stepName)
|
||
#var sound = load_mp3("res://Assets/training_speech/gmgz/2hmgmgz.mp3")
|
||
#await $VoiceCommunication.play_reply(sound)
|
||
#$total.currenNeedClickNode = currentStep[stepIndex]
|
||
#if $total.trainingMode == TotalScene.Training_Mode.Teach:
|
||
#$TrainTip.setTrainingTip($total.allClickEquipmentInfo[currentStep[stepIndex]])
|
||
if screenDoor.name == "screenDoor2":
|
||
var sound3 = load_mp3("res://Assets/training_speech/gmgz/mtdxm.mp3")
|
||
await $VoiceCommunication.play_reply(sound3)
|
||
$total.trainLeave()
|
||
|
||
func _input(event):
|
||
if event is InputEventKey:
|
||
if event.pressed:
|
||
if event.keycode == KEY_SPACE: # 检查是否按下了空格键
|
||
$VoiceCommunication.speech_record_check(event.keycode)
|
||
|
||
|
||
|
||
func _on_total_current_click_check_signal(isCorrect):
|
||
if isCorrect:
|
||
stepIndex = stepIndex + 1
|
||
$StepJudgment.hideError()
|
||
if stepIndex < currentStep.size():
|
||
$total.currenNeedClickNode = currentStep[stepIndex]
|
||
if $total.trainingMode == TotalScene.Training_Mode.Teach:
|
||
$TrainTip.setTrainingTip($total.allClickEquipmentInfo[currentStep[stepIndex]])
|
||
else:
|
||
$TrainTip.setTrainingTip('')
|
||
else:
|
||
if $total.trainingMode != TotalScene.Training_Mode.Exam:
|
||
$StepJudgment.showError()
|
||
|
||
|
||
|
||
|
||
|
||
|
||
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()
|