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

65 lines
2.2 KiB
GDScript3
Raw Normal View History

extends Node
## 实训名称
@export var trainingName: String = "实训"
## 场景描述
@export var trainingDesc: String = "场景描述"
2024-05-14 14:13:17 +08:00
var currentStep = ["LCB3","LCB_Key2","confirmUseKey","LCB3RightRotate","LCB3RightRotate","LCB3LeftRotate","LCB3LeftRotate","removeKeyOfWindowLCB3"]
var stepIndex = 0
func _ready():
$TrainingDescDialog.title = trainingName
$TrainingDescDialog.updateSceneDesc(trainingDesc)
func _on_training_desc_dialog_start_training():
$total.trainComeAndOpenScreenDoor()
2024-05-14 10:42:45 +08:00
$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)
2024-05-14 14:13:17 +08:00
$total.currenNeedClickNode = currentStep[stepIndex]
if $total.trainingMode == TotalScene.Training_Mode.Teach:
$TrainTip.setTrainingTip($total.allClickEquipmentInfo[currentStep[stepIndex]])
2024-05-14 10:42:45 +08:00
elif screenDoor.name == "screenDoor3":
$DepartTimer.wait_time = 15
$DepartTimer.one_shot = true
$DepartTimer.connect("timeout", depart)
$DepartTimer.start()
2024-05-14 14:13:17 +08:00
2024-05-14 10:42:45 +08:00
func depart():
$total.closeScreenDoor()
func _on_total_screen_door_close_confirm_signal(screenDoor):
if screenDoor.name == "screenDoor3":
$total.trainLeave()
2024-05-14 14:13:17 +08:00
elif screenDoor.name == "screenDoor1":
$total.currenNeedClickNode = currentStep[stepIndex]
if $total.trainingMode == TotalScene.Training_Mode.Teach:
$TrainTip.setTrainingTip($total.allClickEquipmentInfo[currentStep[stepIndex]])
func _on_total_current_click_check_signal(isCorrect):
if isCorrect:
stepIndex = stepIndex + 1
$StepJudgment.hideError()
if stepIndex < currentStep.size() and stepIndex != 5:
$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()