2024-04-23 18:06:31 +08:00
|
|
|
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;
|
2024-04-26 17:42:44 +08:00
|
|
|
$"../../../../Close_Click_Area".hide()
|
2024-04-28 11:21:59 +08:00
|
|
|
$"../../../../JJTC_Right_Rotate".hide()
|
|
|
|
$"../../../../JJTC_Left_Rotate".hide()
|
|
|
|
$"../../../../JJTC_Key".hide()
|
|
|
|
$"../../../../JJTC_Button".hide()
|
2024-04-23 18:06:31 +08:00
|
|
|
|
|
|
|
# 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;
|
|
|
|
|
2024-04-26 17:42:44 +08:00
|
|
|
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
|
2024-04-28 11:21:59 +08:00
|
|
|
$"../../../../JJTC_Box_Voice".play()
|
|
|
|
$"../../../../JJTC_Key".show()
|
|
|
|
$"../../../../JJTC_Right_Rotate".show()
|
|
|
|
$"../../../../JJTC_Left_Rotate".show()
|
2024-04-26 17:42:44 +08:00
|
|
|
$"../../../../Close_Click_Area".hide()
|
2024-04-29 11:22:44 +08:00
|
|
|
$"../../../../JJTC_Button".hide()
|
2024-05-11 14:10:07 +08:00
|
|
|
$"../../../..".allClickJJTCSignal.emit('JJTCCloseBox')
|
2024-04-28 11:21:59 +08:00
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|