33 lines
784 B
GDScript
33 lines
784 B
GDScript
extends ColorRect
|
|
|
|
var key
|
|
var clicked = false
|
|
|
|
@onready var texture_rect: TextureRect = $TextureRect
|
|
|
|
|
|
func _on_mouse_handler_clicked() -> void:
|
|
clicked = true
|
|
|
|
|
|
|
|
func _on_mouse_handler_hovered() -> void:
|
|
pass # Replace with function body.
|
|
|
|
|
|
func _on_mouse_handler_unhovered() -> void:
|
|
if clicked:
|
|
#Triggerer.trigger("drag_building", { "key": key })
|
|
Persister.persist_data("drag_mode", true)
|
|
Persister.persist_data("building_mode", true)
|
|
Persister.persist_data("building_key", key)
|
|
clicked = false
|
|
|
|
|
|
func _on_mouse_handler_released() -> void:
|
|
if clicked:
|
|
#Triggerer.trigger("select_building", { "key": key })
|
|
Persister.persist_data("drag_mode", false)
|
|
Persister.persist_data("building_mode", true)
|
|
Persister.persist_data("building_key", key)
|
|
clicked = false
|