2024-09-12 21:55:55 +08:00
|
|
|
extends Button
|
|
|
|
class_name ToolButton
|
2024-11-27 20:28:51 +08:00
|
|
|
var is_mouse_enter:bool=false
|
|
|
|
var is_down:bool=false
|
2024-09-12 21:55:55 +08:00
|
|
|
func on_button_down() -> void:
|
2024-11-27 20:28:51 +08:00
|
|
|
is_down=true
|
2024-09-12 21:55:55 +08:00
|
|
|
get_parent().modulate=Color(0.5,0.5,0.5,1)
|
|
|
|
pass # Replace with function body.
|
|
|
|
func on_button_up() -> void:
|
2024-11-27 20:28:51 +08:00
|
|
|
is_down=false
|
|
|
|
if not is_mouse_enter:
|
|
|
|
get_parent().modulate=Color(1,1,1,1)
|
|
|
|
else:
|
|
|
|
get_parent().modulate=Color(0.8,0.8,0.8,1)
|
2024-09-12 21:55:55 +08:00
|
|
|
pass # Replace with function body.ion body.
|
2024-09-13 17:55:00 +08:00
|
|
|
static func static_on_button_down(canvas:CanvasItem) -> void:
|
|
|
|
canvas.modulate=Color(0.5,0.5,0.5,1)
|
|
|
|
pass # Replace with function body.
|
|
|
|
static func static_on_button_up(canvas:CanvasItem) -> void:
|
|
|
|
canvas.modulate=Color(1,1,1,1)
|
|
|
|
pass # Replace with function body.ion body.
|
2024-09-20 12:02:11 +08:00
|
|
|
func disable(is_disable:bool):
|
|
|
|
disabled=is_disable
|
|
|
|
if is_disable:
|
|
|
|
get_parent().modulate=Color(0.5,0.5,0.5,1)
|
|
|
|
else:
|
|
|
|
get_parent().modulate=Color(1,1,1,1)
|
2024-11-27 20:28:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
func _on_mouse_entered() -> void:
|
|
|
|
is_mouse_enter=true
|
|
|
|
if not is_down:
|
|
|
|
get_parent().modulate=Color(0.8,0.8,0.8,1)
|
|
|
|
|
|
|
|
pass # Replace with function body.
|
|
|
|
|
|
|
|
|
|
|
|
func _on_mouse_exited() -> void:
|
|
|
|
is_mouse_enter=false
|
|
|
|
if not is_down:
|
|
|
|
get_parent().modulate=Color(1,1,1,1)
|
|
|
|
pass # Replace with function body.
|