godot-psd-training/sceen/platform/platform.gd
2024-07-23 19:46:26 +08:00

158 lines
5.7 KiB
GDScript

extends Node3D
var screenDoorALL = []
##开整体屏蔽门
func openScreenDoorALL ()-> void:
for child in screenDoorALL:
child.openScreenDoor()
##关整体屏蔽门
func closeScreenDoorALL ()-> void:
for child in screenDoorALL:
child.closeScreenDoor()
##所有屏蔽门开门到位
func allScreenDoorOpen ()-> bool:
for child in screenDoorALL:
if child.screenDoorState != ScreenDoor.ScreenDoor_State.open :
return false
return true
##所有屏蔽门关门到位
func allScreenDoorClose ()-> bool:
for child in screenDoorALL:
if child.screenDoorState != ScreenDoor.ScreenDoor_State.close :
return false
return true
##有屏蔽门开门到位
func hasScreenDoorOpen ()-> bool:
for child in screenDoorALL:
if child.screenDoorState == ScreenDoor.ScreenDoor_State.open :
return true
return false
##屏蔽门开关门没声音
func screenDoorOpenAndCloseNoMusic ()-> void:
for child in screenDoorALL:
child.playScreenDoorMusic = false
func _ready() -> void:
var screenDoor_scene = preload("res://sceen/platform/screenDoor.tscn")
var lastScreenDoorPosX = -4.385
for i in range(1, 6):
var screenDoorInstance = screenDoor_scene.instantiate()
add_child(screenDoorInstance)
screenDoorALL.append(screenDoorInstance)
if i % 4 ==1 and i != 1:
screenDoorInstance.position.x=lastScreenDoorPosX+6.104
else:
screenDoorInstance.position.x=lastScreenDoorPosX+4.385
lastScreenDoorPosX = screenDoorInstance.position.x
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"))
screenDoorInstance.connect("screenDoorOpenSignal",Callable($"..","emitScreenDoorOpenSignal"))
screenDoorInstance.connect("screenDoorCloseSignal",Callable($"..","emitScreenDoorCloseSignal"))
##所有站台点击操作汇总
signal allClickPlatformSignal(equipmentName:String,equipmentInfo)
func _on_lcb_all_click_lcb_signal(equipmentName: String,equipmentInfo=null) -> void:
allClickPlatformSignal.emit(equipmentName,equipmentInfo)
func _on_psl_all_click_psl_signal(equipmentName: String, equipmentInfo: Variant=null) -> void:
allClickPlatformSignal.emit(equipmentName,equipmentInfo)
func _on_jjtc_all_click_jjtc_signal(equipmentName: String, equipmentInfo: Variant=null) -> void:
allClickPlatformSignal.emit(equipmentName,equipmentInfo)
func _on_screen_door_operate_all_click_screen_door_signal(equipmentName: String, equipmentInfo: Variant=null) -> void:
allClickPlatformSignal.emit(equipmentName,equipmentInfo)
func _on_station_keys_all_click_station_keys_signal(equipmentName: String) -> void:
allClickPlatformSignal.emit(equipmentName,$stationKeys)
func _on_camera_switch_ui_all_click_camera_switch_ui(equipmentName: String, equipmentInfo: Variant) -> void:
allClickPlatformSignal.emit(equipmentName,equipmentInfo)
func _on_shortcut_tool_all_click_shortcut_tool(equipmentName: String, equipmentInfo: Variant) -> void:
allClickPlatformSignal.emit(equipmentName,equipmentInfo)
func _on_shortcut_tool_model_all_click_shortcut_tool_model(equipmentName: String, equipmentInfo: Variant) -> void:
allClickPlatformSignal.emit(equipmentName,equipmentInfo)
func _on_shortcut_tool_model_2_all_click_shortcut_tool_model_2(equipmentName: String, equipmentInfo: Variant) -> void:
allClickPlatformSignal.emit(equipmentName,equipmentInfo)
##屏蔽门lcb的状态变化
signal allScreenDoorLcbStateSignal(currenScreenDoor:ScreenDoor,knob_state:LcbWindow.KNOB_STATE)
func _on_lcb_lcb_knob_state_signal(currenScreenDoor: ScreenDoor, knob_state: LcbWindow.KNOB_STATE) -> void:
allScreenDoorLcbStateSignal.emit(currenScreenDoor,knob_state)
##展示相机切换和快捷工具
func showCameraAndShortcutTool() -> void:
$platform.queue_free()
$CameraSwitchUi.visible = true
$ShortcutTool.visible = true
$ShortcutToolModel.visible = true
$TemporaryTicketOffice.visible = true
$AllElevator.visible = true
for child in $ShortcutToolModel2.get_children():
child.position.y -=30
##切换相机
func switchCamera (camera :LargePassengerFlowScene.Camera_name)-> void:
$"..".switchCamera(camera)
func getCurrentCamera()-> LargePassengerFlowScene.Camera_name:
return $"..".currentActiveCameraOfLarge
var Camera_name = LargePassengerFlowScene.Camera_name
var camera_map = {
Camera_name.SparePartsCabinet: "SparePartsCabinet",
Camera_name.PartsArea: "PartsArea",
Camera_name.StationHall: "StationHall",
Camera_name.UpPlatform: "UpPlatform",
Camera_name.DownPlatform: "DownPlatform",
Camera_name.StationHallAExit: "StationHallAExit",
Camera_name.AEntrance: "AEntrance",
Camera_name.APassage: "APassage",
Camera_name.StationHallBExit: "StationHallBExit",
Camera_name.BEntrance: "BEntrance",
Camera_name.BPassage: "BPassage",
Camera_name.StationHallCExit: "StationHallCExit",
Camera_name.CEntrance: "CEntrance",
Camera_name.CPassage: "CPassage",
Camera_name.StationHallDExit: "StationHallDExit",
Camera_name.DEntrance: "DEntrance",
Camera_name.DPassage: "DPassage",
Camera_name.ALowerStepSwitch: "ALowerStepSwitch",
Camera_name.ATVM: "ATVM",
Camera_name.AInboundGate: "AInboundGate",
Camera_name.AExitGate: "AExitGate",
Camera_name.AUpperStep: "AUpperStep",
Camera_name.ALowerStep: "ALowerStep",
Camera_name.AGangway: "AGangway",
Camera_name.BLowerStepSwitch: "BLowerStepSwitch",
Camera_name.BTVM: "BTVM",
Camera_name.BInboundGate: "BInboundGate",
Camera_name.BExitGate: "BExitGate",
Camera_name.BUpperStep: "BUpperStep",
Camera_name.BLowerStep: "BLowerStep",
Camera_name.BGangway: "BGangway",
}
func getElevatorCurrentExerciseType()-> Elevator.Exercise_type:
return $AllElevator/ElevatorAtB.currentExerciseType