mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat(ItemShow): 为物品展示添加自动释放功能
在ItemShow.generate方法中新增isAutoFree参数,控制物品展示节点是否自动释放。这解决了需要手动管理物品展示节点内存的问题。
This commit is contained in:
@@ -19,8 +19,9 @@ func _physics_process(_delta):
|
||||
avatarTexture.texture = ItemStore.getTexture(type)
|
||||
countLabel.text = str(count)
|
||||
|
||||
static func generate(itemType: ItemStore.ItemType, itemCount: int = 1):
|
||||
static func generate(itemType: ItemStore.ItemType, itemCount: int = 1, isAutoFree: bool = false):
|
||||
var item = preload("res://components/UI/ItemShow.tscn").instantiate()
|
||||
item.type = itemType
|
||||
item.count = itemCount
|
||||
item.autoFree = isAutoFree
|
||||
return item
|
||||
|
||||
Reference in New Issue
Block a user