système de sauvegarde, scène 3D de test sur la base astra et passage en forward+
This commit is contained in:
@@ -4,54 +4,57 @@ class_name Card
|
||||
|
||||
const CARD_STAT_SCENE : PackedScene = preload("res://gui/game/card/card_stat.tscn")
|
||||
const CARD_SECTION_SCENE : PackedScene = preload("res://gui/game/card/card_section.tscn")
|
||||
|
||||
@export var small_mode : bool = false
|
||||
@export var down_arrow : bool = false
|
||||
|
||||
@export var info : CardInfo = CardInfo.new("Default Card Name")
|
||||
|
||||
@export_tool_button("Update", "Callable") var update_action = update
|
||||
@export_tool_button("Reset Size", "Callable") var reset_size_action = func(): reset_size()
|
||||
|
||||
func _ready():
|
||||
update()
|
||||
# func _ready():
|
||||
# update()
|
||||
|
||||
func update():
|
||||
%CardTitle.text = info.title
|
||||
%CardUpperPart.self_modulate = info.bg_color
|
||||
%CardTypeIcon.texture = info.type_icon
|
||||
%EntityTexture.texture = info.texture
|
||||
pass
|
||||
%Title.text = info.title
|
||||
%Subtitle.visible = info.subtitle != ""
|
||||
%Subtitle.text = info.subtitle
|
||||
|
||||
%ImportantStat.visible = info.important_stat_text != "" or info.important_stat_icon != null
|
||||
%ImportantStatIcon.texture = info.important_stat_icon
|
||||
%ImportantStatText.text = info.important_stat_text
|
||||
|
||||
%ArrowDown.visible = down_arrow
|
||||
|
||||
self_modulate = Color.TRANSPARENT if small_mode else Color.WHITE
|
||||
%CardUpperPart.self_modulate.a = 0.7 if small_mode else 1.0
|
||||
|
||||
update_card_stats()
|
||||
update_card_sections()
|
||||
|
||||
await get_tree().create_timer(0.01).timeout
|
||||
|
||||
reset_size()
|
||||
|
||||
func update_card_stats():
|
||||
for stat in %CardStatsContainer.get_children():
|
||||
for stat in %StatsContainer.get_children():
|
||||
stat.queue_free()
|
||||
|
||||
%StatsContainer.visible = len(info.stats) > 0
|
||||
%StatsContainer.columns = max(1,len(info.stats))
|
||||
|
||||
for stat_info in info.stats:
|
||||
if stat_info:
|
||||
var new_stat : CardStat = CARD_STAT_SCENE.instantiate() as CardStat
|
||||
new_stat.info = stat_info
|
||||
%CardStatsContainer.add_child(new_stat)
|
||||
|
||||
%CardStats.visible = len(info.stats) != 0 && small_mode == false
|
||||
%StatsContainer.add_child(new_stat)
|
||||
|
||||
func update_card_sections():
|
||||
for stat in %CardSectionsContainer.get_children():
|
||||
for stat in %SectionContainer.get_children():
|
||||
stat.queue_free()
|
||||
|
||||
%SectionContainer.visible = len(info.sections) > 0
|
||||
|
||||
for sections_info in info.sections:
|
||||
if sections_info:
|
||||
var new_section : CardSection = CARD_SECTION_SCENE.instantiate() as CardSection
|
||||
new_section.info = sections_info
|
||||
%CardSectionsContainer.add_child(new_section)
|
||||
|
||||
%CardSections.visible = len(%CardSectionsContainer.get_children()) != 0 && small_mode == false
|
||||
%SectionContainer.add_child(new_section)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user