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; $"../../../../Close_Click_Area".hide() $"../../../../JJTC_Right_Rotate".hide() $"../../../../JJTC_Left_Rotate".hide() $"../../../../JJTC_Key".hide() $"../../../../JJTC_Button".hide() # 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 test_close_enter(): var mouse_position = get_global_mouse_position() return true func _on_close_click_area_mouse_entered(): $"../../../../Close_Click_Area".set_default_cursor_shape(Control.CursorShape.CURSOR_POINTING_HAND) func _on_close_click_area_mouse_exited(): set_default_cursor_shape(Control.CursorShape.CURSOR_ARROW) func _on_close_click_area_gui_input(event): if event.button_mask == MouseButtonMask.MOUSE_BUTTON_MASK_LEFT && jjtc_state == JJTC_STATE.OPEN: jjtc_state = JJTC_STATE.CLOSE $"../../../../JJTC_Box_Voice".play() $"../../../../JJTC_Key".show() $"../../../../JJTC_Right_Rotate".show() $"../../../../JJTC_Left_Rotate".show() $"../../../../Close_Click_Area".hide() $"../../../../JJTC_Button".hide() func _on_station_keys_mouse_entered(): $"../../../../StationKeys".set_default_cursor_shape(Control.CursorShape.CURSOR_POINTING_HAND) func _on_station_keys_mouse_exited(): set_default_cursor_shape(Control.CursorShape.CURSOR_ARROW)