From ace6d3bf53cc3e18f7924316f011830245e3b386 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: Sun, 21 Sep 2025 16:35:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=AD=A6=E5=99=A8=E7=B3=BB=E7=BB=9F):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=AD=A6=E5=99=A8=E7=B1=BB=E5=9E=8B=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=8F=8A=E7=9B=B8=E5=85=B3=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在FeedName.gd中新增WEAPON枚举类型及对应翻译和颜色配置 - 在Feed.gd中添加weapons数组和weaponsBox容器 - 新增WeaponShow.tscn武器展示组件 - 添加NuclearBomb.tscn核弹武器示例 - 修改ComponentManager.gd中主题文件加载路径 - 更新FeedCardBase.tscn和FeedName.tscn以支持武器显示 --- components/Abstracts/FeedCardBase.tscn | 8 ++++--- components/Feeds/NuclearBomb.tscn | 18 +++++++++++++++ components/UI/FeedName.tscn | 13 ++++++----- components/UI/WeaponShow.tscn | 26 ++++++++++++++++++++++ scripts/Statemachine/FeedName.gd | 3 +++ scripts/Structs/Feed.gd | 2 ++ scripts/Tools/Managers/ComponentManager.gd | 2 +- 7 files changed, 62 insertions(+), 10 deletions(-) create mode 100644 components/Feeds/NuclearBomb.tscn create mode 100644 components/UI/WeaponShow.tscn diff --git a/components/Abstracts/FeedCardBase.tscn b/components/Abstracts/FeedCardBase.tscn index 63ce357..4521371 100644 --- a/components/Abstracts/FeedCardBase.tscn +++ b/components/Abstracts/FeedCardBase.tscn @@ -1,8 +1,7 @@ -[gd_scene load_steps=6 format=3 uid="uid://bykwevnv7keeh"] +[gd_scene load_steps=5 format=3 uid="uid://bykwevnv7keeh"] [ext_resource type="Script" path="res://scripts/Structs/Feed.gd" id="1_2ea75"] [ext_resource type="Theme" uid="uid://dhvs6urgf6jr5" path="res://themes/main.tres" id="2_lvrpo"] -[ext_resource type="Texture2D" uid="uid://dwwpkn4q07ja2" path="res://icon.svg" id="3_v6s0y"] [ext_resource type="PackedScene" uid="uid://bt370a1djjg5p" path="res://components/UI/FeedName.tscn" id="4_aewpy"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_n2ewr"] @@ -48,7 +47,6 @@ custom_minimum_size = Vector2(75, 75) layout_mode = 2 size_flags_horizontal = 4 size_flags_vertical = 0 -texture = ExtResource("3_v6s0y") expand_mode = 1 stretch_mode = 5 @@ -61,6 +59,10 @@ quality = 1 unique_name_in_owner = true layout_mode = 2 +[node name="weapons" type="VBoxContainer" parent="container"] +unique_name_in_owner = true +layout_mode = 2 + [node name="costs" type="GridContainer" parent="container"] unique_name_in_owner = true layout_mode = 2 diff --git a/components/Feeds/NuclearBomb.tscn b/components/Feeds/NuclearBomb.tscn new file mode 100644 index 0000000..354771e --- /dev/null +++ b/components/Feeds/NuclearBomb.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=4 format=3 uid="uid://x8moaidokct"] + +[ext_resource type="PackedScene" uid="uid://bykwevnv7keeh" path="res://components/Abstracts/FeedCardBase.tscn" id="1_kytcq"] +[ext_resource type="Texture2D" uid="uid://cp57lmeohvo3o" path="res://resources/weapons/nuclear-bomb.png" id="2_l6mhl"] +[ext_resource type="PackedScene" uid="uid://b2qhes4apaxsj" path="res://components/Weapons/NuclearBomb.tscn" id="3_3jrcs"] + +[node name="NuclearBomb" instance=ExtResource("1_kytcq")] +avatarTexture = ExtResource("2_l6mhl") +displayName = "核弹控制器" +topic = 8 +weapons = Array[PackedScene]([ExtResource("3_3jrcs")]) + +[node name="avatar" parent="container/info" index="0"] +texture = ExtResource("2_l6mhl") + +[node name="name" parent="container/info" index="1"] +displayName = "核弹控制器" +topic = 8 diff --git a/components/UI/FeedName.tscn b/components/UI/FeedName.tscn index b16ba92..ac1182b 100644 --- a/components/UI/FeedName.tscn +++ b/components/UI/FeedName.tscn @@ -3,11 +3,11 @@ [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"] -[sub_resource type="LabelSettings" id="LabelSettings_whetw"] +[sub_resource type="LabelSettings" id="LabelSettings_8o8ly"] font_size = 12 font_color = Color(1, 0.442751, 0, 1) -[sub_resource type="LabelSettings" id="LabelSettings_wse1t"] +[sub_resource type="LabelSettings" id="LabelSettings_6f4ri"] font_size = 12 font_color = Color(1, 0, 0.585938, 1) @@ -27,12 +27,13 @@ qualityColorMap = { topicColorMap = { 0: Color(1, 0, 0.585938, 1), 1: Color(0, 0.414063, 1, 1), -2: Color(0.757813, 0.497314, 0, 1), +2: Color(0.60183, 0.349817, 0, 1), 3: Color(0.40625, 1, 0, 1), 4: Color(1, 0, 0, 1), 5: Color(1, 0.421875, 0, 1), 6: Color(1, 1, 1, 1), -7: Color(0.449219, 0.449219, 0.449219, 1) +7: Color(0.449219, 0.449219, 0.449219, 1), +8: Color(1, 0.816993, 0, 1) } metadata/_edit_horizontal_guides_ = [25.0] @@ -41,7 +42,7 @@ unique_name_in_owner = true layout_mode = 2 size_flags_vertical = 0 text = "[传说]" -label_settings = SubResource("LabelSettings_whetw") +label_settings = SubResource("LabelSettings_8o8ly") [node name="label" type="RichTextLabel" parent="."] unique_name_in_owner = true @@ -57,4 +58,4 @@ unique_name_in_owner = true layout_mode = 2 size_flags_vertical = 8 text = "[生存]" -label_settings = SubResource("LabelSettings_wse1t") +label_settings = SubResource("LabelSettings_6f4ri") diff --git a/components/UI/WeaponShow.tscn b/components/UI/WeaponShow.tscn new file mode 100644 index 0000000..2cc4a9b --- /dev/null +++ b/components/UI/WeaponShow.tscn @@ -0,0 +1,26 @@ +[gd_scene load_steps=3 format=3 uid="uid://c7747qr83iojj"] + +[ext_resource type="Theme" uid="uid://b6nox1qqh50ub" path="res://themes/smallText.tres" id="1_ua7kx"] +[ext_resource type="PackedScene" uid="uid://bbm8l3hr4ihar" path="res://components/UI/ItemShow.tscn" id="2_yqc2h"] + +[node name="WeaponShow" type="HBoxContainer"] +offset_right = 189.0 +offset_bottom = 22.0 +theme = ExtResource("1_ua7kx") + +[node name="operation" type="Label" parent="."] +unique_name_in_owner = true +layout_mode = 2 +text = "获得/提炼" + +[node name="name" type="Label" parent="."] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 10 +text = "武器名称" + +[node name="soul" parent="." instance=ExtResource("2_yqc2h")] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 10 +type = 4 diff --git a/scripts/Statemachine/FeedName.gd b/scripts/Statemachine/FeedName.gd index ef4de40..3a8432d 100644 --- a/scripts/Statemachine/FeedName.gd +++ b/scripts/Statemachine/FeedName.gd @@ -18,6 +18,7 @@ enum Topic { PROBABILITY, FEED, DROP, + WEAPON, } @export var displayName: String = "未命名饲料" @@ -60,6 +61,7 @@ enum Topic { Topic.PROBABILITY: "概率", Topic.FEED: "饲料", Topic.DROP: "掉落物", + Topic.WEAPON: "武器", } @export var topicColorMap = { Topic.SURVIVAL: Color(), @@ -70,6 +72,7 @@ enum Topic { Topic.PROBABILITY: Color(), Topic.FEED: Color(), Topic.DROP: Color(), + Topic.WEAPON: Color(), } @onready var qualityLabel: Label = $"%quality" diff --git a/scripts/Structs/Feed.gd b/scripts/Structs/Feed.gd index 539178e..648cff0 100644 --- a/scripts/Structs/Feed.gd +++ b/scripts/Structs/Feed.gd @@ -10,12 +10,14 @@ signal selected(applied: bool) @export var topic: FeedName.Topic = FeedName.Topic.SURVIVAL @export var fields: Array[FieldStore.Entity] = [] @export var fieldValues: Array[float] = [] +@export var weapons: Array[PackedScene] = [] @export var costs: Array[ItemStore.ItemType] = [] @export var costCounts: Array[int] = [] @onready var avatarRect: TextureRect = $"%avatar" @onready var nameLabel: FeedName = $"%name" @onready var fieldsBox: VBoxContainer = $"%fields" +@onready var weaponsBox: VBoxContainer = $"%weapons" @onready var costsBox: GridContainer = $"%costs" @onready var selectButton: Button = $"%selectBtn" diff --git a/scripts/Tools/Managers/ComponentManager.gd b/scripts/Tools/Managers/ComponentManager.gd index d79614d..22f80ab 100644 --- a/scripts/Tools/Managers/ComponentManager.gd +++ b/scripts/Tools/Managers/ComponentManager.gd @@ -38,6 +38,6 @@ static func getFeed(i: int) -> PackedScene: static func getUIComponent(t: String) -> PackedScene: return MathTool.priority(uiComponents.get(t, false), load("res://components/UI/%s.tscn" % t)) static func getTheme(t: String) -> Theme: - return MathTool.priority(themes.get(t, false), load("res://themes/%s.tscn" % t)) + return MathTool.priority(themes.get(t, false), load("res://themes/%s.tres" % t)) static func getItemTexture(t: String) -> Texture2D: return MathTool.priority(itemTextures.get(t, false), load("res://resources/items/%s.svg" % t))