1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-31 08:21:54 +08:00

feat: 增加FieldShow组件的maxed属性,优化最大值显示逻辑

This commit is contained in:
2025-09-06 19:29:46 +08:00
parent 6eefcac5e1
commit f387e206d5
5 changed files with 16 additions and 3 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ var fields = {
FieldStore.Entity.MOVEMENT_SPEED: 1,
"伤害": TITLE_FLAG,
FieldStore.Entity.DAMAGE_MULTIPILER: 1,
FieldStore.Entity.CRIT_RATE: 0.05,
FieldStore.Entity.CRIT_RATE: 0.8,
FieldStore.Entity.CRIT_DAMAGE: 1,
"概率": TITLE_FLAG,
FieldStore.Entity.LUCK_VALUE: 1,
+7
View File
@@ -7,6 +7,7 @@ class_name FieldShow
@export var showSign: bool = true
@export var entity: EntityBase = null
@export var useViewCast: bool = false
@export var maxed: bool = false
@onready var nameLabel: Label = $"%name"
@onready var valueLabel: Label = $"%value"
@@ -27,7 +28,13 @@ func _ready():
formattedValue = "%s°" % (MathTool.signBeforeStr(value) if showSign else str(value))
elif dataType == FieldStore.DataType.PERCENT:
formattedValue = (MathTool.signBeforeStr(value * 100) if showSign else str(value * 100)) + "%"
valueLabel.label_settings = valueLabel.label_settings.duplicate()
valueLabel.text = formattedValue
if maxed:
valueLabel.label_settings.font_color = Color(1, 0.3, 0.3)
valueLabel.text = "MAX%s" % valueLabel.text
else:
valueLabel.label_settings.font_color = Color(1, 1, 1)
static func create(newField: FieldStore.Entity, newValue: float, newShowSign: bool, newEntity: EntityBase, newUseViewCast: bool) -> FieldShow:
var fieldShow = preload("res://components/UI/FieldShow.tscn").instantiate()