godot-psd-training/UI/LCB/lcb.gd

47 lines
979 B
GDScript

extends Window
var currenScreenDoor:ScreenDoor=null
func _on_screen_door_click_lcb_signal(screenDoor: Variant) -> void:
self.show()
$"../stationKeys".show()
$"../stationKeys".shouAllKeys()
currenScreenDoor=screenDoor
hideHandleKey()
func _on_close_requested() -> void:
self.hide()
## 旋钮的状态枚举
enum KNOB_STATE{
ISOLATE,# 隔离
AUTO,# 自动
OPEN,# 开门
CLOSE,# 关门
}
@onready var knob_state : KNOB_STATE = KNOB_STATE.AUTO :
set(value):
knob_state = value
if knob_state==KNOB_STATE.OPEN:
currenScreenDoor.openScreenDoor()
elif knob_state==KNOB_STATE.CLOSE:
currenScreenDoor.closeScreenDoor()
func change_knob_state(state):
knob_state = state
##展示控制的钥匙
func shouHandleKey():
$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