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

49 lines
1.1 KiB
GDScript3
Raw Normal View History

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-17 15:26:37 +08:00
$"../stationKeys".show()
$"../stationKeys".shouAllKeys()
currenScreenDoor=screenDoor
hideHandleKey()
2024-04-16 09:46:51 +08:00
func _on_close_requested() -> void:
self.hide()
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
if knob_state==KNOB_STATE.OPEN:
currenScreenDoor.openScreenDoor()
elif knob_state==KNOB_STATE.CLOSE:
currenScreenDoor.closeScreenDoor()
2024-04-16 09:46:51 +08:00
func change_knob_state(state):
knob_state = state
2024-04-17 15:26:37 +08:00
##展示控制的钥匙
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