From e7ffd6bce2c699f9edab105de4d720677202014e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=A8=E8=90=BD=E5=9F=BA=E5=9B=B4=E8=99=BE?= <3161880837@qq.com> Date: Thu, 28 Aug 2025 09:14:39 +0800 Subject: [PATCH] =?UTF-8?q?refactor(UI):=20=E7=BB=9F=E4=B8=80=E9=A5=B2?= =?UTF-8?q?=E6=96=99=E5=90=8D=E7=A7=B0=E6=98=BE=E7=A4=BA=E5=B9=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=93=81=E8=B4=A8=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将饲料名称从富文本格式改为统一使用displayName字段 添加品质标签显示并调整UI布局为水平排列 更新相关场景文件和脚本以支持新的显示方式 --- components/Feeds/Banana.tscn | 2 +- components/Feeds/Cake.tscn | 3 ++- components/Feeds/Cupcake.tscn | 2 +- components/Feeds/Dango.tscn | 6 +++-- components/Feeds/Donut.tscn | 6 ++++- components/Feeds/FruitPlatter.tscn | 2 +- components/Feeds/FruitSalad.tscn | 7 +++--- components/Feeds/LuckyCookie.tscn | 3 ++- components/Feeds/Milk.tscn | 3 ++- components/Feeds/Orange.tscn | 3 ++- components/Feeds/Puffs.tscn | 3 ++- components/Feeds/RedJam.tscn | 2 +- components/Feeds/Strawberry.tscn | 3 ++- components/Feeds/Taco.tscn | 4 +++- components/Feeds/WaterBottle.tscn | 3 ++- components/Feeds/Xigua-Full.tscn | 2 +- components/Feeds/Xigua-Half.tscn | 3 ++- components/Feeds/YellowJam.tscn | 2 +- components/UI/FeedName.tscn | 35 +++++++++++++++++++++--------- scripts/Statemachine/FeedName.gd | 11 +++++++--- 20 files changed, 71 insertions(+), 34 deletions(-) diff --git a/components/Feeds/Banana.tscn b/components/Feeds/Banana.tscn index 8bf7626..98f4038 100644 --- a/components/Feeds/Banana.tscn +++ b/components/Feeds/Banana.tscn @@ -15,4 +15,4 @@ costCounts = Array[int]([100, 55]) texture = ExtResource("2_2mlfi") [node name="name" parent="container/info" index="1"] -text = "[b]香蕉[/b]" +displayName = "香蕉" diff --git a/components/Feeds/Cake.tscn b/components/Feeds/Cake.tscn index 7f56d45..d405b8e 100644 --- a/components/Feeds/Cake.tscn +++ b/components/Feeds/Cake.tscn @@ -6,6 +6,7 @@ [node name="Cake" instance=ExtResource("1_f2mv8")] avatarTexture = ExtResource("2_ijk6h") displayName = "生日蛋糕" +quality = 2 fields = Array[int]([4, 8, 15]) fieldValues = Array[float]([0.06, 0.075, 1.0]) costs = Array[int]([1]) @@ -15,4 +16,4 @@ costCounts = Array[int]([125]) texture = ExtResource("2_ijk6h") [node name="name" parent="container/info" index="1"] -text = "[b]生日蛋糕[/b]" +displayName = "生日蛋糕" diff --git a/components/Feeds/Cupcake.tscn b/components/Feeds/Cupcake.tscn index 422de9b..34a1df3 100644 --- a/components/Feeds/Cupcake.tscn +++ b/components/Feeds/Cupcake.tscn @@ -15,4 +15,4 @@ costCounts = Array[int]([125]) texture = ExtResource("2_qojf3") [node name="name" parent="container/info" index="1"] -text = "[b]烘焙松糕[/b]" +displayName = "烘焙松糕" diff --git a/components/Feeds/Dango.tscn b/components/Feeds/Dango.tscn index 273ae2f..09dc533 100644 --- a/components/Feeds/Dango.tscn +++ b/components/Feeds/Dango.tscn @@ -6,8 +6,9 @@ [node name="Dango" instance=ExtResource("1_mwo1u")] avatarTexture = ExtResource("2_ckr7l") displayName = "团子" +quality = 4 fields = Array[int]([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]) -fieldValues = Array[float]([20.0, 0.21, 0.1, 0.33, 0.08, 0.15, 0.1, -5.0, 0.25, 4.0, 0.12, 0.15, 0.18, 0.6, 0.15, 2.0, 2.0, 35.0]) +fieldValues = Array[float]([80.0, 0.21, 0.1, 0.33, 0.08, 0.15, 0.1, -5.0, 0.25, 4.0, 0.12, 0.15, 0.18, 0.6, 0.15, 2.0, 2.0, 35.0]) costs = Array[int]([0, 1]) costCounts = Array[int]([5000, 6750]) @@ -15,4 +16,5 @@ costCounts = Array[int]([5000, 6750]) texture = ExtResource("2_ckr7l") [node name="name" parent="container/info" index="1"] -text = "[b]团子[/b]" +displayName = "团子" +quality = 4 diff --git a/components/Feeds/Donut.tscn b/components/Feeds/Donut.tscn index f330828..00803f9 100644 --- a/components/Feeds/Donut.tscn +++ b/components/Feeds/Donut.tscn @@ -6,10 +6,14 @@ [node name="Donut" instance=ExtResource("1_7gqm6")] avatarTexture = ExtResource("2_bv6j5") displayName = "甜甜圈" +quality = 2 fields = Array[int]([9, 7, 16]) fieldValues = Array[float]([1.0, -3.0, 1.0]) costs = Array[int]([0, 1]) costCounts = Array[int]([300, 100]) +[node name="avatar" parent="container/info" index="0"] +texture = ExtResource("2_bv6j5") + [node name="name" parent="container/info" index="1"] -text = "[b]甜甜圈[/b]" +displayName = "甜甜圈" diff --git a/components/Feeds/FruitPlatter.tscn b/components/Feeds/FruitPlatter.tscn index dac28c6..a0d00fa 100644 --- a/components/Feeds/FruitPlatter.tscn +++ b/components/Feeds/FruitPlatter.tscn @@ -15,4 +15,4 @@ costCounts = Array[int]([150, 200]) texture = ExtResource("2_6i6sp") [node name="name" parent="container/info" index="1"] -text = "[b]水果拼盘[/b]" +displayName = "水果拼盘" diff --git a/components/Feeds/FruitSalad.tscn b/components/Feeds/FruitSalad.tscn index 7266437..3e44184 100644 --- a/components/Feeds/FruitSalad.tscn +++ b/components/Feeds/FruitSalad.tscn @@ -6,13 +6,14 @@ [node name="FruitSalad" instance=ExtResource("1_mvycn")] avatarTexture = ExtResource("2_2oxe7") displayName = "水果沙拉" +quality = 0 fields = Array[int]([1]) -fieldValues = Array[float]([0.13]) +fieldValues = Array[float]([0.05]) costs = Array[int]([1]) -costCounts = Array[int]([200]) +costCounts = Array[int]([350]) [node name="avatar" parent="container/info" index="0"] texture = ExtResource("2_2oxe7") [node name="name" parent="container/info" index="1"] -text = "[b]水果沙拉[/b]" +displayName = "水果沙拉" diff --git a/components/Feeds/LuckyCookie.tscn b/components/Feeds/LuckyCookie.tscn index bc54644..4731cf9 100644 --- a/components/Feeds/LuckyCookie.tscn +++ b/components/Feeds/LuckyCookie.tscn @@ -6,6 +6,7 @@ [node name="LuckyCookie" instance=ExtResource("1_v7ebs")] avatarTexture = ExtResource("2_or0st") displayName = "幸运签语饼" +quality = 2 fields = Array[int]([14, 4, 6]) fieldValues = Array[float]([0.1, 0.07, 0.12]) costs = Array[int]([0, 1, 2]) @@ -15,4 +16,4 @@ costCounts = Array[int]([200, 75, 1]) texture = ExtResource("2_or0st") [node name="name" parent="container/info" index="1"] -text = "[b]幸运签语饼[/b]" +displayName = "幸运签语饼" diff --git a/components/Feeds/Milk.tscn b/components/Feeds/Milk.tscn index f90ebb6..d28aa2d 100644 --- a/components/Feeds/Milk.tscn +++ b/components/Feeds/Milk.tscn @@ -6,6 +6,7 @@ [node name="Milk" instance=ExtResource("1_y8pe8")] avatarTexture = ExtResource("2_15plv") displayName = "牛奶" +quality = 2 fields = Array[int]([13, 11, 7]) fieldValues = Array[float]([0.4, 0.24]) costs = Array[int]([0, 1]) @@ -15,4 +16,4 @@ costCounts = Array[int]([355, 200]) texture = ExtResource("2_15plv") [node name="name" parent="container/info" index="1"] -text = "[b]牛奶[/b]" +displayName = "牛奶" diff --git a/components/Feeds/Orange.tscn b/components/Feeds/Orange.tscn index 5eb8462..c75a29a 100644 --- a/components/Feeds/Orange.tscn +++ b/components/Feeds/Orange.tscn @@ -6,6 +6,7 @@ [node name="Orange" instance=ExtResource("1_w5eks")] avatarTexture = ExtResource("2_l6jnq") displayName = "橘子" +quality = 3 fields = Array[int]([10, 3]) fieldValues = Array[float]([0.1, 0.1]) costs = Array[int]([1]) @@ -15,4 +16,4 @@ costCounts = Array[int]([275]) texture = ExtResource("2_l6jnq") [node name="name" parent="container/info" index="1"] -text = "[b]橘子[/b]" +displayName = "橘子" diff --git a/components/Feeds/Puffs.tscn b/components/Feeds/Puffs.tscn index 2e3ed38..33fba12 100644 --- a/components/Feeds/Puffs.tscn +++ b/components/Feeds/Puffs.tscn @@ -6,6 +6,7 @@ [node name="Puffs" instance=ExtResource("1_1jl1i")] avatarTexture = ExtResource("2_p35iw") displayName = "奶酪泡芙" +quality = 3 fields = Array[int]([10, 5, 13]) fieldValues = Array[float]([0.06, 0.12, 0.3]) costs = Array[int]([0, 1]) @@ -15,4 +16,4 @@ costCounts = Array[int]([250, 100]) texture = ExtResource("2_p35iw") [node name="name" parent="container/info" index="1"] -text = "[b]奶酪泡芙[/b]" +displayName = "奶酪泡芙" diff --git a/components/Feeds/RedJam.tscn b/components/Feeds/RedJam.tscn index d1b27aa..fb36cf0 100644 --- a/components/Feeds/RedJam.tscn +++ b/components/Feeds/RedJam.tscn @@ -15,4 +15,4 @@ costCounts = Array[int]([100, 50]) texture = ExtResource("2_o2o56") [node name="name" parent="container/info" index="1"] -text = "[b]草莓果酱[/b]" +displayName = "草莓果酱" diff --git a/components/Feeds/Strawberry.tscn b/components/Feeds/Strawberry.tscn index 991d5a8..10c740a 100644 --- a/components/Feeds/Strawberry.tscn +++ b/components/Feeds/Strawberry.tscn @@ -6,6 +6,7 @@ [node name="Strawberry" instance=ExtResource("1_wr2cd")] avatarTexture = ExtResource("2_82amy") displayName = "草莓" +quality = 2 fields = Array[int]([14]) fieldValues = Array[float]([0.25]) costs = Array[int]([1]) @@ -15,4 +16,4 @@ costCounts = Array[int]([375]) texture = ExtResource("2_82amy") [node name="name" parent="container/info" index="1"] -text = "[b]草莓[/b]" +displayName = "草莓" diff --git a/components/Feeds/Taco.tscn b/components/Feeds/Taco.tscn index 1205082..e52b314 100644 --- a/components/Feeds/Taco.tscn +++ b/components/Feeds/Taco.tscn @@ -6,6 +6,7 @@ [node name="Taco" instance=ExtResource("1_iixnt")] avatarTexture = ExtResource("2_eed3c") displayName = "塔克" +quality = 2 fields = Array[int]([13]) fieldValues = Array[float]([0.75]) costs = Array[int]([1]) @@ -15,4 +16,5 @@ costCounts = Array[int]([225]) texture = ExtResource("2_eed3c") [node name="name" parent="container/info" index="1"] -text = "[b]塔克[/b]" +displayName = "塔克" +quality = 2 diff --git a/components/Feeds/WaterBottle.tscn b/components/Feeds/WaterBottle.tscn index 4e6c8e3..3ebb3e9 100644 --- a/components/Feeds/WaterBottle.tscn +++ b/components/Feeds/WaterBottle.tscn @@ -6,6 +6,7 @@ [node name="WaterBottle" instance=ExtResource("1_vfxjq")] avatarTexture = ExtResource("2_gsfud") displayName = "水杯" +quality = 3 fields = Array[int]([3]) fieldValues = Array[float]([0.25]) costs = Array[int]([1]) @@ -15,4 +16,4 @@ costCounts = Array[int]([300]) texture = ExtResource("2_gsfud") [node name="name" parent="container/info" index="1"] -text = "[b]一杯水[/b]" +displayName = "水杯" diff --git a/components/Feeds/Xigua-Full.tscn b/components/Feeds/Xigua-Full.tscn index fb40231..ba76944 100644 --- a/components/Feeds/Xigua-Full.tscn +++ b/components/Feeds/Xigua-Full.tscn @@ -15,4 +15,4 @@ costCounts = Array[int]([100, 125]) texture = ExtResource("2_j4m35") [node name="name" parent="container/info" index="1"] -text = "[b]西瓜[/b]" +displayName = "西瓜" diff --git a/components/Feeds/Xigua-Half.tscn b/components/Feeds/Xigua-Half.tscn index 49e8318..76f5597 100644 --- a/components/Feeds/Xigua-Half.tscn +++ b/components/Feeds/Xigua-Half.tscn @@ -6,6 +6,7 @@ [node name="Xigua-Half" instance=ExtResource("1_bbid3")] avatarTexture = ExtResource("2_htt7g") displayName = "一片西瓜" +quality = 0 fields = Array[int]([0]) fieldValues = Array[float]([5.0]) costs = Array[int]([0]) @@ -15,4 +16,4 @@ costCounts = Array[int]([50]) texture = ExtResource("2_htt7g") [node name="name" parent="container/info" index="1"] -text = "[b]一片西瓜[/b]" +displayName = "一片西瓜" diff --git a/components/Feeds/YellowJam.tscn b/components/Feeds/YellowJam.tscn index f23ff36..468ed71 100644 --- a/components/Feeds/YellowJam.tscn +++ b/components/Feeds/YellowJam.tscn @@ -15,4 +15,4 @@ costCounts = Array[int]([200, 125]) texture = ExtResource("2_bea7w") [node name="name" parent="container/info" index="1"] -text = "[b]蜂蜜果酱[/b]" +displayName = "蜂蜜果酱" diff --git a/components/UI/FeedName.tscn b/components/UI/FeedName.tscn index 27cdc88..cfa7d04 100644 --- a/components/UI/FeedName.tscn +++ b/components/UI/FeedName.tscn @@ -1,24 +1,39 @@ -[gd_scene load_steps=2 format=3 uid="uid://bt370a1djjg5p"] +[gd_scene load_steps=4 format=3 uid="uid://bt370a1djjg5p"] [ext_resource type="Script" path="res://scripts/Statemachine/FeedName.gd" id="1_wfxme"] +[ext_resource type="Theme" uid="uid://bje5cd08dyok7" path="res://themes/bigTextAndBold.tres" id="2_k71he"] -[node name="FeedName" type="CenterContainer"] -offset_right = 107.0 -offset_bottom = 19.0 +[sub_resource type="LabelSettings" id="LabelSettings_sby55"] +font_size = 12 +font_color = Color(1, 0.442751, 0, 1) + +[node name="FeedName" type="HBoxContainer"] +offset_right = 205.0 +offset_bottom = 25.0 +alignment = 1 script = ExtResource("1_wfxme") -quality = 0 -colorStore = { +quality = 4 +qualityColorMap = { 0: Color(0.5, 0.5, 0.5, 1), 1: Color(1, 1, 1, 1), -2: Color(0, 0.609284, 1, 1), -3: Color(0.561523, 0, 1, 1), -4: Color(1, 0.866475, 0, 1) +2: Color(0, 0.493446, 1, 1), +3: Color(0.507763, 0, 1, 1), +4: Color(1, 0.442751, 0, 1) } +metadata/_edit_horizontal_guides_ = [25.0] + +[node name="quality" type="Label" parent="."] +unique_name_in_owner = true +layout_mode = 2 +size_flags_vertical = 0 +text = "[传说]" +label_settings = SubResource("LabelSettings_sby55") [node name="label" type="RichTextLabel" parent="."] unique_name_in_owner = true layout_mode = 2 +theme = ExtResource("2_k71he") bbcode_enabled = true -text = "[b][color=#808080]未命名饲料[/color][/b]" +text = "[b]未命名饲料[/b]" fit_content = true autowrap_mode = 0 diff --git a/scripts/Statemachine/FeedName.gd b/scripts/Statemachine/FeedName.gd index d0ee107..3a19e64 100644 --- a/scripts/Statemachine/FeedName.gd +++ b/scripts/Statemachine/FeedName.gd @@ -1,5 +1,5 @@ @tool -extends CenterContainer +extends HBoxContainer class_name FeedName enum Quality { @@ -34,9 +34,14 @@ enum Quality { Quality.LEGENDARY: 1 } -@onready var label: RichTextLabel = $"%label" +@onready var qualityLabel: Label = $"%quality" +@onready var nameLabel: RichTextLabel = $"%label" +func _ready(): + qualityLabel.label_settings = qualityLabel.label_settings.duplicate() func _physics_process(_delta): - label.text = "[b][color=%s]%s[/color][/b]" % ["#" + color().to_html(false), displayName] + qualityLabel.text = "[%s]" % qualityNameMap[quality] + qualityLabel.label_settings.font_color = color() + nameLabel.text = "[b]%s[/b]" % displayName func color(): return qualityColorMap[quality] as Color