2024-04-15 14:54:06 +08:00
|
|
|
extends Window
|
|
|
|
|
2024-04-17 15:26:37 +08:00
|
|
|
var currenScreenDoor:ScreenDoor=null
|
|
|
|
func _on_screen_door_click_lcb_signal(screenDoor: Variant) -> void:
|
2024-04-22 10:57:46 +08:00
|
|
|
var screenDoorName=String(screenDoor.name)
|
|
|
|
self.title='LCB'+screenDoorName[screenDoorName.length() - 1]
|
2024-04-16 09:46:51 +08:00
|
|
|
self.show()
|
2024-04-28 15:51:51 +08:00
|
|
|
$"../stationKeys".onShowWindow($"../stationKeys".WindowType.LCB,screenDoor.lcbKey.keyName)
|
2024-04-17 15:26:37 +08:00
|
|
|
currenScreenDoor=screenDoor
|
2024-04-28 15:51:51 +08:00
|
|
|
resetState(screenDoor.lcbKey)
|
2024-04-23 09:52:55 +08:00
|
|
|
|
|
|
|
|
2024-04-16 09:46:51 +08:00
|
|
|
|
|
|
|
func _on_close_requested() -> void:
|
|
|
|
self.hide()
|
2024-04-26 16:54:17 +08:00
|
|
|
$"../stationKeys".hide()
|
2024-04-16 09:46:51 +08:00
|
|
|
|
2024-04-15 14:54:06 +08:00
|
|
|
## 旋钮的状态枚举
|
|
|
|
enum KNOB_STATE{
|
2024-04-16 09:46:51 +08:00
|
|
|
ISOLATE,# 隔离
|
|
|
|
AUTO,# 自动
|
|
|
|
OPEN,# 开门
|
|
|
|
CLOSE,# 关门
|
2024-04-15 14:54:06 +08:00
|
|
|
}
|
2024-04-17 15:26:37 +08:00
|
|
|
|
|
|
|
@onready var knob_state : KNOB_STATE = KNOB_STATE.AUTO :
|
|
|
|
set(value):
|
|
|
|
knob_state = value
|
2024-04-16 09:46:51 +08:00
|
|
|
|
|
|
|
func change_knob_state(state):
|
|
|
|
knob_state = state
|
2024-04-28 15:51:51 +08:00
|
|
|
currenScreenDoor.lcbKey.keyState = knob_state
|
|
|
|
if knob_state==KNOB_STATE.OPEN:
|
|
|
|
currenScreenDoor.openScreenDoor()
|
|
|
|
elif knob_state==KNOB_STATE.CLOSE:
|
|
|
|
currenScreenDoor.closeScreenDoor()
|
2024-04-17 15:26:37 +08:00
|
|
|
|
|
|
|
##展示控制的钥匙
|
2024-04-28 15:51:51 +08:00
|
|
|
func shouHandleKey(keyName:String):
|
|
|
|
currenScreenDoor.lcbKey.keyName = keyName
|
2024-04-17 15:26:37 +08:00
|
|
|
$TextureRect2.visible=true
|
|
|
|
$LCB2_Right_Rotate.visible=true
|
|
|
|
$LCB2_Left_Rotate.visible=true
|
|
|
|
|
|
|
|
##隐藏控制的钥匙
|
|
|
|
func hideHandleKey():
|
|
|
|
$TextureRect2.visible=false
|
|
|
|
$LCB2_Right_Rotate.visible=false
|
|
|
|
$LCB2_Left_Rotate.visible=false
|
2024-04-23 09:52:55 +08:00
|
|
|
|
|
|
|
##重置面板
|
2024-04-28 15:51:51 +08:00
|
|
|
func resetState(lcbKey):
|
|
|
|
if(lcbKey.keyName):
|
|
|
|
shouHandleKey(currenScreenDoor.lcbKey.keyName)
|
|
|
|
knob_state = lcbKey.keyState
|
|
|
|
match lcbKey.keyState:
|
|
|
|
KNOB_STATE.ISOLATE:
|
|
|
|
$TextureRect2.rotation = -PI*62/180
|
|
|
|
KNOB_STATE.AUTO:
|
|
|
|
$TextureRect2.rotation = 0
|
|
|
|
KNOB_STATE.CLOSE:
|
|
|
|
$TextureRect2.rotation = PI*59/180
|
|
|
|
KNOB_STATE.OPEN:
|
|
|
|
$TextureRect2.rotation = PI/2
|
|
|
|
else:
|
|
|
|
change_knob_state(KNOB_STATE.AUTO)
|
|
|
|
$TextureRect2.rotation = 0
|
|
|
|
hideHandleKey()
|
|
|
|
|
|
|
|
##打开钥匙盒相关
|
|
|
|
func _on_open_key_window_gui_input(event: InputEvent) -> void:
|
|
|
|
if event.button_mask == MouseButtonMask.MOUSE_BUTTON_MASK_LEFT:
|
|
|
|
$"../stationKeys".onShowWindow($"../stationKeys".WindowType.LCB,currenScreenDoor.lcbKey.keyName)
|
|
|
|
|
|
|
|
|
|
|
|
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 _on_texture_rect_2_gui_input(event: InputEvent) -> void:
|
|
|
|
if event.button_mask == MouseButtonMask.MOUSE_BUTTON_MASK_LEFT:
|
|
|
|
hideHandleKey()
|
|
|
|
$"../stationKeys".showKeyAfterRemoveKey(currenScreenDoor.lcbKey.keyName)
|
|
|
|
currenScreenDoor.lcbKey.keyName = ''
|
|
|
|
|
|
|
|
|
|
|
|
func _on_texture_rect_2_mouse_entered() -> void:
|
|
|
|
$TextureRect2.set_default_cursor_shape(Control.CursorShape.CURSOR_POINTING_HAND)
|
2024-04-17 15:26:37 +08:00
|
|
|
|
|
|
|
|
2024-04-28 15:51:51 +08:00
|
|
|
func _on_texture_rect_2_mouse_exited() -> void:
|
|
|
|
$TextureRect2.set_default_cursor_shape(Control.CursorShape.CURSOR_ARROW)
|