extends Panel export var barColors: Dictionary = {} export var color: String = "none" export var cardName: String = "Name" export var cardSubname: String = "Subname" export var showCost: bool = false export var cardCost: int = 0 onready var nameLabel := $TextBlock/NameBlock/Name onready var subnameLabel := $TextBlock/NameBlock/Subname onready var colorIndicator := $ColorIndicator onready var gradientIndicator := $ColorIndicator/TextureRect onready var costIndicator := $TextBlock/CostIndicator onready var costIndicatorLabel := $TextBlock/CostIndicator/CostLabel func _ready(): nameLabel.text = cardName subnameLabel.text = cardSubname if showCost: costIndicator.visible = true costIndicatorLabel.text = str(cardCost) if color.begins_with("multi|"): make_gradient(color.trim_prefix("multi|").split("+")) else: if not barColors.has(color): color = "none" colorIndicator.color = barColors[color] func make_gradient(colors: Array): var gradient := Gradient.new() var step = 1.0/(colors.size() - 1.0) var i = 0 gradient.colors = PoolColorArray([]) gradient.offsets = PoolRealArray([]) for color in colors: var offset: float = i*step gradient.add_point(offset, barColors[color]) i += 1 var texture := GradientTexture.new() texture.gradient = gradient gradientIndicator.texture = texture gradientIndicator.visible = true