1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +08:00
Files
Dog-Lynx-And-HCN/scripts/Statemachine/ItemShow.gd
T
fallingshrimp 8e4b560e82 fix(UI): 修正能量显示格式和动画问题
修复能量标签显示格式从"%.1f"改为"%.2f"
调整BigLaser能量消耗从50改为100
修复ItemShow动画资源顺序错误问题
添加autoFree属性到UI场景中的物品节点
修改FieldShow默认文本从"+0"改为"0"
2025-08-28 07:01:18 +08:00

29 lines
867 B
GDScript

@tool
extends HBoxContainer
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:
await TickTool.millseconds(2000) # 等待1秒后自动隐藏
animator.play("hide")
await animator.animation_finished
queue_free()
func _physics_process(_delta):
avatarTexture.texture = ItemStore.getTexture(type)
countLabel.text = str(count)
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