extends Sprite2D # Called when the node enters the scene tree for the first time. func _ready() -> void: pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: pass func test_enter(): var mouse_position = get_global_mouse_position() return self.get_rect().has_point(to_local(mouse_position)) func _input(event): if self.visible == false: return if event is InputEventMouseMotion: var flag1 = test_enter() if flag1: self.modulate = Color(0, 1, 1, 1) else: self.modulate = Color(1, 1, 1, 1) # 鼠标在移动,可以在这里检查鼠标是否进入了当前节点的区域 if event is InputEventMouseButton and event.pressed: # 如果鼠标在Sprite2D上点击,则处理事件 var flag2 = test_enter() if flag2 and event.button_index == MOUSE_BUTTON_LEFT: # 处理点击事件 $"..".allClickJJTCSignal.emit('JJTCLeftRotate',$"..") if !$"..".allowHandle : return $"../JJTC_Right_Rotate".hide() self.hide() $"../JJTC_Key".hide() $"..".pullOutKey() $"../JJTC_Button".hide()