godot-psd-training/UI/psl/button_light.gd
joylink_zhaoerwei 8cbdca61b1 psl交互
2024-04-22 15:32:19 +08:00

27 lines
491 B
GDScript

extends VBoxContainer
enum ButtonLightType{
green,# 绿色按钮
red,#红色按钮
black,#黑色按钮
}
@export var buttonLightType:ButtonLightType
@export var buttonHasLight:bool
@export var lightText:String
@export var buttonText:String
signal clickButtonSignal(openLight:bool,button)
func _ready() -> void:
$Button/MarginContainer/Label.text=buttonText
if buttonHasLight:
$Light.visible = true
$Light/MarginContainer/Label.text=lightText
else:
$Light.visible = false