Merge branch 'main' of https://gitea.joylink.club/joylink/godot-psd-training into main
This commit is contained in:
commit
ba0517a269
@ -34,9 +34,9 @@ func change_knob_state(state):
|
||||
knob_state = state
|
||||
currenScreenDoor.lcbKey.keyState = knob_state
|
||||
if knob_state==KNOB_STATE.OPEN:
|
||||
currenScreenDoor.openScreenDoor()
|
||||
currenScreenDoor.openScreenDoor(true)
|
||||
elif knob_state==KNOB_STATE.CLOSE:
|
||||
currenScreenDoor.closeScreenDoor()
|
||||
currenScreenDoor.closeScreenDoor(true)
|
||||
|
||||
##展示控制的钥匙
|
||||
func shouHandleKey(keyName:String):
|
||||
|
@ -102,9 +102,9 @@ size_flags_horizontal = 4
|
||||
buttonType = 2
|
||||
buttonText = "灯测试按钮"
|
||||
|
||||
[node name="PSTHandle" parent="MarginContainer/GridContainer" instance=ExtResource("6_8mvyb")]
|
||||
[node name="PSTHandle" parent="MarginContainer/GridContainer" instance=ExtResource("6_nn68f")]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 6
|
||||
lightType = 1
|
||||
lightText = "PST操作指示灯"
|
||||
|
||||
[node name="trainDepartsButton" parent="MarginContainer/GridContainer" instance=ExtResource("7_p8tve")]
|
||||
@ -137,7 +137,6 @@ texture = ExtResource("7_643a1")
|
||||
[connection signal="clickKeySwitchSignal" from="MarginContainer/GridContainer/InterlockReleaseSwitch" to="." method="onHandleSignal"]
|
||||
[connection signal="removeKey" from="MarginContainer/GridContainer/InterlockReleaseSwitch" to="." method="remove_key"]
|
||||
[connection signal="clickButtonSignal" from="MarginContainer/GridContainer/MarginContainer2/VBoxContainer/LightTestButton" to="." method="onHandleSignal"]
|
||||
[connection signal="clickKeySwitchSignal" from="MarginContainer/GridContainer/PSTHandle" to="." method="onHandleSignal"]
|
||||
[connection signal="clickButtonSignal" from="MarginContainer/GridContainer/trainDepartsButton" to="." method="onHandleSignal"]
|
||||
[connection signal="clickButtonSignal" from="MarginContainer/GridContainer/interconnectedCloseButton" to="." method="onHandleSignal"]
|
||||
[connection signal="clickButtonSignal" from="MarginContainer/GridContainer/interconnectedOpenButton" to="." method="onHandleSignal"]
|
||||
|
@ -26,7 +26,7 @@ func allScreenDoorClose ()-> bool:
|
||||
return false
|
||||
return true
|
||||
|
||||
##有屏蔽门关门到位
|
||||
##有屏蔽门开门到位
|
||||
func hasScreenDoorOpen ()-> bool:
|
||||
for child in screenDoorALL:
|
||||
if child.screenDoorState == ScreenDoor.ScreenDoor_State.open :
|
||||
@ -44,16 +44,3 @@ func _ready() -> void:
|
||||
screenDoorInstance.name = 'screenDoor{0}'.format([i])
|
||||
screenDoorInstance.connect("clickLcbSignalAndSent",Callable($LCB,"_on_screen_door_click_lcb_signal"))
|
||||
screenDoorInstance.connect("clicksScreenDoorSignal",Callable($ScreenDoorOperate,"_on_screen_door_click_signal"))
|
||||
|
||||
|
||||
var count=0
|
||||
func _process(delta: float) -> void:
|
||||
count+=1
|
||||
if count>150 and count<360:
|
||||
if screenDoorALL[0].screenDoorState == ScreenDoor.ScreenDoor_State.close:
|
||||
openScreenDoorALL()
|
||||
elif count>540 and count<720 :
|
||||
if screenDoorALL[0].screenDoorState == ScreenDoor.ScreenDoor_State.open:
|
||||
closeScreenDoorALL()
|
||||
elif count>2000 :
|
||||
count=0
|
||||
|
@ -41,16 +41,16 @@ enum ScreenDoor_State{
|
||||
right_animation_player.play("rightClose")
|
||||
|
||||
##打开屏蔽门
|
||||
func openScreenDoor ()-> void:
|
||||
if screenDoorState == ScreenDoor_State.close :
|
||||
func openScreenDoor (isUseLCBKey=false)-> void:
|
||||
if screenDoorState == ScreenDoor_State.close and (screenDoorFaultState != ScreenDoor_Fault_State.openFault or isUseLCBKey):
|
||||
screenDoorState=ScreenDoor_State.opening
|
||||
$Timer.connect('timeout', _on_timer_timeout)
|
||||
$Timer.start(0.5)
|
||||
|
||||
|
||||
##关闭屏蔽门
|
||||
func closeScreenDoor ()-> void:
|
||||
if screenDoorState == ScreenDoor_State.open :
|
||||
func closeScreenDoor (isUseLCBKey=false)-> void:
|
||||
if screenDoorState == ScreenDoor_State.open and (screenDoorFaultState != ScreenDoor_Fault_State.closeFault or isUseLCBKey):
|
||||
screenDoorState=ScreenDoor_State.closeing
|
||||
|
||||
|
||||
|
50
sceen/total.gd
Normal file
50
sceen/total.gd
Normal file
@ -0,0 +1,50 @@
|
||||
extends Node3D
|
||||
|
||||
class_name TotalScene
|
||||
|
||||
##开始实训,车主动来和开屏蔽门
|
||||
func beginTraining ()-> void:
|
||||
$train.trainCome()
|
||||
$BeginTimer.start()
|
||||
|
||||
func _on_beginTimer_timeout() -> void:
|
||||
$Timer.start()
|
||||
$train.openLeftTrainDoorALL()
|
||||
$platform.openScreenDoorALL()
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
$train.closeLeftTrainDoorALL()
|
||||
$platform.closeScreenDoorALL()
|
||||
$EndTimer.start()
|
||||
|
||||
func _on_end_timer_timeout() -> void:
|
||||
$train.trainLeave()
|
||||
|
||||
|
||||
##关屏蔽门
|
||||
func closeAllScreenDoor() -> void:
|
||||
pass
|
||||
|
||||
## 屏蔽门名字的枚举
|
||||
enum ScreenDoor_name{
|
||||
screenDoor1=1,
|
||||
screenDoor2,
|
||||
screenDoor3,
|
||||
screenDoor4,
|
||||
}
|
||||
|
||||
##设置指定屏蔽门开门故障
|
||||
func setAssignScreenDoorsOpenFault (screenDoorNames:Array)-> void:
|
||||
for child in $platform.screenDoorALL:
|
||||
var screenDoorName=String(child.name)
|
||||
var screenDoorIndex=int(screenDoorName[screenDoorName.length() - 1])
|
||||
if screenDoorIndex in screenDoorNames:
|
||||
child.setScreenDoorFault(ScreenDoor.ScreenDoor_Fault_State.openFault)
|
||||
|
||||
##设置指定屏蔽门关门故障
|
||||
func setAssignScreenDoorsCloseFault (screenDoorNames:Array)-> void:
|
||||
for child in $platform.screenDoorALL:
|
||||
var screenDoorName=String(child.name)
|
||||
var screenDoorIndex=int(screenDoorName[screenDoorName.length() - 1])
|
||||
if screenDoorIndex in screenDoorNames:
|
||||
child.setScreenDoorFault(ScreenDoor.ScreenDoor_Fault_State.closeFault)
|
@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://btcksdsburk7t"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://btcksdsburk7t"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cmnsn2joxo68l" path="res://sceen/platform/platform.tscn" id="1_rjva4"]
|
||||
[ext_resource type="Script" path="res://sceen/total.gd" id="1_s45rl"]
|
||||
[ext_resource type="PackedScene" uid="uid://nx6xnwcuq8cf" path="res://sceen/train/train.tscn" id="14_g0uwl"]
|
||||
|
||||
[sub_resource type="Environment" id="Environment_ux83q"]
|
||||
@ -17,7 +18,7 @@ tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 0, 0)]
|
||||
"values": [Vector3(20, 0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_he04d"]
|
||||
@ -60,10 +61,12 @@ _data = {
|
||||
}
|
||||
|
||||
[node name="total" type="Node3D"]
|
||||
script = ExtResource("1_s45rl")
|
||||
|
||||
[node name="platform" parent="." instance=ExtResource("1_rjva4")]
|
||||
|
||||
[node name="train" parent="." instance=ExtResource("14_g0uwl")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 20, 0, 0)
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.004, 1.768, 6.38)
|
||||
@ -82,4 +85,18 @@ libraries = {
|
||||
"": SubResource("AnimationLibrary_lf7ox")
|
||||
}
|
||||
|
||||
[node name="BeginTimer" type="Timer" parent="."]
|
||||
wait_time = 3.0
|
||||
one_shot = true
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 15.0
|
||||
one_shot = true
|
||||
|
||||
[node name="EndTimer" type="Timer" parent="."]
|
||||
wait_time = 4.0
|
||||
|
||||
[connection signal="animation_finished" from="trainAnimationPlayer" to="train" method="_on_train_animation_player_animation_finished"]
|
||||
[connection signal="timeout" from="BeginTimer" to="." method="_on_beginTimer_timeout"]
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||
[connection signal="timeout" from="EndTimer" to="." method="_on_end_timer_timeout"]
|
||||
|
@ -81,22 +81,3 @@ func _ready() -> void:
|
||||
$".".add_child(copyTrainBody)
|
||||
copyTrainBody.position.x=19.259*(i+1)
|
||||
$TrainHeadH.position.x += 19.259*(trainType-1)
|
||||
|
||||
|
||||
var count=0
|
||||
func _process(delta: float) -> void:
|
||||
count+=1
|
||||
if count<180:
|
||||
if trainState == Train_STATE.leave :
|
||||
trainCome()
|
||||
elif count>180 and count<360:
|
||||
if leftTrainDoorALL[0].trainDoorState == TrainDoor.Train_Door_STATE.close:
|
||||
openLeftTrainDoorALL()
|
||||
elif count>540 and count<720 :
|
||||
if leftTrainDoorALL[0].trainDoorState == TrainDoor.Train_Door_STATE.open :
|
||||
closeLeftTrainDoorALL()
|
||||
elif count>1000 and count<2000:
|
||||
if trainState == Train_STATE.comeAndStop :
|
||||
trainLeave()
|
||||
elif count>2000:
|
||||
count=0
|
||||
|
15
trainings/trainingOpenDoorFault/trainingOpenDoorFault.gd
Normal file
15
trainings/trainingOpenDoorFault/trainingOpenDoorFault.gd
Normal file
@ -0,0 +1,15 @@
|
||||
extends Node
|
||||
|
||||
## 实训名称
|
||||
@export var trainingName: String = "实训"
|
||||
## 场景描述
|
||||
@export var trainingDesc: String = "场景描述"
|
||||
|
||||
func _ready():
|
||||
$TrainingDescDialog.title = trainingName
|
||||
$TrainingDescDialog.updateSceneDesc(trainingDesc)
|
||||
|
||||
|
||||
func _on_training_desc_dialog_start_training():
|
||||
$total.beginTraining()
|
||||
$total.setAssignScreenDoorsOpenFault([TotalScene.ScreenDoor_name.screenDoor2])
|
18
trainings/trainingOpenDoorFault/trainingOpenDoorFault.tscn
Normal file
18
trainings/trainingOpenDoorFault/trainingOpenDoorFault.tscn
Normal file
@ -0,0 +1,18 @@
|
||||
[gd_scene load_steps=4 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"]
|
||||
[ext_resource type="PackedScene" uid="uid://btcksdsburk7t" path="res://sceen/total.tscn" id="3_28hir"]
|
||||
|
||||
[node name="trainingOpenDoorFault" type="Node"]
|
||||
script = ExtResource("1_2u0o8")
|
||||
trainingName = "站台单档滑动门开门故障处置"
|
||||
trainingDesc = "列车开门作业,突发单个站台门未正常打开。"
|
||||
|
||||
[node name="TrainingDescDialog" parent="." instance=ExtResource("2_qfrwf")]
|
||||
size = Vector2i(400, 300)
|
||||
|
||||
[node name="total" parent="." instance=ExtResource("3_28hir")]
|
||||
|
||||
[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"]
|
Loading…
Reference in New Issue
Block a user