mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-31 16:31:54 +08:00
feat(UI): 更新字体资源并优化物品显示逻辑
替换原有字体文件为OTF格式,添加粗体字体支持 在物品显示组件中添加字体颜色变化功能,根据资源是否足够显示不同颜色 优化Feed类的资源消耗计算逻辑,增加countOf方法提高可读性
This commit is contained in:
@@ -5,12 +5,14 @@ class_name ItemShow
|
||||
@export var type: ItemStore.ItemType = ItemStore.ItemType.BASEBALL
|
||||
@export var count: int = 0
|
||||
@export var autoFree: bool = false
|
||||
@export var enough: bool = true
|
||||
|
||||
@onready var avatarTexture: TextureRect = $"%avatar"
|
||||
@onready var countLabel: Label = $"%count"
|
||||
@onready var animator: AnimationPlayer = $"%animator"
|
||||
|
||||
func _ready():
|
||||
countLabel.label_settings = countLabel.label_settings.duplicate()
|
||||
if autoFree:
|
||||
animator.play("show")
|
||||
await animator.animation_finished
|
||||
@@ -21,6 +23,10 @@ func _ready():
|
||||
func _physics_process(_delta):
|
||||
avatarTexture.texture = ItemStore.getTexture(type)
|
||||
countLabel.text = str(count)
|
||||
if enough:
|
||||
countLabel.label_settings.font_color = Color.WHITE
|
||||
else:
|
||||
countLabel.label_settings.font_color = Color.RED
|
||||
|
||||
static func generate(itemType: ItemStore.ItemType, itemCount: int = 1, isAutoFree: bool = false):
|
||||
var item = ComponentManager.getUIComponent("ItemShow").instantiate()
|
||||
|
||||
Reference in New Issue
Block a user