godot-psd-training/UI/psl/psl_window.gd
2024-05-11 14:10:07 +08:00

77 lines
2.3 KiB
GDScript

extends Window
func _on_psl_click_signal() -> void:
self.show()
$"../stationKeys".onShowWindow(StationKeyWindow.WindowType.PSL)
if !$"../stationKeys".hsjcKeyVisible() :
hideInterlockReleaseSwitchHandleKey()
if !$"../stationKeys".pslKeyVisible() :
hidePSLAllowHandleKey()
$"..".allClickPlatformSignal.emit('PSL')
func _on_close_requested():
self.hide()
$"../stationKeys".hide()
##点击按钮或钥匙
func onHandleSignal(openLight: bool, keySwitch: Variant) -> void:
$"..".allClickPlatformSignal.emit(keySwitch.name,keySwitch)
##显影psl相关钥匙操作
func shouPSLAllowHandleKey():
$MarginContainer/GridContainer/PSLAllow.shouHandleKey()
func hidePSLAllowHandleKey():
$MarginContainer/GridContainer/PSLAllow.hideHandleKey()
func shouInterlockReleaseSwitchHandleKey():
$MarginContainer/GridContainer/InterlockReleaseSwitch.shouHandleKey()
func hideInterlockReleaseSwitchHandleKey():
$MarginContainer/GridContainer/InterlockReleaseSwitch.hideHandleKey()
func remove_key(keyName: Variant) -> void:
var name = ''
if keyName == 'PSLAllow' :
name = 'PSL_Key'
allClickPslSignal.emit('removePSLKeyOfWindowPsl')
elif keyName == 'InterlockReleaseSwitch' :
name = 'HSJC_Key'
allClickPslSignal.emit('removeHSJCKeyOfWindowPsl')
$"../stationKeys".showKeyAfterRemoveKey(name)
##打开钥匙盒相关
func _on_open_key_window_gui_input(event: InputEvent) -> void:
if event.button_mask == MouseButtonMask.MOUSE_BUTTON_MASK_LEFT:
$"../stationKeys".onShowWindow(StationKeyWindow.WindowType.PSL)
func _on_open_key_window_mouse_entered() -> void:
$openKeyWindow.set_default_cursor_shape(Control.CursorShape.CURSOR_POINTING_HAND)
func _on_open_key_window_mouse_exited() -> void:
$openKeyWindow.set_default_cursor_shape(Control.CursorShape.CURSOR_ARROW)
func _process(delta: float) -> void:
if self.visible :
if $"..".allScreenDoorClose() :
$MarginContainer/GridContainer/MarginContainer/VBoxContainer/AllScreenDoorCloseLight.openLight()
else :
$MarginContainer/GridContainer/MarginContainer/VBoxContainer/AllScreenDoorCloseLight.closeLight()
if $"..".hasScreenDoorOpen():
$MarginContainer/GridContainer/VBoxContainer/ScreenDoorOpenLight.openLight()
else:
$MarginContainer/GridContainer/VBoxContainer/ScreenDoorOpenLight.closeLight()
##所有psl点击操作汇总
signal allClickPslSignal(equipmentName:String,equipmentInfo)