1
1
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:
2025-08-26 18:44:28 +08:00
parent 7e5a8861ec
commit 3197fe6048
9 changed files with 84 additions and 12 deletions
+12 -3
View File
@@ -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