添加站台门检查实训

This commit is contained in:
joylink_fanyuhong 2024-08-13 16:02:42 +08:00
parent d510abcac6
commit db1b6b73e9
4 changed files with 296 additions and 0 deletions

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://cm61ga36jv4dw"
path="res://.godot/imported/testNormal.mp3-2d8aa5eeb77c88bae98b0413e54ad552.mp3str"
[deps]
source_file="res://Assets/training_speech/trainingDoorInspection/testNormal.mp3"
dest_files=["res://.godot/imported/testNormal.mp3-2d8aa5eeb77c88bae98b0413e54ad552.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -0,0 +1,248 @@
extends Node
## 实训名称
@export var trainingName: String = "实训"
## 场景描述
@export var trainingDesc: String = "站台门工作正常,需检查站台门工作状态。此任务结束后,对讲机放在站台门区域指定位置,不可带到调度中心。"
## 当前步骤操作
var stepOperation = []
## 步骤列表
var handleStep = [
{
"stepName": "步骤一:站务员手指:上行站台轨行区;站务员口呼:上行线路出清,无异常。",
"stepOperation": [],
"next": false,
"checkVoice": "上行线路出清,无异常。",
"play": false,
"playPath": "",
"notip": false,
},
{
"stepName": "步骤二开站台门一次测试使用PSL打开上行整侧站台门。",
"stepOperation": ["PSL","PSL_Key","confirmUseKey","PSLAllowRightRotate","OpenDoorButton",],
"next": false,
"checkVoice": "",
"play": false,
"playPath": "",
"notip": false,
},
{
"stepName": "步骤三站务员手指PSL开门到位指示灯站务员口呼上行站台门开门正常PSL开门到位指示灯亮黄灯。",
"stepOperation": [],
"play": false,
"playPath": "",
"notip": false,
"next": false,
"checkVoice": "上行站台门开门正常PSL开门到位指示灯亮黄灯"
},
{
"stepName": "步骤四关站台门一次测试使用PSL关闭上行整侧站台门。",
"stepOperation": ["CloseDoorButton"],
"next": false,
"play": false,
"playPath": "",
"notip": false,
"checkVoice": ""
},
{
"stepName": "步骤五站务员手指PSL全部门关闭锁紧指示灯站务员口呼上行站台门关门正常PSL上关闭锁紧指示灯亮绿灯 。",
"stepOperation": [],
"checkVoice": "上行站台门关门正常PSL上关闭锁紧指示灯亮绿灯。",
"next": false,
"play": false,
"playPath": "",
"notip": false,
},
{
"stepName": "步骤六开站台门二次测试使用PSL打开上行整侧站台门。",
"stepOperation": ["OpenDoorButton"],
"checkVoice":"",
"next": false,
"play": false,
"playPath": "",
"notip": false,
},
{
"stepName": "步骤七关站台门二次测试使用PSL关闭上行整侧站台门。",
"stepOperation": ["CloseDoorButton"],
"next": false,
"play": false,
"playPath": "",
"notip": false,
"checkVoice": ""
},
{
"stepName": "步骤八:站务员口呼:整侧站台门开关正常",
"stepOperation": [],
"checkVoice":"整侧站台门开关正常",
"playPath": "",
"next": false,
"play": false,
"notip": false,
},
{
"stepName": "步骤九将PSL操作允许开关恢复至无效位并拔出钥匙。",
"stepOperation": ["PSLAllowLeftRotate","removePSLKeyOfWindowPsl"],
"checkVoice":"",
"playPath": "",
"next": false,
"play": false,
"notip": false,
},
{
"stepName": "步骤十:站务员手指:滑动门门头灯;站务员口呼:滑动门处于正常锁闭状态,门头灯不亮 。",
"stepOperation": [],
"checkVoice":"滑动门处于正常锁闭状态,门头灯不亮 。",
"playPath": "",
"next": false,
"play": false,
"notip": false,
},
{
"stepName": "步骤十一:站务员手指:应急门;站务员口呼:应急门处于正常锁闭状态 。",
"stepOperation": [],
"checkVoice":"应急门处于正常锁闭状态 。",
"playPath": "",
"next": false,
"play": false,
"notip": false,
},
{
"stepName": "步骤十二:站务员手指:端门;站务员口呼:端门处于正常锁闭状态 。",
"stepOperation": [],
"checkVoice":"端门处于正常锁闭状态。",
"playPath": "",
"next": false,
"play": false,
"notip": false,
},
{
"stepName": "步骤十三:站务员汇报值班员:上行线路已出清,上行站台门测试正常。",
"stepOperation": [],
"checkVoice":"上行线路已出清,上行站台门测试正常。",
"playPath": "",
"next": false,
"play": false,
"notip": false,
},
{
"stepName": "值班员回复站务员:上行线路已出清,上行站台门测试正常,值班员明白。",
"stepOperation": [],
"play": true,
"playPath": "res://Assets/training_speech/trainingDoorInspection/testNormal.mp3",
"notip": true,
"next": false,
"checkVoice": ""
},
{
"stepName": "实训已结束",
"stepOperation": [],
"play": false,
"playPath": "",
"notip": false,
"next": false,
"checkVoice": ""
},
]
## 步骤操作执行index
var stepOperationIndex = 0
## 步骤执行index
var stepIndex = 0
func _ready():
$TrainingDescDialog.title = trainingName
$TrainingDescDialog.updateSceneDesc(trainingDesc)
$TrainingDescDialog.grab_focus()
stepOperationIndex = 0
stepIndex = 0
## 弹框点击开始实训
var voiceCommunication
func _on_training_desc_dialog_start_training():
voiceCommunication = preload("res://Communication/voice_communication.tscn").instantiate()
add_child(voiceCommunication)
nextStep()
#$total.trainComeAndOpenScreenDoor()
#$total.setAssignScreenDoorsCloseFault([TotalScene.ScreenDoor_name.screenDoor2])
#$DepartTimer.wait_time = 15
#$DepartTimer.one_shot = true
#$DepartTimer.connect("timeout", closeScreenDoor)
#$DepartTimer.start()
#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 nextStep():
if stepIndex < handleStep.size():
var step = handleStep[stepIndex]
stepIndex = stepIndex + 1
if step.notip == false and $total.trainingMode != TotalScene.Training_Mode.Exam:
$StepTip.updateOperationTip(step.stepName)
else:
$StepTip.updateOperationTip("")
if step.stepOperation.size() > 0: ## 如果步骤有具体操作进入操作并初始化
initStepOperation()
if step.next == true: ## 如果步骤为直接进入下一步 则延时进入定时器
$StepTimer.wait_time = step.waitTime
$StepTimer.one_shot = 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()
## 设置操作的node节点和特定模式下的提示
func setOperationNodeAndTip():
$total.currenNeedClickNode = stepOperation[stepOperationIndex]
if $total.trainingMode == TotalScene.Training_Mode.Teach:
$TrainTip.setTrainingTip($total.allClickEquipmentInfo[stepOperation[stepOperationIndex]])
## 初始化步骤操作
func initStepOperation():
stepOperation = handleStep[stepIndex-1].stepOperation
stepOperationIndex = 0
setOperationNodeAndTip()
## 步骤操作节点点击正确
func _on_total_current_click_check_signal(isCorrect):
if isCorrect:
stepOperationIndex = stepOperationIndex + 1
$StepJudgment.hideError()
if $total.currentClickNode == 'CloseDoorButton':
$total.closeOnlyScreenDoor()
elif $total.currentClickNode == 'OpenDoorButton':
$total.openOnlyScreenDoor()
if stepOperationIndex < stepOperation.size():
setOperationNodeAndTip()
else:
$TrainTip.setTrainingTip('')
nextStep()
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()
func _on_step_tip_click_next_step() -> void:
var step = handleStep[stepIndex-1]
if step.checkVoice:
voiceCommunication._reset_record_state()
nextStep()

View File

@ -0,0 +1,29 @@
[gd_scene load_steps=8 format=3 uid="uid://d3q0sq50y4omw"]
[ext_resource type="Script" path="res://trainings/trainingDoorInspection/trainingDoorInspection.gd" id="1_3fyg1"]
[ext_resource type="PackedScene" uid="uid://qh8b3g6n3k2u" path="res://trainings/training_desc_dialog.tscn" id="2_s3jcf"]
[ext_resource type="PackedScene" uid="uid://btcksdsburk7t" path="res://sceen/total.tscn" id="3_l37wb"]
[ext_resource type="PackedScene" uid="uid://ckoxw6kgpjyhd" path="res://trainings/trainTip.tscn" id="4_a4vkp"]
[ext_resource type="PackedScene" uid="uid://b41vwoibfy5c6" path="res://trainings/stepJudgment.tscn" id="5_bwive"]
[ext_resource type="PackedScene" uid="uid://yhr1n6e2m2b6" path="res://trainings/stepTip/stepTip.tscn" id="6_ychkj"]
[ext_resource type="PackedScene" uid="uid://b3whbe3mau53w" path="res://trainings/confirmDialog/confirmDialog.tscn" id="7_dsiri"]
[node name="TrainingDoorInspection" type="Node"]
script = ExtResource("1_3fyg1")
[node name="TrainingDescDialog" parent="." instance=ExtResource("2_s3jcf")]
[node name="total" parent="." instance=ExtResource("3_l37wb")]
[node name="TrainTip" parent="." instance=ExtResource("4_a4vkp")]
[node name="StepJudgment" parent="." instance=ExtResource("5_bwive")]
[node name="StepTip" parent="." instance=ExtResource("6_ychkj")]
[node name="ConfirmDialog" parent="." instance=ExtResource("7_dsiri")]
visible = false
[connection signal="StartTraining" from="TrainingDescDialog" to="." method="_on_training_desc_dialog_start_training"]
[connection signal="currentClickCheckSignal" from="total" to="." method="_on_total_current_click_check_signal"]
[connection signal="clickNextStep" from="StepTip" to="." method="_on_step_tip_click_next_step"]