mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-10 05:37:12 +08:00
feat: 更新饲料和物品显示逻辑,添加香蕉饲料场景,重构字段显示功能
This commit is contained in:
@@ -1,12 +1,21 @@
|
||||
@tool
|
||||
extends HBoxContainer
|
||||
class_name FieldShow
|
||||
|
||||
@export var field: FieldStore.Entity = FieldStore.Entity.MAX_HEALTH
|
||||
@export var value: String = ""
|
||||
@export var value: float = 0
|
||||
|
||||
@onready var nameLabel: Label = $"%name"
|
||||
@onready var valueLabel: Label = $"%value"
|
||||
|
||||
func _process(_delta):
|
||||
func _ready():
|
||||
nameLabel.text = FieldStore.entityMap[field]
|
||||
valueLabel.text = value
|
||||
var formattedValue: String
|
||||
var dataType = FieldStore.entityMapType[field]
|
||||
if dataType == FieldStore.DataType.VALUE:
|
||||
formattedValue = str(value)
|
||||
elif dataType == FieldStore.DataType.ANGLE:
|
||||
formattedValue = str(value) + "°"
|
||||
elif dataType == FieldStore.DataType.PERCENT:
|
||||
formattedValue = "%.1f" % (value * 100) + "%"
|
||||
valueLabel.text = formattedValue
|
||||
|
||||
Reference in New Issue
Block a user