mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat(ItemShow): 添加自动隐藏动画功能
添加autoFree选项和动画播放逻辑,当autoFree为true时自动播放隐藏动画并释放节点
This commit is contained in:
@@ -4,10 +4,17 @@ class_name ItemShow
|
||||
|
||||
@export var type: ItemStore.ItemType = ItemStore.ItemType.BASEBALL
|
||||
@export var count: int = 0
|
||||
@export var autoFree: bool = false
|
||||
|
||||
@onready var avatarTexture: TextureRect = $"%avatar"
|
||||
@onready var countLabel: Label = $"%count"
|
||||
@onready var animator: AnimationPlayer = $"%animator"
|
||||
|
||||
func _ready():
|
||||
if autoFree:
|
||||
animator.play("hide")
|
||||
await animator.animation_finished
|
||||
queue_free()
|
||||
func _physics_process(_delta):
|
||||
avatarTexture.texture = ItemStore.getTexture(type)
|
||||
countLabel.text = str(count)
|
||||
|
||||
Reference in New Issue
Block a user