extends Panel class_name CardPreviewPanel # Node references @onready var card_name_label = $CardContent/CardNameLabel @onready var rank_label = $CardContent/RankLabel @onready var description_label = $CardContent/DescriptionLabel @onready var unit_list_label = $CardContent/UnitListLabel @onready var effect_type_label = $CardContent/EffectTypeLabel @onready var duration_label = $CardContent/DurationLabel # Card rank colors (same as other card components) var rank_colors = { Card.Rank.RANK_0: Color(0.9, 0.1, 0.1, 1.0), # Red Card.Rank.RANK_1: Color(0.9, 0.6, 0.1, 1.0), # Orange Card.Rank.RANK_2: Color(0.1, 0.7, 0.1, 1.0), # Green Card.Rank.RANK_3: Color(0.1, 0.7, 0.9, 1.0) # Blue } # Effect type descriptions var effect_type_names = { Card.EffectType.MOVEMENT_MODIFIER: "Movement Modifier", Card.EffectType.BOARD_EFFECT: "Board Effect", Card.EffectType.PIECE_EFFECT: "Piece Effect", Card.EffectType.SPECIAL_ACTION: "Special Action" } func _ready(): # Hide the preview initially visible = false func preview_card(card: Card): if !card: hide_preview() return # Update all card information card_name_label.text = card.cardName # Set rank information var rank_text = "Rank " + str(card.rank) match card.rank: Card.Rank.RANK_0: rank_text += " (One-time use, removed from deck)" Card.Rank.RANK_1: rank_text += " (Once per match)" Card.Rank.RANK_2: rank_text += " (Discarded after use)" Card.Rank.RANK_3: rank_text += " (Reused)" rank_label.text = rank_text # Set rank color if card.rank in rank_colors: rank_label.add_theme_color_override("font_color", rank_colors[card.rank]) card_name_label.add_theme_color_override("font_color", rank_colors[card.rank]) # Set description description_label.text = card.description # Set unit whitelist if card.unitWhitelist.is_empty(): unit_list_label.text = "Can be applied to: Any piece" else: unit_list_label.text = "Can be applied to: " + ", ".join(card.unitWhitelist) # Set effect type if card.effectType in effect_type_names: effect_type_label.text = "Effect Type: " + effect_type_names[card.effectType] else: effect_type_label.text = "Effect Type: Unknown" # Set duration if card.duration > 0: duration_label.text = "Duration: " + str(card.duration) + " turns" else: duration_label.text = "Duration: Instant" # Show the preview visible = true func hide_preview(): visible = false