mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
feat: 增加FieldShow组件的maxed属性,优化最大值显示逻辑
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://cw5ip3rw4r3pp"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://cw5ip3rw4r3pp"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Statemachine/FieldShow.gd" id="1_gwocj"]
|
||||
[ext_resource type="Texture2D" uid="uid://iu5i8ullbhf6" path="res://resources/items/apple.svg" id="2_q02yi"]
|
||||
[ext_resource type="Theme" uid="uid://b6nox1qqh50ub" path="res://themes/smallText.tres" id="2_x62bb"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_ossj7"]
|
||||
font_size = 13
|
||||
|
||||
[node name="FieldShow" type="HBoxContainer"]
|
||||
offset_right = 144.0
|
||||
offset_bottom = 18.0
|
||||
@@ -39,6 +42,6 @@ unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 10
|
||||
size_flags_vertical = 8
|
||||
theme = ExtResource("2_x62bb")
|
||||
text = "0"
|
||||
label_settings = SubResource("LabelSettings_ossj7")
|
||||
horizontal_alignment = 1
|
||||
|
||||
@@ -60,6 +60,7 @@ func regenerateCards():
|
||||
var feeds = generateCardByQuality()
|
||||
for feed in feeds:
|
||||
feed.show()
|
||||
feed.rebuildInfo()
|
||||
avaliableFeeds.remove_child(feed)
|
||||
feedCards.add_child(feed)
|
||||
func generateCardByQuality():
|
||||
|
||||
@@ -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,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()
|
||||
|
||||
@@ -72,6 +72,8 @@ func rebuildInfo():
|
||||
var fieldShow: FieldShow = preload("res://components/UI/FieldShow.tscn").instantiate()
|
||||
fieldShow.field = field
|
||||
fieldShow.value = value
|
||||
if is_instance_valid(UIState.player):
|
||||
fieldShow.maxed = value + UIState.player.fields[field] > FieldStore.entityMaxValueMap.get(field, INF)
|
||||
fieldsBox.add_child(fieldShow)
|
||||
if noField:
|
||||
fieldsBox.add_child(QuickUI.smallText("无词条"))
|
||||
|
||||
Reference in New Issue
Block a user