extends TextureRect var unlockImg = preload("res://Assets/jjtc/jjtc_unlock.png"); var lockImg = preload("res://Assets/jjtc/jjtc_lock.png"); # Called when the node enters the scene tree for the first time. func _ready(): self.texture = lockImg; pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): pass ## 状态枚举 enum JJTC_STATE{ OPEN,# 开门 CLOSE,# 关门 } @onready var jjtc_state : JJTC_STATE = JJTC_STATE.CLOSE : set(value): jjtc_state = value if jjtc_state==JJTC_STATE.OPEN: self.texture = unlockImg; elif jjtc_state==JJTC_STATE.CLOSE: self.texture = lockImg; func _on_texture_rect_gui_input(event): if event.button_mask == MouseButtonMask.MOUSE_BUTTON_MASK_LEFT && jjtc_state == JJTC_STATE.CLOSE: jjtc_state = JJTC_STATE.OPEN $"../../../TextureRect".hide() $"../../../JJLC_Right_Rotate".hide() $"../../../JJLC_Left_Rotate".hide() #elif jjtc_state == JJTC_STATE.OPEN: #jjtc_state = JJTC_STATE.CLOSE pass