feat: 创建 upgrade 数据resource,编写upgrade_panel.gd动态生成升级卡片
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
extends Panel
|
||||
class_name UpgradeCard
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
@export var item_data: ItemUpgrade: set = _set_data
|
||||
|
||||
@onready var item_icon: TextureRect = %Icon
|
||||
@onready var item_name: Label = %Name
|
||||
@onready var item_description: Label = %Description
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
func _set_data(value: ItemUpgrade) -> void:
|
||||
item_data = value
|
||||
item_icon.texture = item_data.item_icon
|
||||
item_name.text = item_data.item_name
|
||||
item_description.text = item_data.descriptin
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ theme_override_constants/margin_bottom = 8
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="MarginContainer/Control" unique_id=1868739971]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(100, 100)
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
@@ -40,6 +41,7 @@ expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Name" type="Label" parent="MarginContainer/Control" unique_id=1952735558]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_left = 100.0
|
||||
offset_top = 10.0
|
||||
@@ -50,6 +52,7 @@ label_settings = SubResource("LabelSettings_mkexl")
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Description" type="Label" parent="MarginContainer/Control" unique_id=1620881988]
|
||||
unique_name_in_owner = true
|
||||
modulate = Color(0.827451, 0.9098039, 0.17254902, 1)
|
||||
layout_mode = 0
|
||||
offset_left = 100.0
|
||||
|
||||
Reference in New Issue
Block a user