23 lines
452 B
GDScript
23 lines
452 B
GDScript
@tool
|
|
extends PanelContainer
|
|
class_name CardStat
|
|
|
|
var is_ready = false
|
|
|
|
@export var info : CardStatInfo = CardStatInfo.new() :
|
|
set(v):
|
|
info = v
|
|
if is_ready : update()
|
|
|
|
@export_tool_button("Update", "Callable") var update_action = update
|
|
|
|
func _ready():
|
|
is_ready = true
|
|
update()
|
|
|
|
func update():
|
|
%RichTextLabel.visible = info.text != ""
|
|
%RichTextLabel.text = info.text
|
|
%TextureRect.visible = info.icon != null
|
|
%TextureRect.texture = info.icon
|