39 lines
868 B
GDScript
39 lines
868 B
GDScript
@icon("res://components/Cursor/mouse-pointer-click.svg")
|
|
extends Area2D
|
|
|
|
signal clicked
|
|
signal hovered
|
|
signal unhovered
|
|
signal rclicked
|
|
|
|
@export var passthrough = false
|
|
|
|
var _logger
|
|
|
|
func _ready():
|
|
if get_tree().root.has_node("Logger"):
|
|
_logger = get_tree().root.get_node("Logger")
|
|
|
|
func _on_clicked():
|
|
clicked.emit()
|
|
return passthrough
|
|
|
|
func _on_rclicked():
|
|
rclicked.emit()
|
|
return passthrough
|
|
|
|
func _on_hovered():
|
|
hovered.emit()
|
|
_logger.info("Hovered over mouse handler for object →%s←" % [get_parent().name], {
|
|
"color": "#919191",
|
|
"image": "res://components/Cursor/mouse-pointer-click.svg",
|
|
"category": "MOU"
|
|
})
|
|
|
|
func _on_unhovered():
|
|
unhovered.emit()
|
|
_logger.info("Unhovered mouse handler for object →%s←" % [get_parent().name], {
|
|
"color": "#919191",
|
|
"image": "res://components/Cursor/mouse-pointer-click.svg",
|
|
"category": "MOU"
|
|
})
|