godot-psd-training/UI/CameraSwitch/CameraSwitchUi.gd

61 lines
1.4 KiB
GDScript

extends Node2D
##是否允许操作
var allowHandle :bool = true
##所有ShortTool点击操作汇总
signal AllClickCameraSwitchUi(equipmentName:String,equipmentInfo)
func switchCamera(camera,emit=true):
if emit :
AllClickCameraSwitchUi.emit($"..".camera_map[camera],self)
if !allowHandle :
return
$"..".switchCamera(camera)
func uiChange(ui):
if ui == 'APassageway':
$CameraSwitch.hide()
$aPassageway.show()
$aPassageway.initButton()
elif ui == 'BPassageway':
$CameraSwitch.hide()
$bPassageway.show()
$bPassageway.initButton()
elif ui == 'CPassageway':
$CameraSwitch.hide()
$CPassageway.show()
$CPassageway.initButton()
elif ui == 'DPassageway':
$CameraSwitch.hide()
$DPassageWay.show()
$DPassageWay.initButton()
elif ui == 'VehicleControlRoom':
$CameraSwitch.hide()
$VehicleControlRoom.show()
$VehicleControlRoom.initButton()
elif ui == 'StaionHallA':
$CameraSwitch.hide()
$StaionHallA.show()
$StaionHallA.initButton()
elif ui == 'StaionHallB':
$CameraSwitch.hide()
$StationHallB.show()
$StationHallB.initButton()
func back(fatherNode=''):
if fatherNode == 'StaionHall':
AllClickCameraSwitchUi.emit('StaionHallBack',self)
else :
AllClickCameraSwitchUi.emit('Back',self)
if !allowHandle :
return
$CameraSwitch.show()
$aPassageway.hide()
$bPassageway.hide()
$CPassageway.hide()
$DPassageWay.hide()
$StaionHallA.hide()
$StationHallB.hide()
$VehicleControlRoom.hide()