2024-09-19 17:56:05 +08:00
|
|
|
extends TextureRect
|
|
|
|
var is_mouse_enter:bool=false
|
|
|
|
signal click(data:Dictionary)
|
|
|
|
var data:Dictionary={
|
2024-09-27 17:51:20 +08:00
|
|
|
"texture":"test_character_tsubaki"
|
2024-09-19 17:56:05 +08:00
|
|
|
}
|
|
|
|
# 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 _input(event: InputEvent) -> void:
|
|
|
|
if event.is_action_pressed("mouse_left") and is_mouse_enter:
|
|
|
|
click.emit(data)
|
|
|
|
func _get_drag_data(at_position: Vector2) -> Variant:
|
|
|
|
var texture_rect=TextureRect.new()
|
|
|
|
texture_rect.texture=Global.get_texture(data["texture"])
|
|
|
|
set_drag_preview(texture_rect)
|
|
|
|
return data
|
|
|
|
func _on_mouse_entered() -> void:
|
|
|
|
is_mouse_enter=true
|
|
|
|
pass # Replace with function body.
|
|
|
|
|
|
|
|
|
|
|
|
func _on_mouse_exited() -> void:
|
|
|
|
is_mouse_enter=false
|
|
|
|
pass # Replace with function body.
|