开门实训调整(待完善)

This commit is contained in:
joylink_zhaoerwei 2024-05-17 17:37:41 +08:00
parent c3ed310f66
commit 034e60c321
5 changed files with 85 additions and 38 deletions

View File

@ -1,16 +0,0 @@
extends PanelContainer
@export var operationTip = "操作描述"
# Called when the node enters the scene tree for the first time.
func _ready():
$VBoxContainer/Control2/Label.text = operationTip
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func updateOperationTip(desc):
operationTip = desc
$VBoxContainer/Control2/Label.text = desc

View File

@ -0,0 +1,11 @@
extends Node2D
@export var operationTip = "操作步骤描述"
# Called when the node enters the scene tree for the first time.
func _ready():
$PanelContainer/VBoxContainer/Control/Label.text = operationTip
func updateOperationTip(desc):
operationTip = desc
$PanelContainer/VBoxContainer/Control2/Label.text = desc

View File

@ -1,13 +1,13 @@
[gd_scene load_steps=2 format=3 uid="uid://yhr1n6e2m2b6"]
[ext_resource type="Script" path="res://trainings/stepTip/PanelContainer.gd" id="1_2t0ge"]
[ext_resource type="Script" path="res://trainings/stepTip/stepTip.gd" id="1_wxsfb"]
[node name="StepTip" type="Node"]
[node name="StepTip" type="Node2D"]
script = ExtResource("1_wxsfb")
[node name="PanelContainer" type="PanelContainer" parent="."]
offset_right = 300.0
offset_bottom = 180.0
script = ExtResource("1_2t0ge")
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
layout_mode = 2
@ -43,6 +43,8 @@ color = Color(0.0509804, 0.388235, 0.752941, 0.447059)
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/Control2"]
layout_mode = 0
offset_left = 14.0
offset_top = 4.0
offset_right = 40.0
offset_bottom = 27.0
offset_right = 285.0
offset_bottom = 137.0
autowrap_mode = 2

View File

@ -5,45 +5,52 @@ extends Node
## 场景描述
@export var trainingDesc: String = "场景描述"
var currentStep = ["LCB3","LCB_Key2","confirmUseKey","LCB3RightRotate","LCB3RightRotate","LCB3LeftRotate","LCB3LeftRotate","removeKeyOfWindowLCB3"]
var currentStep = ["LCB3","LCB_Key1","confirmUseKey","LCB3RightRotate","LCB3RightRotate","LCB3LeftRotate","LCB3LeftRotate","removeKeyOfWindowLCB1"]
var handleStep = [{"stepName": "步骤一站务员用对讲机汇报值班员值班员上行3号门开门故障使用LCB开启站台门。", "stepOperation": [],},
{"stepName": "步骤二:值班员回复:收到。", "stepOperation": []},
{"stepName": "步骤三站务员用LCB打开3号故障门用 LCB钥匙1号将故障门3号门的LCB转至“开门”位置。", "stepOperation": ["LCB3","LCB_Key1","confirmUseKey","LCB3RightRotate","LCB3RightRotate"]},
{"stepName": "步骤四:站台门打开后,站务员口呼:请有序下车。", "stepOperation": []},
{"stepName": "步骤五站务员用LCB关闭3号故障门停站时间到乘客乘降完毕后用 LCB钥匙1号将故障门3号门的LCB转至“关门”位置。", "stepOperation": []},
{"stepName": "步骤六:故障门处置完毕。", "stepOperation": []},
{"stepName": "步骤七:列车出清站台后,站务员用 LCB钥匙1号将故障门3号门的LCB转至“自动”位置取出钥匙。", "stepOperation": ["LCB3LeftRotate","LCB3LeftRotate","removeKeyOfWindowLCB1"]},
{"stepName": "步骤八站务员用对讲机汇报值班员值班员上行3号门故障已处理完毕。", "stepOperation": []},
{"stepName": "步骤九:值班员回复:收到。", "stepOperation": []},
]
var stepIndex = 0
func _ready():
$TrainingDescDialog.title = trainingName
$TrainingDescDialog.updateSceneDesc(trainingDesc)
$TrainingDescDialog.grab_focus()
$StepTip.visible = false
func _on_training_desc_dialog_start_training():
$total.trainComeAndOpenScreenDoor()
$total.setAssignScreenDoorsOpenFault([TotalScene.ScreenDoor_name.screenDoor3])
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_open_confirm_signal(screenDoor):
if screenDoor.name == "screenDoor1":
var sound = load_mp3("res://Assets/training_speech/kmgz/3hmkmgz.mp3")
await $VoiceCommunication.play_reply(sound)
$total.currenNeedClickNode = currentStep[stepIndex]
if $total.trainingMode == TotalScene.Training_Mode.Teach:
$TrainTip.setTrainingTip($total.allClickEquipmentInfo[currentStep[stepIndex]])
$StepTip.visible = true
$StepTip.updateOperationTip(handleStep[0].stepName)
$textVoice.connect("timeout", replyReceived)
$textVoice.start()
elif screenDoor.name == "screenDoor3":
$DepartTimer.wait_time = 15
$DepartTimer.one_shot = true
$DepartTimer.connect("timeout", depart)
$DepartTimer.start()
func depart():
$total.closeScreenDoor()
##关门信号
func _on_total_screen_door_close_confirm_signal(screenDoor):
if screenDoor.name == "screenDoor3":
$total.trainLeave()
elif screenDoor.name == "screenDoor1":
$StepTip.updateOperationTip(handleStep[4].stepName)
$total.currenNeedClickNode = currentStep[stepIndex]
if $total.trainingMode == TotalScene.Training_Mode.Teach:
$TrainTip.setTrainingTip($total.allClickEquipmentInfo[currentStep[stepIndex]])
@ -62,3 +69,28 @@ func _on_total_current_click_check_signal(isCorrect):
else:
if $total.trainingMode != TotalScene.Training_Mode.Exam:
$StepJudgment.showError()
##回复收到
func replyReceived() :
var sound = load_mp3("res://Assets/training_speech/sd.mp3")
await $VoiceCommunication.play_reply(sound)
$StepTip.updateOperationTip(handleStep[2].stepName)
$total.currenNeedClickNode = handleStep[2].stepOperation[0]
if $total.trainingMode == TotalScene.Training_Mode.Teach:
$TrainTip.setTrainingTip($total.allClickEquipmentInfo[handleStep[2].stepOperation[0]],handleStep[2].stepOperation[0])
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_confirm_dialog_two_cancel():
get_tree().paused = false
func _on_confirm_dialog_two_confirm():
get_tree().paused = false
get_tree().reload_current_scene()

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://nkjskkkwlbc5"]
[gd_scene load_steps=10 format=3 uid="uid://nkjskkkwlbc5"]
[ext_resource type="Script" path="res://trainings/trainingOpenDoorFault/trainingOpenDoorFault.gd" id="1_2u0o8"]
[ext_resource type="PackedScene" uid="uid://qh8b3g6n3k2u" path="res://trainings/training_desc_dialog.tscn" id="2_qfrwf"]
@ -6,17 +6,22 @@
[ext_resource type="PackedScene" uid="uid://6lortgihx5jy" path="res://Communication/voice_communication.tscn" id="4_a40lw"]
[ext_resource type="PackedScene" uid="uid://ckoxw6kgpjyhd" path="res://trainings/trainTip.tscn" id="5_c62p3"]
[ext_resource type="PackedScene" uid="uid://b41vwoibfy5c6" path="res://trainings/stepJudgment.tscn" id="6_32733"]
[ext_resource type="PackedScene" uid="uid://b3whbe3mau53w" path="res://trainings/confirmDialog/confirmDialog.tscn" id="7_nkclh"]
[ext_resource type="PackedScene" uid="uid://bsb3nyi8xaqwh" path="res://trainings/trainingPanel/trainingPanel.tscn" id="8_lfro2"]
[ext_resource type="PackedScene" uid="uid://yhr1n6e2m2b6" path="res://trainings/stepTip/stepTip.tscn" id="9_i1htc"]
[node name="trainingOpenDoorFault" type="Node"]
script = ExtResource("1_2u0o8")
trainingName = "站台单档滑动门开门故障处置"
trainingDesc = "列车开门作业,突发单个站台门未正常打开。"
trainingDesc = "列车开门作业,突发单个站台门未正常开启"
[node name="TrainingDescDialog" parent="." instance=ExtResource("2_qfrwf")]
[node name="total" parent="." instance=ExtResource("3_28hir")]
[node name="DepartTimer" type="Timer" parent="."]
wait_time = 15.0
one_shot = true
[node name="VoiceCommunication" parent="." instance=ExtResource("4_a40lw")]
@ -24,8 +29,21 @@ trainingDesc = "列车开门作业,突发单个站台门未正常打开。"
[node name="StepJudgment" parent="." instance=ExtResource("6_32733")]
[node name="ConfirmDialog" parent="." instance=ExtResource("7_nkclh")]
visible = false
[node name="TrainingPanel" parent="." instance=ExtResource("8_lfro2")]
[node name="StepTip" parent="." instance=ExtResource("9_i1htc")]
[node name="textVoice" type="Timer" parent="."]
wait_time = 3.0
one_shot = true
[connection signal="StartTraining" from="TrainingDescDialog" to="." method="_on_training_desc_dialog_start_training"]
[connection signal="close_requested" from="TrainingDescDialog" to="TrainingDescDialog" method="_on_close_requested"]
[connection signal="currentClickCheckSignal" from="total" to="." method="_on_total_current_click_check_signal"]
[connection signal="screenDoorCloseConfirmSignal" from="total" to="." method="_on_total_screen_door_close_confirm_signal"]
[connection signal="screenDoorOpenConfirmSignal" from="total" to="." method="_on_total_screen_door_open_confirm_signal"]
[connection signal="two_cancel" from="ConfirmDialog" to="." method="_on_confirm_dialog_two_cancel"]
[connection signal="two_confirm" from="ConfirmDialog" to="." method="_on_confirm_dialog_two_confirm"]