godot-psd-training/UI/psl/button_light.gd

27 lines
491 B
GDScript3
Raw Normal View History

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